freenode/#lisp - IRC Chatlog
Search
15:37:55
ogamita
Odin-: you're wrong. The code written in M-expressions has direct access to symbols: cons[CONS,NIL] -> (CONS) atom[car[cons[CONS,NULL]]] -> 1
15:38:25
ogamita
Odin-: even more so than S-expressions in a way, since literals in M-expressions are written directly as S-expressions, without a need for QUOTE!
15:39:20
ogamita
Odin-: On the other hand, it's true that the symbol corresponding to cons in the M-expression atom[car[cons[CONS,NULL]]] cannot be accessed in any direct way.
15:40:24
ogamita
Odin-: you would need to call the M-expression parser, to obtain a S-expression sexp = (ATOM (CAR (CONS (QUOTE CONS) (QUOTE NULL)))) and then use car[cdr[cdr[sexp]]]
15:41:27
ogamita
usually, you don't use a symbol editor (cf. my sedit). you use a text editor such as emacs, and to obtain the S-expressions, we have to READ the text!
15:42:59
ogamita
So you can do the same for M-expression. Actually, while I implemented my M-expression as a parser, it could as well be implemented as lisp reader macros.
15:44:22
ogamita
or rather, you need quote here: (car (cadr (cadr '#M[atom[car[cons[FOO,BAR]]]]))) -> CONS
15:45:05
ogamita
So, it's more a question of having access to the reader (parser) than a fundamental restriction.
15:46:23
ogamita
The problem in C, scheme, etc, (but not in perl), is that their tools don't give access to their reader/parser.
15:47:18
ogamita
Odin-: well, they were rather well defined, given that all the examples in the LISP 1.5 user manual were written in it, as well as all the code in the papers about lisp until some advanced date (at least later than 1962 anyways).
15:49:09
ogamita
Note that you could by way of "pre-processors" give access to the source of programs of other programming languages. Imagine defining reader macros in C to read C sources! :-) (cf. elpp for example).
15:56:26
Odin-
ogamita: Well, yes. And I'm saying Lisp's use of symbols arose because the language ultimately developed around the internals of the evaluator, not entirely on top of it.
15:57:39
Odin-
M-expressions are defined to the extent required for a formalism. S-expressions were developed to the point of being a practical programming language.
16:09:09
ogamita
Odin-: but there was a purpose to all this: it was invented to write AI programs, and it was expected to be needing introspection and reflexion.
16:09:42
ogamita
So if JMC designed lisp around a reflexive eval, it's because he had this purpose for AI.
16:10:47
ogamita
And note that lists based on conses already existed: they were invented by NSS, and they had the FLPL fortran library to manipulate those lists.
16:11:03
Odin-
ogamita: It's a logical result of the design parameters, but one I don't think was directly intentional.
16:11:46
ogamita
"Linked lists were developed in 1955-1956 by Allen Newell, Cliff Shaw and Herbert A. Simon at RAND Corporation".
16:16:53
Odin-
The bit that I find most intriguing is the way the LISP 1.5 manual draws no distinction whatever between 'atom' and 'symbol'.
16:18:28
Odin-
That's conceptually still the case, but loses the name-versus-thing distinction that's the defining feature of symbols as used now.
16:31:49
p_l
Odin-: if you look at old source code, you'll see symbols used as primary data structure often
16:36:30
Odin-
p_l: Yeah, and I think that sort of thing is the reason a full and precise definition of the M-expression language never came to fruition.
17:27:00
pjb
Odin-: why do you say so? There's a 1-1 correspondance between M-expressions and S-expressions.
17:31:05
pjb
In some sentences they consider integers as symbols to (ie. the confusion between atom and symbol), but this was also stressed by the fact that numbers were not combined with arithmetic operators 42+33, but with lisp functions: (TIMES 42 33) and when you had it as data, it had nothing numeric, it is a symbolic expression, so TIMES, 42 and 33 are symbols like any other atom.
17:31:47
pjb
42 is not a number. It's the representation of a number. There are other representations of the same number: #b101010 for example.
17:48:20
Odin-
Given an M-expression and an equivalent S-expression, I find the S-expression easier to understand.
18:20:57
Bike
clos mop kind of question. reinitialize-instance isn't called on the generic function for every method definition, is it?
18:53:09
aeth
Odin-: The advantage to something like an m-expression isn't that it's easier to understand (although it could be easier to learn), it's that you could (well, with something similar, probably not exactly an m-expression) port existing code almost verbatim from another language.
18:57:30
Odin-
Except M-expressions were originally positioned as the main syntax, not a portability layer...
18:58:50
beach
Bike: REINITIALIZE-INSTANCE is called when you want to pass modified initialization arguments to it.
19:02:09
Odin-
On a completely unrelated note, though: Is there a go-to webserver aside from Hunchentoot?
19:09:13
sjl_
there's https://github.com/jasom/clack-tutorial/blob/src/pages/getting-started-with-clack.org -- no idea how up to date it is
19:10:14
sjl_
But, Clack is more like Python's WSGI or Clojure's Ring -- it's an abstraction over top of existing servers like Hunchentoot so you can swap them out, not really a server itself
19:13:25
Odin-
I noticed. That can be a benefit, but the documentation feels a little ... lacking. :/
20:00:55
jasom
Odin-: if you are confused by anything at all after using my tutorial, let me know, either here or file an issue in github.
23:50:11
margaritamike
I'm not sure if anyone remembers from last time, but I'm hoping to get Common Lisp added to more competitive programming websites, where you can solve algorithmic problems. The effort is progressing for Kattis and there is a possibility of getting SBCL added to Codeforces as well. I was asked a technical Lisp question I did not have the experience to answer. I'm hoping someone could help, because it seems like this may be
23:50:11
margaritamike
the last technical portion in the way before SBCL is added to the Kattis online judge. The question is kind of long so I put it on paste bin
0:13:03
pjb
margaritamike: for multi-file submissions, it would be better to use asdf to deal with compilation-time loading of the dependent files. Otherwise I would add load compile-file of hello in main at compilation-time: https://pastebin.com/2wL73rxc
0:14:47
pjb
margaritamike: notice that in this case, hello.lisp is compiled twice: once when compiling main.lisp, and once when compiling hello.lisp independently. asdf would avoid that. (or using a more complex form in eval-when :compile-toplevel, such as testing for the presence of fasl and timestamps.
0:21:42
pjb
It's ok. asdf is included in sbcl. It can be used to load the system provided by the user.
0:24:40
pjb
asdf = makefile. If they allow multi-file submissions, perhaps they already allow Makefiles for other languages? Otherwise the problem we have to solve is the compilation-time dependencies between the files. We need to load some files into the compilation environment of others (kind of like #include, but we have to compile the included files too).
0:25:50
pjb
Oh, it is also possible to (defparameter *default-pathname-defaults* #P"/src/") to avoid the explicit merge-pathnames. This could be put in ~/.sbclrc.lisp, if --no-userinit is removed from my commands.
0:27:59
pjb
or: sbcl --noinform --non-interactive --no-userinit --eval ' (defparameter *default-pathname-defaults* #P"/src/")' --load /src/main ; then main.lisp could contain just: (eval-when (:compile-toplevel) (load (compile-file "hello"))) (eval-when (:load-toplevel :execute) (load "hello"))
0:28:39
pjb
In any case, it would be a good idea to add this --eval ' (defparameter *default-pathname-defaults* #P"/src/")' to all the sbcl commands, even when using asdf.
0:30:06
pjb
Well, unless it is expected the programs will have access to files in the current working directories. In that case, it may be better to leave (defparameter *default-pathname-defaults* #P"") which is the default.
0:31:04
pjb
(actually, the *default-pathname-defaults* is the absolute pathname of the current working directory with sbcl.)
0:36:16
copec
You know, pastebin offering night mode only to pro users actually made me think about subscribing for half a second
0:38:16
no-defun-allowed
then write a js snippet that flips everything dark if you must have night mode
0:46:00
margaritamike
pjb: thank you for the response. When I get home, I will properly read what you have said to try to give them a concise reply. I'm so excited that it's looking like sbcl is getting added to the kattis platform.
0:52:45
copec
I mean, I'm not totally ignorant - I know of the modern web standards are their relationships with each other, its just not an area I've breached for a long time
2:26:23
margaritamike
pjb: it sounds like life would be easier for them to just use what you have prescribed with asdf and sbcl.
2:26:57
margaritamike
They are trying to add the sbcl implementation anyway, so I don't see why using asdf would be a problem.