libera/#commonlisp - IRC Chatlog
Search
7:30:46
beach
From the glossary, we learn that a "function designator" is either a function object or a symbol.
7:33:29
beach
#'<name> is taken by READ to be a reader macro, so READ returns (FUNCTION <name>) whereas '<name> is taken by read to be a different reader macro so READ returns (QUOTE <name>).
8:13:29
beach
rendar: READ turns a sequence of characters into a data structure in memory that we call an S-expression. An S-expression is either an atom or a CONS cell containing an S-expression it its CAR slot and another S-expression in its CDR slot.
8:13:51
beach
rendar: The evaluator does not handle sequences of characters, but these S-expressions.
8:30:14
beach
Yes, you can say that. It creates a CONS cell that contains its first argument in the CAR slot and its second argument in the CDR slot.
8:33:37
beach
I mentioned what READ does, because the other day, from what you said, it seemed that you were mixing up reading and evaluation.
8:50:57
pve
Hi, do any of the commonly used utility libraries (e.g. alexandria) provide this utility, perhaps under a different name?
9:00:32
pjb
pve: it could be just (define-namespace recipe), the variable name could be a gensym too. Otherwise no, it's not a general enough concept.
9:02:35
pve
pjb: ok thanks, I included the variable name because I think I prefer defvar here, so existing entries won't be clobbered if the form is re-evaluated
9:04:06
pve
although I didn't give it much thought yet.. your gensym idea is good, so I might do that
9:24:33
pjb
the advantage of using a gensym here (or make-symbol), is that since the variable name is not interned, it cannot be used outside of the code generated by the macro, so you're safe from interferences or side-effects from outside.
9:29:43
pve
yes I see, but just to be clear: re-evaluating that will effectively erase existing entries?
9:31:40
kakuhen
depends on what you're invoking; defvar will assign to a dynamic variable if it's unbound, otherwise it doesn't change the binding
9:31:58
kakuhen
defparameter has the opposite behavior: always assigns a given initial value to a dynamic variable
9:42:16
pjb
pve: alternatively, you could store the hash-table in the symbol-plist of the name of the namespace.
11:52:55
jcowan
beach: The term "S-expression" seems to be incurably ambiguous: it can mean an internal representation or an external one. (The question of what these representations represent I leave to Kantians.)
12:06:04
hexology
maybe it's good to come up with an alternative term for the "internal" variety (hy calls it a "model"), then define terms unambiguously and adhere strictly to the distinction
12:06:41
hexology
i can't speak for lisp specifically, but i find that this is a useful communication technique in fields with confusing terminology. it's a local lexical binding but for language :)
12:09:37
random-nick
why would s-expression mean an internal representation? as far as I know those are called lists
12:11:05
_death
lisp terminology has been around for a long time, so a person who has been sufficiently exposed to it has a good sense of the channel transition matrix for practical block lengths
12:13:48
hayley
Using the definition "an S-expression is either an atom or a CONS cell ..." how is an "S-expression" different to, say, an "object"?
12:13:49
beach
I find it interesting that some people have opinions about pedagogy, yet instead of using those opinions to teach newbies about Common Lisp, they seem to wait until someone else does, only to complain about the pedagogical techniques used by that someone else.
12:16:52
hayley
Just asking, since a few days ago I got into a "discussion" which involved confusing internal and external representations, and the two "layers" of Lisp syntax, and would like to avoid having that experience again.
12:22:32
hayley
In particular, someone was trying to tell me that one could encode any data types using S-expressions (with just lists, symbols and numbers and such). They are correct, but they wrongly claimed it was specific to S-expressions; I don't think it is, because one would need their own "evaluator" of sorts to produce a graph of objects from the list structure read. One could do just the same with any other syntax.
12:25:29
hexology
beach: i hope i didn't give you the impression that i was complaining. that was not my intention.
12:26:40
beach
I can't say I much care anymore. I am getting used to this state of things. Or rather, I now know what to expect.
12:30:38
hayley
On the other hand, the S-expression syntax (or first layer of syntax) is quite permissive, and one can read forms that don't make any sense as Lisp code. But I wouldn't be so bothered if I had to encode everything as a function call, if I had to use some other syntax. Say, writing (person "Hayley" (in "#lisp")) isn't profoundly better than person("Hayley", in("#lisp")) or something like that.
12:31:06
hayley
(We could indeed use reader macros, as is done in Cleavir, to introduce syntax that denotes objects, but I had the sense that I was talking to (or, "past") someone who had an idealised notion of "Lisp" rather than any particular language, because they couldn't distinguish between internal and external representations.)
12:35:01
hexology
hayley: i think the thing about s-expressions is that a(b, c, d) is a very unnatural way to represent a list in writing, while (a b c d) more or less looks like "a list of things"
12:36:15
hayley
In this example, person(...) does not denote a list, though, it denotes some information about a person. A list is one of many kinds of things one might want to represent.