libera/#commonlisp - IRC Chatlog
Search
9:17:33
Demosthenex
functionwithparen( sorthasnoparen @{$ting->{$$whoopie}}[9] ); and they say ()'s are too hard or complex
10:47:09
nij-
After a structure is defined, we can make a structure instance easily by, say, #S(person :name "John" :email "john@gmail.com"). I wonder why such functionality isn't default to classes as well. Is it because classes are too powerful and general?
10:48:15
beach
You can do it with a simple reader macro. We do that for abstract syntax trees in SICL.
10:50:16
beach
Just define [ to be a reader macro that does (apply #'make-instance (read-delimited-list #\] stream t)) or something like that.
10:50:38
jackdaniel
nij-: structure objects are simpler - i.e all their slots are allocated on a list or on a vector
10:54:17
Josh_2
Does anyone else have an issue with very latest lisp-unit2? I clone the repo but when I load my system lisp-unit2:*test-db* is nil so the loading fails
10:55:32
Josh_2
If I set the value of *test-db* to an instance of a test-database everything loads fine (after the fact). How can I set this value just before my system loads?
10:56:15
nij-
beach, thanks.. but my question is why we can't do that for all classes like structures, and if we can why isn't it a default.
10:57:08
Josh_2
Annoyingly I have to wait for my system to fail, set the value and then load my system :(
10:57:13
beach
You can do it for all classes. I can't answer the question as to why there is no such reader macro by default.
10:58:35
beach
nij-: Lots of people want lots of thing to be predefined in Common Lisp. But Common Lisp makes it easy to define things yourself, and the language would be absolutely huge (way more than now) if those desires of everyone were met.
10:58:36
jackdaniel
in the case of structures you may decided how they are stored with the :type argument
10:59:23
beach
nij-: Perhaps a better question is why this technique for creating structure instances was not removed in the standard.
10:59:57
nij-
beach I understand your frustration. I don't mean to whine for the lack of such functionality. I'm just curious if classes are too general for such default functionality. And if so, how?
11:00:59
splittist
nij- Yes. Because there are many ways and times one might want to initialize the slot of a class instance.
11:01:53
nij-
beach's answer seems to conflict to splittist's and jackdaniel's.. but yeah beach's solution seems to take care of it..
11:02:05
Josh_2
Idk if I timed out before my message was ssent but I sorted my problem. Tard moment :sunglasses:
11:06:17
pfdietz
One should be leery of putting functionality into the reader, since it can immediately lead to incompatibilities between different software components.
11:46:14
Demosthenex
beach: work. perl is preinstalled with basic core mods. can't install anything else
13:07:12
jcowan
beach: What would be the reason for removing #s when the standard was being written?
15:24:23
splittist
It seems there's an HBS Case on Palladian Software (referring to masinter's AI presentation). Would be fascinating to read. The advertisement in that presentation includes the text "In fact, by giving each of our AI talents their own LISP machine, mirable dictu, we now have a prototype."
15:34:01
splittist
Apart from not having the advertisements (boo!) the (old) AI Magazine archives are fascinating https://ojs.aaai.org/aimagazine/index.php/aimagazine/issue/archive
17:48:38
gilberth
Part of the specification for ixelp is that it is triggered only when the garbage following a comma at least parses.
18:06:38
edwlan[m]
One thing I don’t like about a lot of the builtin read macros for data structures is they produce an actual value of some type at read time
18:08:22
edwlan[m]
I find this surprising and often wish they had chosen to expand to a function call and had a separate convention for this “immediate” behavior
18:10:05
gilberth
Well, (+ 1 2) isn't the same as (list + 1 2) either, so it would have been inconsistent. Also: You may want to CL:READ some data as well.
18:12:28
pfdietz
The problem with messing with the read table is your software ceases to be composable with other software that also does so. If you have print methods for objects that exploit the read table customization, these cease to print readably in general.
18:14:40
gilberth
btw in CLtL1 vectors were not self-evaluating. So you would need to say '#(...) to mention a vector literal.
18:19:24
gilberth
But then Lisp used to use symbols for strings. The reverse of JS, which uses strings for symbols.
18:36:20
Filystyn
how to prevent calling function that uses global variable so the glob var is always set
18:40:10
Filystyn
mmm i made a function that simply uses *GLOB-VAR* but what if it's not defined with defvar
19:32:53
danisanti
I have created an lisp image with SBCL. Does anyone know how can I load this image when I am inside the REPL? (I know that sbcl --core image-name does this)
19:34:49
gilberth
That's not possible. This image is like an executable file and can only be loaded once on startup.