freenode/#lisp - IRC Chatlog
Search
4:19:11
beach
thmprover: I find it best to have one directory, one package, and one ASDF system definition per *module*. Such a module can have several source files with one and the same initial IN-PACKAGE form.
4:20:10
beach
This way, another module can "use" another module by adding its system name to the list of dependencies in its own ASDF system definition.
4:22:47
beach
I have yet to see any advantages of a package per file. Every time it is brought up, I learn about contortions that are needed in order to avoid a single huge file for the module or a proliferation of packages that have no semantic meaning.
4:28:49
thmprover
beach: that is a sound and reasonable design decision. The problem I have is the modules are all really tightly coupled together.
4:30:06
beach
By definition a "module" has a very small interface to the outside world compared to its implementation.
4:31:41
beach
Ousterhout (I think it was him) calls them "deep" modules. He uses the image of a rectangle with constant area representing the code size, and the top edge representing the interface.
4:32:35
thmprover
Yeah, the program is a quasi-CAS with applications to physics (analytical mechanics and field theory), which makes it hard to separate out the code into modules. Ironically, it's for the same reason people called this stuff "beautiful" for a couple centuries...
4:35:32
thmprover
I'm sure it's going to be clearer as I continue plugging along, because right now my goals are fuzzy ("do science"). Later, after I have more infrastructure set up, it will become clearer (e.g., "handle celestial mechanics") and, hopefully, even clearer as I progress.
4:37:39
thmprover
beach: isn't Maxima exclusively a CAS? I was hoping to write some GOFAI to do science, in the sense of answering questions and solving problems (not doing any labwork, though).
4:37:47
oni-on-ion
lisp+repl is a good platform for having a scratch file, like a pottery floor. then seperate/order stuff out as things solidify
4:41:27
no-defun-allowed
You can write list processing and structure processing programs in Maxima, but the evaluation model is a bit wonky.
4:45:19
thmprover
I'll look at Maxima as a library, but the main goal is to have a Lispy Leibniz AI do science. Gordon Novak has a simple Lisp program that's a proof-of-concept of simple problems (you can try it online https://www.cs.utexas.edu/users/novak/cgi/physdemod.cgi).
6:00:17
oni-on-ion
how come defvar cannot provide both functionality of itself, as well as defparameter ?
6:58:19
beach
I am trying to figure out under which circumstances DEFMETHOD calls ENSURE-GENERIC-FUNCTION, and which what arguments.
7:00:16
beach
DEFMETHOD can't blindly call ENSURE-GENERIC-FUNCTION because it would need to supply some :LAMBDA-LIST keyword argument, and if it just supplies its own (with specializers and default arguments removed) then the generic function will be reinitialized without any reason.
7:01:06
beach
As long as the lambda lists are congruent, DEFMETHOD should at least avoid passing a different lambda list to ENSURE-GENERIC-FUNCTION.
7:03:13
beach
I guess DEFMETHOD can just call ENSURE-GENERIC-FUNCTION and rely on it to either reinitialize or signal an error.
7:06:51
beach
I think I need to re-read the MOP section about initialization of generic-function metaobjects.
7:21:41
beach
Does that mean that it's OK for a generic function to have methods of different classes?
7:22:15
beach
If so, DEFMETHOD should not pass the :METHOD-CLASS keyword argument to ENSURE-GENERIC-FUNCTION either.
7:23:20
beach
I mean, nothing prevents you from doing (defmethod thing ((x some-class)) (slot-value x '%thing))
7:24:32
beach
Yes, standard-reader-method and standard-writer-method are the ones used by the :READER/:WRITER/:ACCESSOR slot options.
7:24:56
no-defun-allowed
Yeah, but accessor methods have the slot definition accessible with accessor-method-slot-definition.
7:26:00
beach
Instead of going through SLOT-VALUE it is often possible to do STANDARD-INSTANCE-ACCESS instead.
7:26:04
no-defun-allowed
So (defgeneric foo (object)) (defmethod foo ((object number)) object) (defclass bar () ((baz :reader foo))) would create a generic function FOO with one STANDARD-METHOD and one STANDARD-READER-METHOD.
7:27:24
no-defun-allowed
So that generic function would require having methods of different classes.
7:29:18
beach
I guess I wasn't clear about that. I meant if you evaluate a DEFMETHOD with a class that is not a subclass of the METHOD-CLASS of the generic function in question.
7:30:18
beach
I think the METHOD-CLASS just provides the default when no explicit method class is indicated to DEFMETHOD.
7:31:19
beach
And, if so, the :METHOD-CLASS keyword argument should not be passed from DEFMETHOD to ENSURE-GENERIC-FUNCTION when the generic function already exists.
7:37:32
beach
Hmm, wait! So maybe DEFMETHOD should not call ENSURE-GENERIC-FUNCTION at all if the generic function already exists.
7:38:50
beach
I am saying that, because there is no information in the DEFMETHOD form that would justify a reinitialization of the generic function.
9:38:23
pve
Hi! So reading the logs I learn about "standard-instance-access". I should probably prefer that over slot-value in my accessor functions. I can't seem to find a function in the MOP that lets me look up a slot-definition by name. Do I need to go through "class-slots" to find it?
9:43:57
beach
pve: phoe is right (of course). But you need to respect the conditions associated with STANDARD-INSTANCE-ACCESS.
9:45:05
beach
pve: In particular, a slot with a certain name can have different locations in instances of different classes.
9:48:54
pve
beach: Ok, and if the class is redefined, the old locations are no longer necessarily valid?
9:49:27
beach
So, for example, in SICL, the call history of a generic function will have an entry for each combination of exact argument classes, and the locations are unique for such an entry.
9:49:49
phoe
if redefining a class munges the slots in any way, then the instance is obsolete and should not be accessed via s-i-a
9:54:16
phoe
"During updating, the generic function update-instance-for-redefined-class will be invoked."
9:54:21
beach
In fact, passing an obsolete instance to any generic function should trigger the update.
9:55:34
beach
Yes, but it should be handled automatically, unless you are creating your own Common Lisp implementation of course.
9:57:27
pve
hmm I need to think about this.. at this point the accessors are using slot-value, and it works fine. But using standard-instance-access would be nice too.
12:27:43
gendl
you were always using the full-blown api where you do the whole UI by yourself and call the stripe api explicitly
12:27:55
jmercouris
let's say I have the following (list 0 1 1 1 2 2 3) and I want to return a list with all of the matching elements like this (list (list 0) (list 1 1 1) (list 2 2) (list 3))
12:28:22
jmercouris
but that is a rather inefficient way, as I will have to traverse the list multiple times
12:30:28
adlai
for bonus points, destructively reuse the conses of the original list, and dynamic-extent the hashtable :)
12:40:27
phoe
(let ((result (make-hash-table))) (loop for x in (list 0 1 2 3 4 4 4 5) do (push x (gethash x result '()))) (alexandria:hash-table-values result))
12:44:22
adlai
if there is no guarantee that the test predicate is #'eql, then you can't use a histogram function
12:45:05
adlai
ACTION interprets jmercouris's original example as including the #'eq elements from the original list
15:24:49
minion
pfdietz, memo from phoe: I have some people who are interested in your work on random-testing the SBCL compiler and the techniques you used and the effects that it had and the bugs that it uncovered; is there any published code/research that I should link them to?
15:24:49
minion
pfdietz, memo from phoe: also, if you ever have the time to prepare and speak about it, I would love to listen to this on an Online Lisp Meeting someday (and so would these people).
15:25:45
phoe
pfdietz: Zoom; the link is theoretically public and visible at https://github.com/phoe-trash/meetings/blob/master/stack/2020/SG-11-30.md but I have no idea how the wasm people are going to react if they suddenly get a bunch of curious lispers watching the thing
15:26:37
aeth
pfdietz: re the memo... wow, the ANSI test suite is huge... https://github.com/pfdietz/ansi-test
15:27:36
phoe
travv0: I explicitly do not say that other people should join; I'm just pointing out that the meeting link is public, which might or might not be intentional - likely the latter
15:29:11
aeth
Hmmm... I wonder if I should try to programmatically convert the ANSI Common Lisp test files to test Airship Scheme CL compatibility. In theory, the semantics should be preserved where they make sense, even though in practice, many things (e.g. the macros like LOOP) would require reimplementations...
15:30:09
aeth
The only hard parts would be things that take advantage of the lisp-2 nature of CL while naming variables...
15:35:51
pfdietz
ansi-tests is really a combination of two things that should be separated: the tests traceable to specific parts of the spec, and the random testing infrastructure (which itself is composed of several different approaches.)
15:36:49
aeth
Hmmm... I actually wonder if the easiest way to use ansi-tests might be to make the meme a reality and implement CL in Scheme in CL...
15:37:32
pfdietz
The random tests come in three main flavors: generation of random integer-value forms to test the compiler, "random type prop" types that try to test type inference on small functions, and a mutational testing scheme that stitches together fragments of lisp code from public lisp projects to try to get the SBCL compiler to throw errors (this last
15:39:58
aeth
The point of implementing CL in Scheme in CL, of course, would be to (1) ensure that the semantics of the functions are preserved and (2) ensure that the reimplemented macros (at the very least, the iteration ones) are semantically identical.
15:42:27
phoe
and so you can run CL applications on Scheme and therefore verify the intermediate Scheme layer
15:42:51
pfdietz
Analogy generator failed on sea:submarin :: land:? https://boredhumans.com/analogy_generator.php
15:44:31
aeth
jcowan: Airship Scheme? It passes the first test, i.e. it reads the test file. This was fairly non-trivial.
15:45:08
pfdietz
I'm afraid I got a bit snippy on r/scheme when someone complained about all the funcalls in Common Lisp. If you look at quicklisp, about 0.4% of lines have a funcall on them. Granted, Scheme-style Common Lisp would have more.
15:45:23
aeth
I probably could've worked through the reader in a few days if I was willing to sacrifice quality.
15:46:06
aeth
pfdietz: I saw that and nobody got that right... You don't use funcalls for FP, you use it for higher-order-functions, which are just a subset of FP. And CLers use a lot of higher-order-functions, but usually ones that are preexisting, like map/mapcar.
15:47:38
aeth
jcowan: If I added semantics to define, I could probably get some minimal Scheme-like going already.
15:49:25
aeth
jcowan: As it stands, I can do this and it will read because I'm only missing #1= and #1# labels (like in the /topic here) in the reader: (with-open-file (s #P"~/git/other/no-backup/chibi-scheme/tests/r7rs-tests.scm") (scheme-read s))
15:49:58
phoe
I flip* through these slides real quick to animate their contents; 240 slides took me like 50 minutes to go through on the last Online Lisp Meeting
15:50:28
flip214
phoe: https://raw.githubusercontent.com/phoe-trash/meetings/master/stack/2020/presentations/2020-11-30-herda-control-flow-in-common-lisp.pdf
15:52:41
phoe
I remember heisig's greenscreen as the greatest non-strictly-technical thing of ELS 2020
15:53:07
flip214
but unless time is really reserved by booking a hotel, it's hard to find it again later on
15:54:11
flip214
perhaps 2022 there'll be a real ELS again... I could try to get there 3 days early and watch 2020 and 2021 ;/