freenode/#lisp - IRC Chatlog
Search
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.
9:07:56
schweers
It seems my intuition is misguided here, maybe someone can clarify: how come SORT is marginally faster on a list than on a simple-array? Both without any type declarations and initially filled with the same random fixnums.
9:08:12
schweers
I filled the list with (random most-positive-fixnum) and copied it over to the array
9:09:13
beach
Just guessing, but mergesort is faster than quicksort, and mergesort is easy to implement on a list, but hard on a vector, so typically quicksort is used on vectors instead.
9:11:34
schweers
okay, I get that different algorithms may be the reason, but, admitting to have quite the gap in my knowledge … is mergesort really faster than quicksort? I guess not always, right?
9:13:16
beach
mergesort needs O(n) additional memory (except for recent research that decreases that significantly, at the cost of more operations).
9:13:41
Shinmera
Can't mergesort also be parallelised easily? Though I doubt any implementations do that currently
9:13:45
beach
But since the list already contains O(n) additional memory, no more memory is required to use mergesort on a list.
9:15:23
beach
The can both be parallelized, because they are both divide-and-conquer, so they both generate two separate problems of around half the size.
9:17:02
beach
The interesting thing I plan to do is to implement mergesort on vectors by checking how much stack space is available and choosing an implementation that is good for that available space. In the worst case, choose a slower version that uses only O(1) additional memory as recent research shows is possible.
9:18:51
schweers
beach: you mentioned that this comes at the cost of more operations. do you know off the top of your head how much more?
9:21:08
beach
Fast Stable Merging and Sorting in Constant Extra Space, by Bing-Chao Huang and Michael A. Langston.
9:22:53
beach
Also: Practical In-place mergesort, by Jyrki Katajainen, Tomi Pasanen, and Jukka Teuhola.
9:26:12
beach
It is well worth getting one. It is not expensive and you get a discount on conferences, sometimes even on ELS.
9:26:13
schweers
I have to admit that I’m not quite sure what you meant by “forward search”. I just used the search bar.
9:26:40
beach
For each article entry, there is a "cited by" list. You find the entry for the article you know about, then you click on that list. That way you go forward in time.
9:37:05
beach
That's what I mean by the membership being worth it. You win after just a few articles.
9:41:17
jackdaniel
I'm not very impressed by paywalls for articles (given they don't pay scientists for whose papers they charge and which are usually written for money collected in form of taxes)
9:42:07
beach
It could be worse. Now, many journals make the authors pay to have the article published, and it is not cheap either.
9:42:47
schweers
As I’m not an academic I surely lack insight, but I do wonder how this model could ever arise, let alone stay alive in the digital age
9:42:49
beach
I consider the ACM membership fee as paying for the entire digital library service (in addition to getting CACM on paper).
9:43:40
beach
schweers: Inertial. On-line journals need to acquire the same prestige as the established journals owned by the publishing houses.
9:44:50
schweers
beach: that’s not what I meant (the ACM). But what I’ve heard from other publishers is that they ask for money left and right (and quite substantial amounts at that) without /seeming/ (am I wrong here, I’d love to know) to provide any real benefit.
9:45:59
beach
It is only a matter of time. This is probably why they try to extract as much money as possible before they disappear.
9:46:00
TMA
schweers: well, originally it was a journal subscription -- a printed, bound object containing the articles. then there was a service that mailed you a single article. boom, the world went digital -- but the inertia and inflation means you pay for it even though the costs have bottomed.
9:47:07
jackdaniel
schweers: you may be interested in Aaron Swartz story (especially his Guerilla Access Manifesto)
9:47:09
schweers
Yes, but aparantly universities pay obscene amounts of money to access their own research. Anyways, I should be doing other stuff than complaining online ;)
9:49:05
jackdaniel
ftr: https://archive.org/stream/GuerillaOpenAccessManifesto/Goamjuly2008_djvu.txt (sorry for the offtopic)
10:32:09
chenbin
can somebody help this sbcl on windows issue? https://pastebin.com/raw/3gAPvJQr thanks
10:44:58
knobo
Which documentation generation system do you use, and which do you think I (or other) should use?
10:45:36
Shinmera
Documentation isn't generated, you write it. But you can assemble the documentation into a single file with systems like Staple.
10:47:02
beach
knobo: Perhaps you are thinking of generating documentation from documentation strings? That technique has the unfortunate consequence that there is no place to put a section about goals, concepts, philosophy, etc. As a result, the documentation often becomes incomprehensible.
10:48:54
Shinmera
knobo: It's not about being stupid or not, some people genuinely believe that dumping out function signatures counts as documentation.
10:49:30
beach
knobo: I think both me and Shinmera object a bit to the term "documentation generation system" and I also think we both encourage more effort into writing good documentation as opposed to collecting it from documentation strings that are often inadequate, partly because they represent noise in the source code.
10:50:27
TMA
beach: the chenbin's question was ended with some five spaces and a "thanks" --- an inadequate expression of gratitude, granted, but not absent altogether
10:51:14
beach
Take this one for instance (SBCL): (documentation 'car 'function) => "Return the 1st object in a list."
10:51:24
knobo
Would be good if I could write documentation in a seperate file, and include documentation from docstrings.
10:51:36
Colleen
knobo: About documentation-utils https://shinmera.github.io/documentation-utils#about_documentation-utils
10:52:43
beach
knobo: Slots should not be part of client-visible documentation. They are implementation details that may change over time.
10:52:48
knobo
beach: right.. I forgot about that. But simple inline docstrings can be useful. So I'll not use setf.
10:55:04
beach
Documentation strings that are physically near code represent noise to the maintainer of the code, because, presumably he or she already knows the external interface before attempting to modify the code. I think that is the reason (the noise factor) why many documentation strings are so skimpy; you don't want to mess up the code too much.
10:57:51
knobo
Though it is often easy to read it from the code. If the argument is an alist or a plist or something else.
10:59:33
knobo
Any project that is so good that it could be used as a reference case for writing documentation?
11:02:04
Shinmera
knobo: ... yeah so? Are you asking about the act of writing documentation, or the literal way in which the strings are put into source code?
11:02:27
Shinmera
Because for the former I fail to see how the place where you put your documentation matters at all
11:07:02
makomo
thought i might see a nickname like "rstrandh" or something on irc. i always wondered who that guy was :-)
11:07:10
knobo
In javascript I use jsdoc. I just thought maybe people used a similar strategy in lisp.
11:07:58
Shinmera
knobo: I write the documentation overview, concepts, etc into the README.md . This then gets combined with the docstrings into an about.html file that contains the entire documentation for a project.
11:08:26
beach
makomo: Thanks, you too. For the record, my nick is just a literal translation into English of my last name.
11:13:40
makomo
beach: ah, now i remember your page also (it has a unique look). i've read your essay on lisp a few months back i think, when i was just starting out.