freenode/#lisp - IRC Chatlog
Search
19:30:59
pagnol
makomo, I have a copy of the book and skimmed the first few chapters but I feel I would need to set some time aside specifically for studying the MOP to get anything out of it
19:36:15
pagnol
I found a good tutorial here in case anyone cares: http://www.drdobbs.com/parallel/lisp-classes-in-the-metaobject-protocol/200000266?pgno=5
20:19:23
fiveop
Is there an idomatic name for the function that is similar to SOME, but checks elements of trees instead of sequences? Does Alexandria have such a function?
20:22:48
makomo
pagnol: oh, nope, but i want to learn more about it because (1) it's very interesting and (2) i've been doing some java/spring recently and am interested in the comparison between the two
20:23:42
fiveop
phoe: that would work, if I thought the thing through properly. I do not only want to check the atoms, but the three itself and its subtrees as well.
20:24:05
phoe
fiveop: ooh, i see. do you want some kind of tree traversal and apply the predicate to each tree node?
20:24:27
phoe
I think nothing in the standard or in Alexandria is suited for that. Feel free to roll your own.
21:34:44
Shinmera
pagnol: I implement a metaclass that does strict type checking on slots for my chat protocol specification
22:22:36
phoe
BTW, who is responsible for https://ccl.clozure.com/irc-logs/lisp/lisp-2018-01.txt ? It stopped logging earlier today.
23:11:20
krwq
hello, what is the best way to redirect multiple streams into one ideally without reading all of them entirely into memory? is there some good library for combining streams?
23:12:30
Xach
krwq: a concatenated-stream would be half the answer, then a loop of your own making to write the output.
23:22:11
krwq
Xach: this works for my case but in general do you know if there is any library which would conceptually as this? https://pastebin.com/aw4P1AqV
23:25:18
krwq
Xach: the problem with the concatenate-stream is that I have a function which compiles from stream and I'd like to provide it several files but I do not neccessarily want to open all files
23:28:46
krwq
technically I can create temporary file or with-input-from-string and with-output-to-stream together to have memory stream
23:32:02
pillton
Does the function that processes the input stream do something after reading all of the input?
23:33:34
pillton
Why can't you just call the function multiple times? Why do you have to concatenate the streams?
23:34:32
krwq
pillton: so specifically this is parenscript - I'd like to concatenate macros before the script I compile
23:36:41
krwq
but that's not the first time I'm fighting with streams - I'd like to learn some better way to handle them
23:58:03
pillton
I'd say you need to come to terms with the fact that the standard defines no "pipe" stream.
0:03:20
pillton
Personally, I would just write everything to a temporary file and process the temporary file.
0:04:30
pillton
It can be done with a single thread and there is no possibility of starvation/deadlock.
1:15:14
White_Flame
in terms of wanting (defconstant +fixed-list+ '(a b c)), since the list value is not the clhs-same as the prior read list value, what's the preferred way around it?
1:15:52
White_Flame
one would be to keep it in a file that isn't easily reloaded, another would be to wrap defconstant in a macro that tests if the constant is unbound before doing DEFCONSTANT
1:16:37
White_Flame
the problem being that when editing & recompiling, the constant differs in sameness and throws errors
1:17:22
White_Flame
smells like checking bound is the way to go, if it's common enough for alexandria (which we still haven't fully migrated to :-P)
1:25:01
Bike
part of it is that amop isn't even a reference, it's written like "hey, we could design clos to work like this. wouldn't that be cool? still kind of a work in progress" but then it gets used as a reference anyway.
1:26:04
Xach
reminds me because the story of self is kind of like "here's what we want the language to be like, let's work relentlessly to make it fast enough to be practical"
1:26:17
Bike
lots of parts of mop are actually kind of loony, which more design probably could have worked out
1:28:40
Bike
But most of the reason people use mop is to interrogate classes, rather than methods or generic functions. and the metaclass stuff is pretty solid.
1:29:08
Bike
i managed to write something that mimicked a python library with class annotations and such like in like, a day. pretty good
1:31:30
Bike
https://github.com/clasp-developers/cl-jupyter/blob/master/src/cl-jupyter-widgets/iwidgets/widgets/traitlets.lisp here you go.
1:31:49
Bike
the comment on top explains most of it... basically it adds some things to slot definitions
2:08:56
White_Flame
AND keeps testing to see if it hits something false, so it can drop out, default to true if nothing tripped that test
2:09:17
White_Flame
OR does the opposite, early exiting if it hits something true, defaulting to false if none is found
2:10:15
White_Flame
the #+ and #- reader macros are sortakinda like IFDEF from C's preprocessor, including or excluding the following form based on the boolean expression
2:10:48
White_Flame
so things like #+sbcl (sb-ext:something) #+clisp (something-else) will include a custom expression per implementation
2:11:27
White_Flame
because the symbols SBCL and CLISP are in the variable *FEATURES* on their respective plaform. #+/#- searches that list
2:11:29
aeth
It's actually interesting to see things with 0 arguments that can only be 0-argument in a non-infix language
2:11:44
fiddlerwoaroof_
As far as I can tell, your reader macro function gets called but its output is ignored
2:14:48
fiddlerwoaroof_
In my case, the problem was ccl would complain when it tried to read SB-SYS:SYSTEM-AREA-POINTER
2:16:12
fiddlerwoaroof_
Ah, yeah, I was using destructuring-bind on the result of read-delimited-list and getting nil
3:25:39
pillton
Bike: Why is make-method-lambda loony? I thought it was needed for call-next-method.
3:26:29
Bike
did you know that if you compile this file, the generic function will be defined by the defmethod at macroexpansion time, so that make-method-lambda can be used?
3:29:17
pillton
I don't really see the difference between that and a type being made available when compiling a defclass.
3:31:28
Bike
anyway, that's just a weird tidbit, the actual problem is that make-method-lambda lets you control the exact form of the method functions, except nobody seems to really support that super well
3:31:58
Bike
like, you can have a method function that takes more than two arguments, but how do you call it? call-method? call-method already has contradictory definitions between the mop and clhs
3:32:38
pillton
Oh wait. The defmethod creates another function object which may be different to the one specified by the previous defgeneric.
3:33:49
Bike
https://pdfs.semanticscholar.org/38b2/39e630294c2020c1de7815e0bd1f9261e508.pdf here, just read this, cos does more mop shit than i ever will
3:35:35
pillton
I made it an error in specialization-store to define "methods" for a non existent "generic" function.
3:37:02
beach
pillton: Are you planning to submit an article, perhaps about specialization-store, to ELS?
3:40:57
pillton
The other benefit you get for signalling an error for non existent generic functions is that the syntax layer can also become parameterised by the function object.
3:45:08
pillton
For example, the processing of new class options to defclass should be done by the metaclass. I don't think that is the case at present.
3:46:13
Bike
which is a little annoying, it's true. i wanted to do something funny with methods but the extra initargs are all quoted and it stymied me
5:26:02
pillton
If you specify the append method combinator in the generic function, why do you need to do it again in the method definition?
5:26:53
Bike
the method qualifiers aren't really relevant until a method combination is actually done, and that might be as late as when youc all the generic function
5:48:08
pillton
Read the paragraph starting with "Pathname merging treats a relative directory specially."
5:49:24
pillton
You also have to remember that common lisp pathnames discriminate between files and directories regardless of what the OS thinks.
5:50:31
pillton
So #p"salmon" is equivalent to (make-pathname :name "salmon") which is not (make-pathname :directory '(:relative "salmon")).
5:56:05
jmercouris
alright, so my function works: https://gist.github.com/bea205432895183d84e6a42f46215b28
5:56:40
jmercouris
it's supposed to make a file relative to ~/.config/next/, so if you pass (xdg-data-home "fish") it will point to ~/.config/next/fish
6:02:04
pillton
I usually do (defvar *foo-data-directory* (merge-pathnames ...)) and then (defun foo-data-path (in) (merge-pathnames in *foo-data-directory*)).
6:06:19
pillton
Well, if you are nice, the variables would go in a foo-config.asd system which would allow the user to configure the pathnames before loading foo.asd.
6:08:10
pillton
The variables don't go in the asd. I meant that you create a foo-config system which loads a lisp file containing the variables.
6:10:17
pillton
e.g. https://github.com/markcox80/specialization-store/blob/master/specialization-store.asd#L4
6:12:22
pillton
Yes. (Though the example I linked is a system for figuring out what an implementation supports.)
6:15:21
jmercouris
I didn't want to implement it as I'd rather have a nice ~/.next.d dir, but I think it is what users want
6:15:40
jmercouris
pillton: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
7:02:12
borei
i have several classes generic-vector (just vector) --> r-vector (vector with double-float components) and 3d-vector (vector in our 3D space)
7:03:36
phoe
(defclass generic-vector () ()) (defclass r-vector (generic-vector) ()) (defclass 3d-vector (r-vector) ()) - this is what I understand so far
7:03:48
borei
my question is will initialize-instance :before method be proper place to provide space dimension for 3d-vector
7:06:11
phoe
I would rather define an INITIALIZE-INSTANCE :AFTER method on GENERIC-VECTOR with a key argument of :SPACE asking either for the vector size, or :VECTOR asking for the array itself.
7:06:33
phoe
This way, you can either setf the vector to the slot, or construct a new vector based on :SPACE.
7:07:18
phoe
But that depends on how you want to initialize the generic-vector class, and may depend the most of the array element type of your vectors.
7:07:49
phoe
because if you only pass :SPACE, then you have no chance to modify the type of the vector.
7:08:12
phoe
so you may actually want to add :SIZE and :TYPE, or just :MAKE-ARRAY-ARGUMENTS for most generality.
7:08:52
phoe
and (check-type size unsigned-byte) (apply #'make-array size make-array-arguments) in your constructor.
7:11:37
borei
when i do call make-instance 'vector-3d i don't want to supply space dimension, it's clear from the class type
7:15:34
phoe
You could try to define an INITIALIZE-INSTANCE method on VECTOR-3D that calls (call-next-method :size 3).
7:17:35
phoe
This should work since you are allowed to define custom methods on INITIALIZE-INSTANCE.
7:19:37
phoe
this also appears that it should work, with the additional side effect of making it impossible for the user to supply their own :SIZE.