jackdaniel changed the topic of #lisp to: Common Lisp, the #1=(programmable . #1#) programming language<http://cliki.net/> logs:<https://irclog.whitequark.org/lisp,http://ccl.clozure.com/irc-logs/lisp/> | SBCL 1.4.5, CMUCL 21b, ECL 16.1.3, CCL 1.11.5, ABCL 1.5.0
charh_ has joined #lisp
charh has quit [Ping timeout: 252 seconds]
Jesin has quit [Quit: Leaving]
charh_ is now known as charh
Josh_2 has quit [Read error: Connection reset by peer]
johnjay has quit [Ping timeout: 256 seconds]
Josh_2 has joined #lisp
Josh_2 has quit [Ping timeout: 252 seconds]
<gendl> So I see the Lisp Game Jam starts in a few hours. I wonder what the theme will be.
<no-defun-allowed> fruit blending simulator
scymtym has quit [Remote host closed the connection]
shifty has joined #lisp
orivej has quit [Ping timeout: 244 seconds]
<aeth> the theme is going to be chess-related. it has to be.
<aeth> I just spent the past week or so working on chess programming stuff
<aeth> (The part that reads UCI input from a chess AI, not the part that sends UCI output from a chess AI, although that might be the next logical step.)
Oladon has joined #lisp
ryan_vw has quit [Ping timeout: 245 seconds]
sjl has quit [Quit: WeeChat 2.3-dev]
<aeth> (I obviously don't know what the theme is.)
<aeth> Is anyone here an ASDF expert?
<Bike> is anyone?
<Bike> what do you want to do
<aeth> I want to (defclass foo-file (source-file) ...) or (defclass foo-file (cl-source-file) ...) and write the absolute minimum necessary to get the file to load and compile via ASDF.
<aeth> For the sake of simplicity, I'll do this with cl-brainfuck since I already have a function that turns a foo.bf file into a foo.lisp file.
AroPar has joined #lisp
<aeth> So I have (defclass brainfuck-file (source-file) ((type :initform "bf"))) (but might need to turn that into a subclass of cl-source-file and use a cleverly-placed :before method) and I have a function that when given the pathname for a .bf brainfuck file reads it and creates a .lisp Common Lisp file.
scymtym has joined #lisp
<aeth> What I want to do is have an ASDF component (:brainfuck-file "foo") that creates an intermediate .lisp file and then handles that created file like a .lisp (:file "foo")
<aeth> (Is the Brainfuck version of this useful? No, but what it is is 100% complete. I can already go hello.bf => hello.lisp => hello.fasl and then #'load that fasl and have SLIME say "Hello World!" I just cannot do that through ASDF.)
astronavt has quit [Read error: Connection reset by peer]
<gendl> aeth: Subclassing cl-source-file and using a :before method to process the .corresponding .bf file into the actual the actual .cl or .lisp file seems intuitive to me.
Kundry_Wag has joined #lisp
<aeth> yes
<gendl> that way you don't have to re-write the actual code for doing the compile/load of the cl file
<aeth> My best guess at the moment is that I should be subclassing cl-source-file and then replace the source pathname in a :before
<gendl> The actual source pathname can be the .cl file the whole time
<gendl> and just have the :before method go look for a file with :defaults source-file :type "bf" and call your cl-bf function to yield the actual .cl source-file just-in-time.
<gendl> But, IANAAE
<gendl> the position of obsessive ASDF expert is open right now as well, as far as I can tell... (Faré, when will make your fortune in crypto and come back to do CL as your retirement hobby??)
<gendl> rpg is somewhat of an expert as well as the official maintainer as far as I know, but he's not around just now.
Kundry_Wag has quit [Ping timeout: 252 seconds]
robotoad has quit [Remote host closed the connection]
AroPar has quit [Quit: Leaving]
<aeth> Well, by the time it gets to the ops like compile-op, the object c of class brainfuck-file already has the absolute-pathname ending in /cl-brainfuck/hello.bf
<aeth> So I guess I should be looking at when the object is created.
<aeth> Or maybe component-pathname
mgsk has quit [Quit: ZNC 1.7.0 - https://znc.in]
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 252 seconds]
<no-defun-allowed> okay so phonemes->syllables is even easier (at least for english)
<no-defun-allowed> cool, now i don't have to write a weird clustering algorithm to find all but the last syllable and things
Oladon has quit [Quit: Leaving.]
<no-defun-allowed> also, what slots can i not use when making subclasses of standard-class?
<Bike> er, what?
Pixel_Outlaw has joined #lisp
<no-defun-allowed> hmm maybe i shouldn't do that
<Bike> what are you asking
<no-defun-allowed> well now i'm going to ask "how do i make metaclasses" i suppose
<Bike> i don't know what you mean about slots. you can add slots if you like. you can access existing slots with the defined mop accessors.
wanz has joined #lisp
<no-defun-allowed> actually, i'm not sure if it's a metaclass. i want to make a class similar to standard-class which i want to make instances of
rocx has joined #lisp
<Bike> what do you want that's distinct?
<no-defun-allowed> the class will also carry a hidden metadata value which will contain instructions for de/serializing instances
<Bike> so you want to add a slot, probably.
<no-defun-allowed> yes, i want to add a slot to a subclass of standard-class
<Bike> (defclass my-class (standard-class) ((serialization-info :initarg ...)))
<no-defun-allowed> i tried the usual (defclass standard-foo-class (standard-class) ((formats :initarg :formats))) but it errored
<Bike> what was the error?
<no-defun-allowed> The class #<STANDARD-CLASS COMMON-LISP:STANDARD-OBJECT> was specified as a superclass of the class #<STANDARD-NETFARM-CLASS COMMON-LISP:NIL {1002571863}>, but the
<no-defun-allowed> metaclasses #<STANDARD-CLASS COMMON-LISP:STANDARD-CLASS> and #<STANDARD-CLASS COMMON-LISP-USER::STANDARD-NETFARM-CLASS> are incompatible. Define a method for SB-MOP:VALIDATE-SUPERCLASS to avoid this error.
<no-defun-allowed> sorry, hastebin is playing up and pastebin is blocked at school
<Bike> ok so the error wasn't from the actual metaclass definition.
<Bike> do what it says, define a validate-superclass method. probably oen that always returns t.
<no-defun-allowed> oh yes, it was from a MAKE-INSTANCE, my bad
<no-defun-allowed> right then
<no-defun-allowed> nice, it works. thanks
<Bike> validate-superclass is there if you want to avoid weird inheritance hierarchies
<Bike> but most of the time you're just fine with anything, so
<no-defun-allowed> i see.
<no-defun-allowed> good they thought of that then
nalik89 has joined #lisp
rumbler31 has joined #lisp
nullniverse has quit [Ping timeout: 244 seconds]
ryan_vw has joined #lisp
rumbler31 has quit [Ping timeout: 272 seconds]
<no-defun-allowed> one last silly question: is there a way to make function recompilations appear to threads atomically?
<no-defun-allowed> so then you wouldn't have a small window of time where threads have updated functions and not updated functions. actually that's probably just bad abstraction.
<no-defun-allowed> maybe it's not, but still if you had to replace some kind of backend it'd be best to have it update all in one go
<no-defun-allowed> ooh that shouldn't be too hard actually
<no-defun-allowed> compile some lambdas, interrupt all threads with a thunk that waits on a bt:condition-variable, setf the fdefinitions and notify them when we're done
Kundry_Wag has joined #lisp
<no-defun-allowed> also, rollback in case it goes horribly wrong would be good too
doesthiswork has joined #lisp
Kundry_Wag has quit [Ping timeout: 252 seconds]
<no-defun-allowed> doesthiswork: yes it does
wanz has quit [Remote host closed the connection]
ealfonso has joined #lisp
igemnace has joined #lisp
Roy_Fokker has quit [Read error: Connection reset by peer]
Kundry_Wag has joined #lisp
cylb has quit [Ping timeout: 245 seconds]
Kundry_Wag has quit [Ping timeout: 244 seconds]
anewuser has joined #lisp
igemnace has quit [Quit: WeeChat 2.2]
igemnace has joined #lisp
ealfonso has quit [Ping timeout: 268 seconds]
Kundry_Wag has joined #lisp
ealfonso has joined #lisp
esrse has joined #lisp
Kundry_Wag has quit [Ping timeout: 268 seconds]
olopierpa has quit [Quit: Page closed]
lnostdal has joined #lisp
dddddd has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
lnostdal has quit [Ping timeout: 252 seconds]
<oni-on-ion> need lisp image sync for true parallel nodes. or, why doesnt lisp have that kind of 'green' thread
Kundry_Wag has quit [Ping timeout: 252 seconds]
Pixel_Outlaw has quit [Quit: Leaving]
<beach> Good morning everyone!
ryan_vw has quit [Ping timeout: 268 seconds]
arescorpio has joined #lisp
amberglint has joined #lisp
<oni-on-ion> morn
<no-defun-allowed> o/
<pillton> G'day beach.
<russellw> morning!
<beach> pillton: Long time no see. Where have you been?
<pillton> beach: Things have been hectic this year.
<beach> I see.
<beach> Is it better now?
lnostdal has joined #lisp
<pillton> Not really, I just wanted to see what was happening in the community.
<beach> Good. Great progress on McCLIM for one thing.
<beach> Not by me, but by many others.
<pillton> That is great.
<beach> Yes, I am very pleased with that.
<beach> And Eclector is not independently maintained by scymtym and it works very well.
<beach> It's a portable Common Lisp reader, capable of also "reading" comments and other skipped material and to preserve source location of everything it reads.
<beach> It already has several clients so a lot of duplicate work is avoided.
<pillton> That is also great.
<pillton> It is it going to be used by ASDF?
<beach> That I don't know. It's a good suggestion, though.
<pillton> ....so the :system-depends-on option works properly.
<beach> It is used by SICL/Cleavir, Clasp, Second Climacs, and some of scymtym's own work.
nalik89 has quit [Quit: Undertaking stack overflow prevention]
<beach> That could be suggested to the ASDF maintainer.
anewuser has quit [Quit: anewuser]
<beach> pillton: Oh, and I created a #sicl channel where I can freely blab about SICL progress.
<beach> Currently, I am working on the bootstrapping procedure.
<LdBeth> Gooey evering
<beach> Hello LdBeth.
<beach> pillton: And there is slow but steady progress on Cleavir though the work of Bike.
<pillton> A good year then!
<beach> Definitely! At least as far as I am concerned.
Kundry_Wag has joined #lisp
<beach> The SICL progress is not that spectacular, seen from the outside. But I did find a good solution to the problem with method combinations cited in Didier Verna's paper.
<beach> We might write a joint ELS article about it.
<beach> A second (short) article might be "MAKE-METHOD-LAMBDA revisited", because I read Pascal Costanza's article about the subject and it has many errors in it. Plus, I don't think there is a problem with it as his article claims.
<beach> A third paper (if I can get this stuff to make fast enough progress) might be describing the SICL bootstrapping procedure.
<beach> Oh, and no-defun-allowed has agreed to organize ALS with you. [just kidding]
<no-defun-allowed> Australian Lisp Symposium? hell yeah i'm up for that
shifty has quit [Ping timeout: 244 seconds]
<beach> There are two of you. :)
<beach> I will definitely show up.
<no-defun-allowed> it's a bit far away
Kundry_Wag has quit [Ping timeout: 246 seconds]
<beach> That's relative.
<beach> Oh, for me?
<beach> Nah.
<LdBeth> Then there’s a need for an Asia Lisp Symposium
<beach> If we make it "Australasia ..." then there are a few more.
<pillton> ALS is a good idea. I just did Brisbane<->Madrid and I am not keen to repeat it.
<beach> Ouch.
<no-defun-allowed> hey there's three now but there's less chance we'll decide on a common place to host it
<beach> loke is in Singapore, and the author of roswell is a regular visitor to ELS, I think.
<beach> no-defun-allowed: Fair enough.
<pillton> There is quite an active community in Japan and Korea I think.
<beach> Great!
lnostdal has quit [Ping timeout: 245 seconds]
<oni-on-ion> japan for sure, im always coming across CL stuff in japanese (i can read) and of course reddit.com/r/lisp_ja
<beach> pillton: Anyway, that's all the news *I* can think of right now. I am sure there is more that I am not following that closely, or that I forgot about.
<beach> pillton: Oh, I don't know whether you know him, but Jim Newton is defending his PhD in Paris on November 20th. It's all about Common Lisp, and I am on the committee.
<beach> I think he is active on comp.lang.lisp, but not here for some reason.
<pillton> I know the name.
<pillton> Thanks for the update.
<beach> Sure. Don't work too hard.
<beach> Dayjobs take a lot of time and energy from more important tasks.
<pillton> Congratulations on the technical progress and community.
<beach> Thanks.
arescorpio has quit [Read error: No route to host]
ealfonso has quit [Ping timeout: 252 seconds]
<loke> pillton: I would love an AL syposium
<loke> pillton: Beach already said he'll come
lnostdal has joined #lisp
<no-defun-allowed> come to think of it, i don't think you've stuck around to witness the trams at their finest, beach
<no-defun-allowed> if you're lucky the trams will stop and you'll have to wait two hours for one, hah
<beach> Maybe. But I love the restaurant tram that runs all across the city.
<no-defun-allowed> i've never been on it
<beach> Oh, you should.
<loke> no-defun-allowed: in what city is this tram?
<beach> loke: Melbourne.
<loke> I see. I've never been there.
<beach> Very nice place.
<no-defun-allowed> melbourne. there's a lot of trams.
<loke> An asia lisp symposium should be in Singapore obbviously.
Kundry_Wag has joined #lisp
<loke> In AU, Perth is goodtoo (becasue it's reasonably close :-) )
<loke> Because the boodness of the loication is inversely proportional to the travel distance from me.
<loke> goodness
Bike has quit [Quit: Lost terminal]
Kundry_Wag has quit [Ping timeout: 252 seconds]
sjl has joined #lisp
arescorpio has joined #lisp
stereosphere has quit [Ping timeout: 252 seconds]
robotoad has joined #lisp
<oni-on-ion> someone was asking recently, if there is documentation tools for CL, but got the answer no? there is CCLDoc that works on SBCL
wglb has quit [Ping timeout: 250 seconds]
<beach> It depends on what is meant by a "documentation tool".
Kundry_Wag has joined #lisp
<LdBeth> There’s a lot that even one can be picky about philosophy of documenting
<beach> Indeed.
<jasom> oni-on-ion: there are a lot; sabra is working on a new review of one
<jasom> s/one/several
<oni-on-ion> i think someone was asking if there is a way to collect docstrings of a CL package
<oni-on-ion> ahh =)
Kundry_Wag has quit [Ping timeout: 245 seconds]
<beach> oni-on-ion: That is one of the worst definitions of "documentation tool" that I can think of.
<loke> oni-on-ion: There is.
robotoad has quit [Ping timeout: 268 seconds]
<oni-on-ion> beach: i am sorry?
<LdBeth> I think there’s also one in CMU AI repo
amberglint has quit [Quit: Leaving]
<beach> oni-on-ion: Collecting docstrings and turning them into something called "documentation" very frequently results in crapppy such "documentation".
Kundry_Wag has joined #lisp
<oni-on-ion> beach: you could have said that directly? i did not mean to suggest a definition for "documentation tool"
<beach> OK.
<oni-on-ion> the question he asked i cannot recall correctly. will try to search it
<Elronnd> is there any way to pass my lexical scope into a function, without making it into a macro?
<beach> Elronnd: No, and for good reasons.
<oni-on-ion> ahh too much work.. "Binary file irc.freenode.#lispcafe.weechatlog matches. EOF"
<Elronnd> which ones?
<beach> Elronnd: If that were possible, Common Lisp would be a "slow language" in that it would be impossible to write an optimizing compiler for it.
<beach> Elronnd: And then you might as well use Python or something like that.
eminhi has joined #lisp
<Elronnd> ermm why?
<Elronnd> I don't want to use lisp because it's fast
<oni-on-ion> is he asking about closures ?
<beach> Elronnd: Sorry to hear that.
<beach>
jadedctrl has quit [Remote host closed the connection]
<Elronnd> oni-on-ion: not exactly
<beach> Elronnd: Because that's what the creators of Common Lisp wanted.
<beach> Elronnd: You might want a different Lisp dialect then.
Kundry_Wag has quit [Ping timeout: 250 seconds]
<aeth> Elronnd: What are you trying to do?
<oni-on-ion> i am not sure what the point of saying "No" or "Impossible", especially with CL? of course people writing compilers and languages *in* CL that *do* have such a feature. ?!
<Elronnd> perhaps I ought to explain my problem specifically
<oni-on-ion> you can just make it possible!
ggole has joined #lisp
<LdBeth> Lisp Machine Lisp probably support that via Flavor
<Elronnd> I'm making an html templating thingy, and one of the features I added is variable interpolation so I can say '(span (@ *myvar*)). However that only works if *myvar* is global
<Elronnd> oni-on-ion: I'm not that good at lisp yet though :<
<oni-on-ion> neither
<oni-on-ion> Elronnd: check out ParenScript, ive used it a bunch, it does some of those things.
<Elronnd> I don't want to run on a js runtime though
<russellw> That sounds like an unhygienic macro would do the job? Transform the expression into something involving the local variable names and let the compiler take it from there?
<oni-on-ion> i am not suggesting to use parenscript, but to check it out. notice the difference. it has its own "environment handling" suchness
Kundry_Wag has joined #lisp
<Elronnd> russellw: I would have to make the macro construct a bunch of conses and appends, and I'm not 100% sure how to do it
<oni-on-ion> and is similar enough in context of web i figured it would be relatable. trying to help +)
<Elronnd> oni-on-ion: ok
<Elronnd> (I'm not actually a webdev, will have little javascript, if any)
<aeth> Elronnd: What you should probably do is have your macro ultimately build up this: (lambda (my-var) (format stream "<html>....%A ...</html>" my-var))
<aeth> Elronnd: So build a format string, and put %A or similar things where you want to have the substitution to happen
<Elronnd> ahhh that's a good idea
<Elronnd> much better than my current design
<aeth> Then run the format string through format, optionally wrapping it in a lambda so you have an object
<oni-on-ion> Elronnd: nothing to do with JS itself. but good looking out?
<beach> Elronnd: Suppose I could do something like this: (let ((x (+ a b))) (f x) (sin x)) and this (defun f (x) <modify x>). Then the compiler could not use type inference to determine that X is a number when SIN is called. Then SIN would have to check that it really is a number.
<aeth> Elronnd: I recommend with-output-to-string rather than concatenating a bunch of strings directly. Then you can basically just print into that string to built up your format string
<beach> Elronnd: The creators of Common Lisp wanted to avoid such flexibility so that it would be possible to optimize this code at compile time.
<Elronnd> aeth: problem with that is, it's unclear that the web lib I'm using allows for that. I think it wants me to just return a string
Kundry_Wag has quit [Ping timeout: 252 seconds]
<Elronnd> I can look if it gives me a stream but I doubt it
<Elronnd> beach: I meant it more as a special form, not the default way of calling functions. So if instead of (f x) I said [f x], then f would get to modify my copy of x, but if I just say (f x) then it works as it already does
<aeth> Elronnd: something like this: (funcall (lambda (user) (format t (with-output-to-string (output) (write-line "<html>" output) (write-line "<body>" output) (write-line "Hello, ~A!" output) (write-line "</body>" output) (write-line "</html>" output)) user)) "world")
Kundry_Wag has joined #lisp
<aeth> Elronnd: You can just replace t with an arbitrary stream, or nil if you want a string, or you could get rid of the outer formatted output entirely and just directly interpolate the variables in pieces of it if you wanted to optimize it.
<aeth> e.g. (funcall (lambda (user) (with-output-to-string (output) (write-line "<html>" output) (write-line "<body>" output) (format output "Hello, ~A!" user) (write-line "</body>" output) (write-line "</html>" output))) "world")
<aeth> (The funcall lambda thing might sound weird, but your macro is generating just up to the lambda part... alternatively, a defun if you want it named)
<oni-on-ion> Elronnd: tried cl-who ?
<Elronnd> that seems more difficult to construct again. I had been using the call stack to generate closing tags, so (to simplify it) (format nil "<~A>~A</~A>" tag (parse-childs) tag)
<aeth> Elronnd: Your macro could generate one pair at a time, recursively (with a helper function). Of course, this isn't Scheme so even tail recursion might blow the stack, but it probably won't for something this small.
<Elronnd> oni-on-ion: I haven't, might just use that. Form is a bit different than I'd like, but eh
<aeth> Elronnd: You don't have to balance anything complicated because you're using streams with this approach, so you just need to make sure that the macros generate the calls to the stream writing functions so that they get called at the right time.
Kundry_Wag has quit [Ping timeout: 245 seconds]
Sauvin has joined #lisp
<aeth> Actually, the latter approach with the inner format probably wouldn't work as well as the earlier outer format one I posted, because you can make the entire format string at compile time.
<Elronnd> wait, why can tail recursion blow the stack? Doesn't it mean that any additional tail calls consume no stack?
<aeth> Elronnd: Tail recursion isn't guaranteed to be optimized in CL, unlike in Scheme. It could be, but it probably not at (optimize (debug 3))
arescorpio has quit [Quit: Leaving.]
<Inline> stack grows while tail recursion
<Inline> if you optimize the tail the stack remains constant
<Inline> almost constant
<Inline> it grows still but not to the extent of blowing it
<oni-on-ion> constant or growing
<aeth> Anyway, what I would do is generate this format string at compile time in a macro (note that if you don't use format you can use ~A and if you do you have to escape it with ~~A): (with-output-to-string (output) (write-line "<html>" output) (write-line "<body>" output) (write-line "Hello, ~A!" output) (write-line "</body>" output) (write-line "</html>" output))
<oni-on-ion> change and stay the same.. ?
<loke> Are you looking for the function FORMATTER?
<aeth> If you generate each pair at the same time and then work on the middle, you can keep the tags balanced
<Inline> only to the extent of adding to it for new stuff (all the stuff that has to be pushed there anyway), not for pushing the same stuff over and over
<aeth> loke: That simplies it very slightly
<oni-on-ion> ah
<aeth> loke: the lambda and the format can be replaced with formatter
<Inline> instead of pushing the same stuff over and over it reserves only one stack entry and reuses that over and over
<loke> aeth: I've never actually used FORMATTER in rea code. :-)
<Inline> that's what the tail optimization does
robotoad has joined #lisp
<jasom> oni-on-ion: tail calls reuse the stack frame; for the specific case of a self-call that means zero extra space; it might use *less* space if the tail call is to a function with a smaller stack frame.
<Inline> jep
<aeth> loke: looks like this is finally a use for formatter, since the pattern to generate with the macro is (lambda (...) (format ...))
ealfonso has joined #lisp
<aeth> Seems like a trivial thing to have a shortcut built into the language for, though
<Inline> so the frame size may change but it will be only 1 frame reused over and over
cyberlard has quit [Ping timeout: 268 seconds]
<oni-on-ion> jasom: ah, right ^_^ was a bit confused where it was said to grow and also stay the same.
razzy has quit [Ping timeout: 252 seconds]
<ealfonso> I asked this ealier but I was disconnected. Is it a bad idea to have export declarations per-file via the export function, as opposed to within a defpackage form? I heard something was being deprecated?
<Inline> and the frame size change may be due to the recursion step doing two different branches tail wise
<loke> ealfonso: In such cases, I'd recommend you put the DEFPACKAGE form in the head of the file, and include an :EXPORTS section in the DEFPACKAGE.
shifty has joined #lisp
<oni-on-ion> CL and deprecation... ok now im confused by more oxymoron!
<aeth> Elronnd: So your macro could look something like this: (defmacro generate-the-html (...) `(formatter ,(with-output-to-string (output) ...)))
<aeth> Then you just need to write to the stream in the right order, doing what you can at macro time and saving the rest for the format string
<jasom> ealfonso: not being in the defpackage may cause issues if you have to recompile the defpackage form.
<Inline> one branch may need more variables than the other hence more stack frame size
<ealfonso> loke my problem is that the package consissts several files.
<loke> Having it in defpackage is also useful when using SLIME, as it can manage it automatically for you.
<ealfonso> jasom yes, I think this is what I am finding. I will just put everything in defpackage
<loke> ealfonso: Then I suggest you put it in a separate files (most systems seems to use package.lisp)
<Inline> so now that that is clarified what is a heap ?
<loke> ealfonso: But keep the exports in the defpackage, as otherwise SLIEM will get confused, and recompiling will cause problems, sometimes.
<ealfonso> loke yeah. ok, thanks
<Inline> is it the ram, a portion of my disk a portion of my swapfile/swappartition ?
<loke> Inline: you have to separate what CL says, vs. what implementations do. The CL spec never discusses the concept of the heap.
<Inline> ok
<loke> Inline: A CL implementation is free to implement the spec in any way they want, as long as it does what the spec says.
razzy has joined #lisp
<aeth> An example of an extreme platform: https://github.com/jscl-project/jscl/
<aeth> Perhaps a better link: https://jscl-project.github.io/
<aeth> (far from complete conformance to the spec, though)
<jasom> Inline: for a typical C implementation automatic storage means stack, and malloc() means heap.
<jasom> but the C standard doesn't mention stack or heap either, so that's still just implementations
<oni-on-ion> the map is not the territory
<Elronnd> what about the mmap()?
<oni-on-ion> ehe ^_^
<aeth> The CL standard mentions the stack, in dynamic-extent. http://www.lispworks.com/documentation/HyperSpec/Body/d_dynami.htm
<jasom> aeth: that's in an example, which is non-normative
<aeth> no mention of "heap" at all, though
<aeth> At least, not one that !l1sp found
<jasom> aeth: there is mention of heap in the stack allocate entry glossary
<aeth> no glossary entry
<aeth> It is mentioned both in stack allocate and dynamic-extent a bit, though.
<jasom> in general stack is increment pointer to allocate, decrement pointer to free, and heap the allocation and free need not happen in any specific order.
<Elronnd> doesn't the stack generally go downwards on x86
<Elronnd> s/go/grow
<Inline> depends how you wanna write it
<Inline> i suppose it goes with convention
<Elronnd> there are push and pop commands in the isa
<Inline> little endian we say stack grows downwards i suppose
<aeth> is this x86 or in general?
<jasom> Inline: endian has nothing to do with it; it's a question of whether you increment to allocate or decrement to allocate
<Inline> ok
cyberlard has joined #lisp
<jasom> the ABI defines things like whether stack grows up or down and how parameters are passed. Certain ISAs lend themselves to stack growing up or down because they have e.g. a "call" instruction or push/pop instructions.
frodef has joined #lisp
<russellw> I'm trying to send all console output to log file, using a broadcast stream. This mostly works. *standard-output* gets stuff I print myself, *trace-output* gets output of TIME, *error-output* gets most error messages. But when SBCL runs out of memory, it prints a table of garbage collection info that does not get captured. How can I capture that?
makomo has joined #lisp
<jasom> russellw: that almost certainly goes directly to a file descriptor via a system call.
<russellw> jasom, so what I've got is as good as it gets?
Lycurgus has joined #lisp
<Inline> no
<Inline> broadcast stream + synonym stream
<russellw> Inline, what do you mean?
<russellw> jasom, that is the page I was looking at, I've covered every output stream. What am I missing? Do I also need to somehow cover the bidirectional ones?
<jasom> oh, I missed that you had trace-output in there, yeah. that's probably good enough
<Inline> try query-io too
<jackdaniel> russellw: did you consider using log4cl? it has a concept of appenders and log levels
<jackdaniel> it is loosely inspired by log4j (abstraction-wise)
<russellw> jackdaniel, not necessary, thank you, I already have the log running fine. The issue is how to make all the system code output to my log
<russellw> Inline, to my pleasant surprise, assigning an output stream to query-io and debug-io, works – it does not crash the program or anything. But unfortunately it does not capture the GC error output
<oni-on-ion> .j
igemnace has quit [Read error: Connection reset by peer]
Kundry_Wag has joined #lisp
<Inline> arright
<Inline> it's not supposed to pipe that to anything
<jasom> russellw: the GC error output is almost certainly not written in lisp and probably uses file streams
<Inline> other than a gc-logfile
<jasom> "C style file streams rather"
<russellw> a pity, but okay, thanks
<Inline> (defun gc-logfile () "Return the pathname used to log garbage collections. Can be SETF.
<Inline> designated file is opened before and after each collection, and generation statistics are appended to it."....
<Inline> Default is NIL, meaning collections are not logged. If non-null, the
<Inline> that might be worth a try
<russellw> Inline, ah, that might be of some use in its own right, thanks
<jasom> Inline: I wonder what the performance overhead is of that.
eminhi_ has joined #lisp
<Inline> and there's *after-gc-hooks* variable
Kundry_Wag has quit [Ping timeout: 246 seconds]
makomo has quit [Ping timeout: 268 seconds]
<Inline> (!defvar *after-gc-hooks* nil "Called after each garbage collection, except for garbage collections
<Inline> triggered during thread exits. In a multithreaded environment these hooks may run in any thread.")
<Inline> not sure that will do what you want tho
<Inline> you may set that to a lambda which pipes stuff to desired stream maybe
<Inline> but like it saiz it might fail with thread exits and not get called at all
eminhi has quit [Ping timeout: 268 seconds]
<Inline> and it might get called more than once....
<Inline> i suppose that could get problematic too
igemnace has joined #lisp
<Inline> just try, if it does not work you'll know for sure
<Inline> otherwise the log-file approach should work fine
razzy has quit [Ping timeout: 252 seconds]
ealfonso has quit [Disconnected by services]
meepdeew has joined #lisp
doesthiswork has quit [Ping timeout: 246 seconds]
Kundry_Wag has joined #lisp
another-user has joined #lisp
<another-user> hi
<another-user> i tried to use this reader macro https://gist.github.com/rmoritz/1044553/b2d2d8e4b933cb0f6c3fb5ff3f9bcfae6be7ce47 and it works in sbcl repl
<another-user> but when i try to run it in slime it just hangs
<another-user> (speaking about hash-table reader macro)
python476 has joined #lisp
shrdlu68 has joined #lisp
JohnMS_WORK has joined #lisp
Kundry_Wag has quit [Ping timeout: 272 seconds]
ryan_vw has joined #lisp
vlatkoB has joined #lisp
nanozz has joined #lisp
scymtym has quit [Ping timeout: 244 seconds]
Kundry_Wag has joined #lisp
_whitelogger has joined #lisp
Kundry_Wag has joined #lisp
ryan_vw has quit [Ping timeout: 252 seconds]
Kundry_Wag has quit [Ping timeout: 272 seconds]
fckit has joined #lisp
nanozz has quit [Ping timeout: 260 seconds]
elderK has joined #lisp
Kundry_Wag has joined #lisp
<LdBeth> just wrap it into something like (list {'a 12})
<LdBeth> And these reader macros are not idiomatic, bacause (quote [1 2 3]) is supposed to return #(1 2 3)
Lycurgus has quit [Quit: Exeunt]
Kundry_Wag has quit [Ping timeout: 272 seconds]
Lord_of_Life has quit [Ping timeout: 276 seconds]
<shka_> good morning
<no-defun-allowed> morning
<LdBeth> good night
<shka_> LdBeth: sweet dreams!
<LdBeth> go to sleep
<no-defun-allowed> sleep tight
<LdBeth> thanks, have a nice day people
<no-defun-allowed> <3
heisig has joined #lisp
angavrilov has joined #lisp
wanz has joined #lisp
scymtym has joined #lisp
mange has quit [Remote host closed the connection]
varjag has joined #lisp
scottj has quit [Quit: leaving]
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 252 seconds]
meepdeew has quit [Remote host closed the connection]
sjl has quit [Ping timeout: 272 seconds]
dale has quit [Quit: dale]
<another-user> hm, is it possible to use without wrapping it in /something/?
<oni-on-ion> thats why reader (character) macros
<another-user> oni-on-ion: sorry, could you please elaborate?
<shka_> another-user: consider #'first
<shka_> or #p"/home/another-user/"
<shka_> ever wondered why #' and #p or how you can add your own?
wanz has quit [Remote host closed the connection]
igemnace has quit [Quit: WeeChat 2.2]
igemnace has joined #lisp
kristof has joined #lisp
<another-user> shka_: do you mean instead of {} macro i should create #{} kind of macro? but how?
<shka_> another-user: well, it is an option
<shka_> but the question is, what you are trying to achieve?
hhdave has joined #lisp
<another-user> shka_: i need this https://gist.github.com/rmoritz/1044553/b2d2d8e4b933cb0f6c3fb5ff3f9bcfae6be7ce47 to work in slime repl
Kundry_Wag has joined #lisp
<jdz> another-user: you have to put those into the readtable that is used in the REPL.
<shka_> ok
hhdave_ has joined #lisp
<kristof> this is so minor but those lambdas don't have to be indented so far; only two spaces after set-macro-character
<kristof> Also, and this is my limited experience, but I've never really wanted hash literals. Hash tables have advantages for multitudinous collections
<another-user> jdz: how can i do this?
<jdz> Also, pretty sure READ-DELIMITED-LIST can be used instead of creating new readtables on every invocation.
<kristof> But for small collections, which is what I'd what literals for, plists outperform the hashing overhead, usually
<kristof> *want
<jdz> another-user: you provide the last value to SET-MACRO-CHARACTER.
hhdave has quit [Ping timeout: 252 seconds]
hhdave_ is now known as hhdave
Kundry_Wag has quit [Ping timeout: 268 seconds]
<another-user> jdz: oh, i see, thank you!
<jdz> another-user: if the calls to SET-MACRO-CHARACTER are done in the REPL then they should be working.
eminhi_ has quit [Ping timeout: 244 seconds]
eminhi has joined #lisp
lnostdal_ has joined #lisp
Kundry_Wag has joined #lisp
lnostdal has quit [Quit: https://www.Quanto.ga/]
Kundry_Wag has quit [Ping timeout: 245 seconds]
<jdz> another-user: I re-wrote the square bracket reader: https://gist.github.com/jdz/89b93653da3c3fe965a904b67cec5e43
Ober has left #lisp ["ERC (IRC client for Emacs 26.1)"]
<jdz> The other one can be re-written similarly.
lnostdal_ has quit [Read error: Connection reset by peer]
lnostdal_ has joined #lisp
python476 has quit [Ping timeout: 252 seconds]
eminhi_ has joined #lisp
<another-user> jdz: this is so much cleaner! thanks a lot for the example!
eminhi has quit [Ping timeout: 252 seconds]
lnostdal_ has quit [Ping timeout: 252 seconds]
cylb has joined #lisp
cylb has quit [Ping timeout: 252 seconds]
quipa has joined #lisp
Kundry_Wag has joined #lisp
aindilis has quit [Remote host closed the connection]
patrixl has quit [Remote host closed the connection]
fikka has joined #lisp
Kundry_Wag has quit [Ping timeout: 250 seconds]
jcowan has quit [Quit: Connection closed for inactivity]
asymptotically has joined #lisp
kristof has quit [Ping timeout: 244 seconds]
ravndal has joined #lisp
fikka has quit [Ping timeout: 252 seconds]
aindilis has joined #lisp
eminhi_ has quit [Ping timeout: 252 seconds]
Kundry_Wag has joined #lisp
fikka has joined #lisp
xificurC has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
Kundry_Wag has quit [Ping timeout: 246 seconds]
fikka has quit [Ping timeout: 250 seconds]
robotoad has quit [Quit: robotoad]
Kundry_Wag has joined #lisp
<svillemot> Myon: I've investigated your pgloader issue, and the problem comes from cl-ironclad which is out-of-date in Debian
<svillemot> I'll take care of it
<Myon> svillemot: oh cool, thanks
<dim> svillemot: I've been told (here) that the compile time difficulties are also solved with the most recent version of SBCL
<svillemot> Debian (unstable) actually has the latest SBCL (1.4.12)
<dim> that's good!
Kundry_Wag has quit [Ping timeout: 245 seconds]
<dim> but then does it Just Work™ with that?
<svillemot> actually it's *because* SBCL is recent that we have problems with nibbles and now ironclad, because those project use SBCL internals, and needs updating
another-user has quit [Ping timeout: 276 seconds]
<dim> while you're around, would it be a good idea that I spend time trying alternatives to cl+ssl/openssl for pgloader, maybe using bearssl or wolfssl or some other lib that would make our life easier?
<dim> svillemot: oh. I see. Sorry about that.
<svillemot> the cl+ssl situation is now ok on the Debian side, but only because I patched it for OpenSSL 1.1
<svillemot> diverging from upstream is not ideal, so if there are other projects which have native support for OpenSSL 1.1, that could be interesting
<dim> my limited understanding of the problems is that openssl itself plays tricks with the way it exports symbols, other ssl libs might be clean on that aspect
fikka has joined #lisp
<dim> https://www.cliki.net/cryptography lists only cl+ssl for openssl
<svillemot> oh you're talking about using another SSL lib
<dim> it's an idea that crossed my mind, I'm trying to decide if it's worthwile to even try
<svillemot> wolfssl seems promising and is packaged; that does not seem to be the case for bearssl
<dim> otherwise there's always https://github.com/shrdlu68/cl-tls/ but well I'm worried about using non well tested implementations of should-be-secure stuff
<svillemot> the strong case for openssl is precisely that it's widespread and well-tested
<dim> +1
orivej has joined #lisp
fikka has quit [Ping timeout: 276 seconds]
<svillemot> (even though it suffered heartbleed)
fikka has joined #lisp
<svillemot> there is also mbedtls
<dim> I can find https://github.com/mak08/PolarCL which depends on cl-mbedtls... but for now I can't that that system
runejuhl has quit [Ping timeout: 250 seconds]
<dim> ahah was easier than I though
esrse has quit [Ping timeout: 245 seconds]
<dim> doesn't seem too mature though
Kundry_Wag has joined #lisp
themsay has joined #lisp
fckit has quit [Ping timeout: 276 seconds]
Kundry_Wag has quit [Ping timeout: 245 seconds]
fikka has quit [Ping timeout: 244 seconds]
fikka has joined #lisp
fikka has quit [Ping timeout: 268 seconds]
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 268 seconds]
lonjil has quit [Ping timeout: 252 seconds]
zfree has joined #lisp
themsay has quit [Ping timeout: 272 seconds]
themsay has joined #lisp
quazimodo has quit [Ping timeout: 268 seconds]
themsay has quit [Ping timeout: 244 seconds]
quazimodo has joined #lisp
lonjil has joined #lisp
Kundry_Wag has joined #lisp
flamebeard has joined #lisp
Kundry_Wag has quit [Ping timeout: 245 seconds]
<Xach> I wish all implementations provided and maintained good ways to make secure connections on every platform they support.
crsc has quit [Quit: leaving]
<loke> Xach: Do any of them?
<Shinmera> LW does, if I remember correctly
<Xach> loke: at least lispworks
jcowan has joined #lisp
<jcowan> Proper tail recursion does not require constant stack, only asymptotically constant stack.
Kundry_Wag has joined #lisp
<jcowan> Specifically, the implementation must support an unbounded number of active tail calls. How it does that, as always, can vary.
<jcowan> Reusing the caller's stack frame is not always TRT.
<beach> What are some of the other options?
<beach> ... assuming you mean not only tail RECURSION but more generally tail CALL MERGING.
<ggole> Heap allocated frames.
<beach> ggole: Can you elaborate? I mean, if they are not reused, the heap will be exhausted rather than the stack.
Kundry_Wag has quit [Ping timeout: 246 seconds]
<ggole> Tail calls leave the originating frame dead, so the GC will remove it.
<beach> Ah, OK.
<beach> That works.
<ggole> Several implementations actually do that (in various ways), too
<beach> It could be a good solution, especially if you need CALL/CC anyway.
<ggole> The motivation is to make call/cc cheap
<ggole> Right
<ggole> Implementing call/cc becomes quite trivial.
<beach> Indeed.
cylb has joined #lisp
rumbler31 has joined #lisp
Cymew has quit [Remote host closed the connection]
Cymew has joined #lisp
rumbler31 has quit [Ping timeout: 245 seconds]
varjag has quit [Quit: ERC (IRC client for Emacs 26.1)]
quipa has quit [Remote host closed the connection]
<jcowan> essentially uses the C stack as the nursery and resets it when it gets too big
<jcowan> several Schemes use this approach, most notably Chicken
<beach> Thanks!
elfmacs has joined #lisp
rocx has quit [Remote host closed the connection]
random-nick has joined #lisp
anewuser has joined #lisp
arbv has quit [Ping timeout: 264 seconds]
arbv has joined #lisp
elfmacs has quit [Read error: Connection reset by peer]
varjag has joined #lisp
elfmacs has joined #lisp
elfmacs has quit [Remote host closed the connection]
elfmacs has joined #lisp
Bike has joined #lisp
themsay has joined #lisp
jmercouris has joined #lisp
<jmercouris> let's say I have path like #P"/Users/username/file.txt", how can I get "file.txt"?
<jmercouris> I was thinking of uiop:unix-namestring and then doing some string parsing, but I figured there must be a better way
<Shinmera> clhs file-namestring
<jmercouris> Shinmera: thanks
<jmercouris> that's exactly what I needed
arbv has quit [Quit: ZNC - https://znc.in]
arbv has joined #lisp
jkordani_ has joined #lisp
Kundry_Wag has joined #lisp
jkordani has quit [Ping timeout: 252 seconds]
Kundry_Wag has quit [Ping timeout: 252 seconds]
warweasle has joined #lisp
nokdoott has joined #lisp
cylb has quit [Remote host closed the connection]
cylb has joined #lisp
runejuhl has joined #lisp
nokdoot has quit [Ping timeout: 252 seconds]
Kundry_Wag has joined #lisp
arbv has quit [Ping timeout: 264 seconds]
Lord_of_Life has joined #lisp
Kundry_Wag has quit [Ping timeout: 252 seconds]
varjag has quit [Ping timeout: 252 seconds]
Inline has quit [Read error: Connection reset by peer]
mathrick_ has quit [Ping timeout: 276 seconds]
heisig has quit [Quit: Leaving]
rippa has joined #lisp
anewuser has quit [Ping timeout: 244 seconds]
Kundry_Wag has joined #lisp
anewuser has joined #lisp
Kundry_Wag has quit [Ping timeout: 252 seconds]
rumbler31 has joined #lisp
jack_rabbit has quit [Ping timeout: 252 seconds]
beach has quit [Disconnected by services]
beach has joined #lisp
rumbler31 has quit [Ping timeout: 246 seconds]
elfmacs has quit [Ping timeout: 276 seconds]
JohnMS has joined #lisp
Lycurgus has joined #lisp
fckit has joined #lisp
JohnMS_WORK has quit [Ping timeout: 246 seconds]
cylb has quit [Remote host closed the connection]
cylb has joined #lisp
iAmDecim has joined #lisp
lagagain has quit [Quit: Connection closed for inactivity]
Inline has joined #lisp
scymtym has quit [Ping timeout: 276 seconds]
Lycurgus has quit [Ping timeout: 250 seconds]
jinkies has joined #lisp
iAmDecim has quit [Ping timeout: 250 seconds]
JohnMS has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
nly has quit [Read error: Connection reset by peer]
nly has joined #lisp
<jmercouris> how do you guys decide when to use flet or when to make a separate defun?
<jmercouris> I think an obvious starting point might be "is this function used anywhere else"?
<jmercouris> but what other criteria might make you lean towards an flet vs a separate defun
robotoad has joined #lisp
<antoszka> I don't think I've ever gave it anymore attention than what you've already said. It's this and *maybe* sometimes I'd split a function out for better readability.
<Bike> indentation
flamebeard has quit []
<shka_> jmercouris: function that uses context of parent function
<pfdietz> The flet is useful when you want to use surrounding lexical variables.
<antoszka> Oh yeah, that's obviously another thing. ;)
<jmercouris> shka_: function that uses context of parent function? like a closure?
<shka_> aha
<pfdietz> Otherwise, I tend not to, since they get in the way of tracing.
<jmercouris> so you can use flet to return a function that has the contxt of a parent function, like some sort of closure factory?
<jmercouris> interesting idea
<pfdietz> Yes, function values (lambdas, too) can cause the context to be preserved, even after the parent function returns.
<pfdietz> (defun complement (fn) (lambda (&rest args) (not (apply fn args))))
fikka has joined #lisp
<jmercouris> I can't imagine when I'll ever do that
<jmercouris> but, maybe a time will come
<jmercouris> I guess a procedural programmer never imagines why they'll ever need objects
<jmercouris> I need to integrate these concepts more deeply into my mindset
fikka has quit [Ping timeout: 252 seconds]
shka_ has quit [Quit: WeeChat 1.9.1]
igemnace has quit [Quit: WeeChat 2.2]
<jcowan> A simple case. There are many functions in CL that take functional arguments, the most ordinary case being map, which passes the elements of a sequence through a function in order to form a sequence of the results.
robotoad has quit [Quit: robotoad]
<jcowan> It's not uncommon for the function you pass to involve some of the local context of the call, as in (map 'list (lambda (x) (eq? x y)) some-list)
<jcowan> where y is a variable defined in the surrounding function
<jcowan> jmercouris: Are you clear so far?
<jcowan> This will return a list of booleans indicating whether each member of some-list is the same object as whatever y may be.
<Shinmera> Is there a standard way of determining whether a float is negative? (keep in mind the case of -0.0)
<ggole> signum?
<pfdietz> Do you consider -0.0 to be negative?
<Shinmera> signum returns 0 for zeroes
<Shinmera> pfdietz: in this case yes
dddddd has joined #lisp
<pfdietz> (let ((x -0.0)) (and (<= x 0.0) (not (eql x 0.0)))) ==> T if -0.0 and 0.0 are "different"
<ggole> Oh, hmm
<Shinmera> ahh, a case where eql is different from =
<Shinmera> interesting corner case
<Shinmera> The spec mentions this explicitly even: If an implementation supports positive and negative zeros as distinct values, then (eql 0.0 -0.0) returns false. Otherwise, when the syntax -0.0 is read it is interpreted as the value 0.0, and so (eql 0.0 -0.0) returns true.
<jcowan> Another approach is to rely on the fact that (sqrt -1+0i) is i, whereas (sqrt -1-0i is -i)
<Shinmera> jcowan: yeesh
<ggole> Ah, I was thinking of copysign
<ggole> ...which I don't think CL has
jochens has joined #lisp
<Shinmera> it does have float-sign
<pfdietz> clhs float-sign
<Shinmera> which I only remembered now for some reason
<ggole> Oh, it's copysign with a different name
<jcowan> A less heavyweight approach is to take 3/x where x is 0.0 or -0.0, which will produce +inf.0 and -inf.0 respectively
* ggole files that one away
<Shinmera> jcowan: On many implementations that'll trigger float traps
<jcowan> but yes, in practice float-sign is clearly TRT
<jcowan> True
v0|d has quit [Remote host closed the connection]
<jcowan> The spec allows (/ 3.0 0.0) to return +inf.0 (or however you want to spell it) rather than an exception
LiamH has joined #lisp
fikka has joined #lisp
nowhere_man has quit [Ping timeout: 252 seconds]
fikka has quit [Ping timeout: 260 seconds]
shrdlu68 has quit [Ping timeout: 245 seconds]
Selwyn has joined #lisp
shka_ has joined #lisp
robotoad has joined #lisp
jruchti has quit [Quit: jruchti]
moei has joined #lisp
wg1024 has joined #lisp
FreeBirdLjj has joined #lisp
Selwyn has quit [Ping timeout: 260 seconds]
jruchti has joined #lisp
anewuser has quit [Quit: anewuser]
rumbler31 has joined #lisp
FreeBirdLjj has quit [Ping timeout: 252 seconds]
<jmercouris> jcowan: yes, I am clear, sorry I was AFFK
rumbler31 has quit [Ping timeout: 252 seconds]
jochens has quit [Remote host closed the connection]
lumm has joined #lisp
jmercouris has quit [Ping timeout: 264 seconds]
sjl has joined #lisp
scymtym has joined #lisp
<LdBeth> Good morning
asarch has joined #lisp
robotoad has quit [Read error: Connection reset by peer]
<beach> Hello LdBeth.
robotoad has joined #lisp
hhdave has quit [Ping timeout: 245 seconds]
beach has quit [Read error: Connection reset by peer]
beach has joined #lisp
Lycurgus has joined #lisp
meepdeew has joined #lisp
wg1024 has quit [Quit: Leaving]
lumm has quit [Quit: lumm]
varjag has joined #lisp
lumm has joined #lisp
papachan has joined #lisp
fikka has joined #lisp
nly has quit [Read error: Connection reset by peer]
cylb has quit [Remote host closed the connection]
cylb has joined #lisp
fikka has quit [Ping timeout: 260 seconds]
nly has joined #lisp
Lord_of_Life has quit [Ping timeout: 252 seconds]
stereosphere has joined #lisp
varjag has quit [Ping timeout: 268 seconds]
orivej has quit [Ping timeout: 246 seconds]
lumm has quit [Remote host closed the connection]
lumm has joined #lisp
vaporatorius has joined #lisp
fckit has quit [Ping timeout: 244 seconds]
pjb has joined #lisp
robotoad_ has joined #lisp
orivej has joined #lisp
robotoad has quit [Ping timeout: 252 seconds]
HighMemoryDaemon has joined #lisp
nowolfer has quit [Ping timeout: 252 seconds]
nowolfer has joined #lisp
DGASAU has joined #lisp
<emaczen> is there a way to (asdf:unload-system ...) ?
<Bike> no. loading lisp code has arbitrary side effects.
fraktor has joined #lisp
makomo has joined #lisp
<HighMemoryDaemon> TIL that the core of Grammarly is written in Lisp. :)
<HighMemoryDaemon> (Common Lisp to be specific)
<fraktor> I'm pretty new to lisp, and I've been trying to learn using SBCL. Is there a (relatively easy) way to make a mostly-portable executable out of lisp code?
<Bike> look at "save-lisp-and-die" in the sbcl manual
<Bike> but this is not the most common way to use lisp
rumbler31 has joined #lisp
papachan has quit [Ping timeout: 252 seconds]
<fraktor> What is the most common way?
<aeth> fraktor: Usually you keep one session running, often in an IDE like in SLIME on top of Emacs. Then you launch everything from that session.
<pfdietz> I don't know, saving images is pretty common for deliverables.
<aeth> Obviously if you're going to e.g. distribute a desktop application then you'd need to build a standalone executable, though.
<HighMemoryDaemon> fraktor: There's also Chicken. It's a Scheme, produces C code, and creates an executable from that. https://call-cc.org/
<pfdietz> These days, things are delivered in docker images. :)
<aeth> Even if you're running a server in production, though, I'd personally assume you'd be running it from the REPL. Standalone executables (afaik) ship the entire implementation so that's for if you don't assume one is already installed.
<aeth> Or if not the REPL then something like sbcl --load at the command line.
rumbler31 has quit [Ping timeout: 252 seconds]
<Bike> pfdietz: guessing at likelihood of delivering something to someone else basedon "I'm pretty new"
crsc has joined #lisp
<fraktor> Bike: On the other hand, that's the consideration that I was looking at.
<fraktor> I would like to be able to distribute programs to other users without making them install sbcl.
Posterdati has quit [Ping timeout: 245 seconds]
<Bike> dumping images is the way to go, then
<Bike> sometimes we get people in here who expect a compile-run cycle like with gcc, and that doesn't work, is all
<pjb> Well, I've got a lisp compiler driver similar to gcc. They could use it.
nly has quit [Quit: Quit]
<fraktor> Bike: That's certainly what I'm used to. I've used REPLs for other languages, but not usually with a running program.
<pfdietz> If you want to deliver a command line program, you will have some lisp function that gets called on program invocation. You can call this function (or one that it calls after argv parsing) when running your program from the REPL, as you would likely be doing during development.
<fraktor> Good to know.
<pjb> Popularisation of Lisp will have to pass thru linux distribution of widely _USED_ lisp software, compiled with a toolset simiar to that of gcc.
<aeth> it would look something like this in SBCL: sbcl --noinform --non-interactive --load foo.lisp --eval "(foo:main)"
<aeth> foo is the package name and must be included, and main is just a convention so people know where to look for a function like this
<pjb> Only once people will notice that several of their unavoidable tools are written in CL, will they start to be interested by and use Common Lisp.
<aeth> I probably should have said foobar.lisp to emphasize that the filename and the package name can be different
HighMemoryDaemon has quit [Remote host closed the connection]
<fraktor> I'm gonna have to get used to this, but it seems like a powerful model. Thanks!
fraktor has quit [Quit: WeeChat 2.2]
frodef has quit [Ping timeout: 244 seconds]
<aeth> pjb: Does your program allow certain implementation-specific flags to be set? e.g. sb-ext:*derive-function-types*
themsay has quit [Ping timeout: 246 seconds]
asymptotically2 has joined #lisp
phoe has quit [Quit: leaving]
asymptotically has quit [Ping timeout: 256 seconds]
<aeth> pjb: Or things like *read-default-float-format*
lnostdal has joined #lisp
Lycurgus has quit [Quit: Exeunt]
<pjb> aeth: I try to avoid writing implementation dependent programs. This driver uses clisp. It would have to be rewritten using portability libraries…
Lord_of_Life has joined #lisp
slyrus1 has joined #lisp
lnostdal has quit [Read error: Connection reset by peer]
<gendl> Hi, is there a way to delete a package nickname without deleting the whole package?
lnostdal has joined #lisp
<Bike> gendl: rename-package can get a list of nicknames as an argument.
<gendl> Bike: got it, thanks!
<Bike> check clhs for more info of course
<cgay> clhs rename-package
fikka has joined #lisp
<jcowan> FWIW, ten Schemes deliver standalone executables, 8 by compiling to C and 2 by clever packaging of their regular runtimes.
<jcowan> And at least one CL has done so in the past
<pjb> jcowan: what CL implementation can't deliver standalone executables?
frodef has joined #lisp
<gendl> pjb: by "standalone" does it have to be a single file?
<pjb> I would assume.
<jcowan> That is what I meant.
<jcowan> no image/runtime separation
<pjb> jcowan: So, what CL implementation can't deliver standalone executables?
<gendl> Allegro of course can deliver executables, but they come with a few files.
<gendl> at least an executable and a .dxl (image) file.
fikka has quit [Ping timeout: 245 seconds]
younder has joined #lisp
<gendl> LispWorks can deliver a "console image" at least as a single file (and probably a full-blown application although I don't have enough experience with LW).
<jcowan> Quoth CLiki page: "Another form of disk image requires a copy of the particular Lisp implementation to be installed on the recipient's machine."
<jcowan> I don't know which implementations require that today, if any.
<pjb> Well, this is FreeNode. We don't know any specifics of Commercial implementations. Only some echoes.
<pjb> jcowan: Ok, but what CL implementation can't deliver standalone executables?
<pjb> jcowan: can you list a single one?
<younder> Lisp is 'just' 32 Mb.. Huge in 1980's tiny today.
<gendl> CCL can dump an image as a single executable with (:prepend-kernel t).
<pjb> younder: bullshit. clisp is 4MB.
<pjb> gendl: of course! Most implementations do.
<younder> pjb, right - clisp is smaller
<pjb> gendl: actually, jcowan is hard pressed finding one that doesn't!
<jcowan> pjb: No, obviously not. I said that at least one could do so in the past, which is true. I was not claiming any superiority of Scheme here, merely offering facts.
<pjb> and honestly, I can't say from the tip of my head, which implementation cannot.
<jcowan> I am not looking for one.
<jcowan> Certainly most Scheme implementations cannot.
<gendl> jcowan: if you're not looking for one, then why are you asking the question?
<pjb> jcowan: you're offering wrong facts. Most implementations can deliver stand alone executables. You would have to spend half an hour researching implementations to find a strange one that cannot.
<fe[nl]ix> jcowan: that sentence doesn't say that the the implementation requires that, but only that the particular form of disk image does
<gendl> that kind of question is what I call an insincere question.
<gendl> asking a question then stepping back and not wanting to know the answer.
<younder> Snap packaging can round all dependencies up in a nicke packet so you are less dependent on that on file problem. (look up SNAP)
<jcowan> (a) My facts are not wrong. (b) I did not ask a question.
<fe[nl]ix> jcowan: in other words, that there are images that are disjoint from the CL runtime that is required to start the image
<younder> s/on/one
<gendl> jcowan: you're right, you didn't. Sorry.
<gendl> jcowan: but statements like "at least one CL has done so in the past" are vague and misleading.
<gendl> I do think this is more of a problem with outdated content cluttering up Cliki than a problem with any actual reality.
<jcowan> I was actually thinking of (A)KCL
* younder dust's himself off.. cough
<jcowan> gendl: I grant that my remark was misleading, as obviously several people have been misled by it.
<cgay> There was at least one person in the past who was misled by it.
<jcowan> Exactly so.
<jcowan> I would be interested to know if there are any implementations today that can generate {C,JavaScript,whatever}.
<jcowan> (That *is* a question.)
<Bike> ecl generates C. think that's about it.
<Bike> oh there's also a jscl, but i think it's incomplete?
<jcowan> Does ABCL generate JVM class files at all?
<shka_> jcowan: not sure about that, but from what i understand it goes directly into bytecode
phoe has joined #lisp
<jcowan> Yes, that's what I would expect. It's on the whole easier to generate bytecode than Java.
<phoe> How do I make postmodern output timestamps as non-integers? I need higher resolution than integers.
<minion> phoe, memo from shka_: czy mógłbyś mi dać znać czy masz jakiś problem z treścią mojego nowego posta? Chcę opublikować w tą sobotę (dopiszę tylko kod demonstrujący)
<phoe> Loading simple-date after loading postmodern doesn't change anything, (postmodern:query "SELECT now();") ;=> ((3748964957))
<jcowan> whereas it is on the whole harder to generate machine code than C, and it is subject to possible obsolescence issues
<shka_> phoe: first of, you have to ensure that correct column type is set up in the postmodern
<shka_> *postgresql
<phoe> shka_: the examples at https://sites.google.com/site/sabraonthehill/postmodern-examples/postmodern-time-functions don't say anything about column types.
<shka_> crap, i left my code at work
<shka_> phoe: this is not postmodern specific thing
<phoe> ...huh, these examples have bitrotten
<shka_> it is postgres thing that is not ultra obvious
<shka_> secondly, i was doing this at work, but i don't have source code at hand
<shka_> phoe: are you sure that this integer is not universal time already?
<phoe> shka_: nope, it changes every second.
<phoe> not every microsecond.
<shka_> milisecond?
<phoe> shka_: postgresql timestamps have microsecond precision
<shka_> ok
<shka_> ok
<shka_> phoe: try localtime instead of simple-date
<shka_> IIRC it handles timestamps correctly (with the right precision and stuff)
<phoe> shka_: loading local-time changes nothing
<shka_> local-time or postmodern-localtime?
<phoe> shka_: no such package, postmodern-localtime
<phoe> s/package/Quicklisp system/
<phoe> same for postmodern-local-time
<shka_> hmmm
<shka_> does local-time adds automaticly handler to postmodern?
<phoe> I have no idea
<shka_> let's check
<shka_> it requires postmodern
<shka_> so i would say: YES
<phoe> I found a system called :cl-postgres+local-time but loading it doesn't change anything
<phoe> shka_: huh? local-time requires postmodern?
<shka_> Requirements: postmodern
<phoe> .....why would a date library require a PostgreSQL connection library
<shka_> to install handler
<phoe> Oh, I see
<phoe> local-time itself doesn't require it
<phoe> it's cl-postgres+local-time
<shka_> ok, this is up to date
<shka_> it does not require postmodern anymore, which makes sense
<phoe> ooh
<phoe> much better now
<shka_> phoe: ok, is loading it makes a difference?
<phoe> (local-time:set-local-time-cl-postgres-readers)
<shka_> ok
<phoe> after calling this, I'm getting local-time objects
<phoe> thanks!
<shka_> great
<shka_> simple-date imho should be eliminated
<shka_> local-time is just much better
razzy has joined #lisp
shifty has quit [Ping timeout: 244 seconds]
shka_ has quit [Ping timeout: 244 seconds]
ggole has quit [Quit: ggole]
warweasle has quit [Quit: rcirc on GNU Emacs 24.4.1]
jkordani_ has quit [Ping timeout: 264 seconds]
<younder> Do any of you have any experience with template Haskell. Is so how do they compare to CL macro's.
<jasom> younder: as most non-lisp metaprogramming there is extra overhead of having to learn a second language, as the AST of haskell is a very different representation than haskell is usually programmed in.
<oni-on-ion> template haskell is a bit messy, it is known for being at least obtuse
<oni-on-ion> i'd say the type system of haskell is much more powerful and closer to macro than TH.
<jcowan> Pure is perhaps an example
<jcowan> of a non-Lisp language that is appropriately <forgot the buzzword>
<jcowan> homoiconic
anamorphic has joined #lisp
<jasom> and most forth members
* jasom did a quick look at pure and isn't convinced it's homoiconic
<oni-on-ion> prolog, julia
<oni-on-ion> prolog i set right next to lisp for macro, not sure about scheme and hygenia, but julia right below it because im still a newbie with it
<jasom> julia, maybe? (1 + 1) is Expr(:call, :+ 1, 1,) which looks pretty different.
<oni-on-ion> : is quote
<oni-on-ion> like '
<oni-on-ion> (1 + 1) is :(1 + 1)
<oni-on-ion> Expr is type constructor, so that would probably look like call()
<oni-on-ion> see Meta.show_sexpr
<jasom> hmm; python lets you manipualte the AST, but I don't know that it makes it homoiconic; we may be getting OT at this point going too-far down the Julia path
<oni-on-ion> although there is one thing, if you have a macro 'john' and want to call it, @john is how. i forget the reasoning behind this but i think it is just syntax sugar. not sure where CL stores its own macros; in the function slot ?
<phoe> macro function slot
<phoe> accessed via #'macro-function
<jasom> In a homoiconic language, the primary representation of programs is also a data structure in a primitive type of the language itself. <-- obviously this doesn't just mean AST, otherwise all self-hosting languagese would be homoiconic (assuming the compiler or interpreter parses to an AST at some point)
lnostdal has quit [Read error: Connection reset by peer]
<oni-on-ion> o_o didnt know that, phoe ! so there are three places? LISP-3 ?=)
pjb has quit [Ping timeout: 252 seconds]
<oni-on-ion> i am really not sure about julia macros. have to play with it more, the manual is too dry
<jasom> oni-on-ion: all lisps can use symbols for many things; lisp-1 v lisp-2 is just a question of if the function-call position is separate from the value
slyrus1 has quit [Quit: slyrus1]
slyrus1 has joined #lisp
<oni-on-ion> jasom: there is also a macro seperate from value now then, no ?
<oni-on-ion> and seperate from func
<jasom> oni-on-ion: not at all
<jasom> (foo bar) <-- foo can be a function or a macro, but not both.
slyrus1 has quit [Client Quit]
<oni-on-ion> oh. then what is macro function slot, seperate than func slot or same ?
slyrus1 has joined #lisp
<jasom> lisp-1 v lisp-2 is a question of (X X) <- does X represent the same thing when this is evaluated.
<oni-on-ion> ah =)
<oni-on-ion> that is the second thing i like about scheme. which julia was written in (chez) but anyhow, homoiconicity to me is extremely important for 'real' macros. and to 'flip the switch' with quote/unquote
meepdeew has quit [Remote host closed the connection]
<anamorphic> Doesn't Common LIsp have more than just function and variable "namespaces"?
meepdeew has joined #lisp
<jasom> and of course if you make a hash table that is keyed with symbols, you've added a new namespace.
<oni-on-ion> anamorphic: packages? several
<oni-on-ion> jasom: and also very important for the ability for anaphoric macros =) as nickname reminds me
<jasom> packages are not named by symbols; slots for objects are though.
<oni-on-ion> what are packages named by ?
<jasom> oni-on-ion: strings
<oni-on-ion> change package, change namespace. wouldnt that count for 'how many namespaces' there are
<oni-on-ion> jasom: oh, really? i've been using :keyword or #:hashkwd
<anamorphic> From page 836 (apparently, I don't have my copy in front of me) of PAIP he says Common Lisp has 7 namespaces
<jasom> oni-on-ion: that's because symbols are string-designators, and defpackage/in-package take string designators
<oni-on-ion> jasom: hm, i was asking if it were true, not necessarily why or how come
<oni-on-ion> i see that symbols can designate though =)
<jasom> clhs package-name
<oni-on-ion> i will use string literals. thanks for the reference though.
<jasom> loop keywords, restarts, go tags, block names &c.
<jasom> oni-on-ion: don't forget that symbols are upcased so you need to do e.g. (in-package "CL-USER")
<oni-on-ion> jasom: ah true! ty =)
<jasom> oni-on-ion: if packages were named as symbols, you might see code written like this https://github.com/jasom/spm-reader/blob/master/spm-example.lisp (I wrote a proof-of-concept reader macro that uses symbols to name packages, with the keyword package being the root namespace)
<oni-on-ion> it did feel akward using symbols there, subconsciousl y
jkordani has joined #lisp
<jasom> note that I alias :yason as :spm-example:json and :json as :spm-exampe:clj
<oni-on-ion> whoa that is trippy, is this file copied twice ? if i page up/down in emacs it looks the same.
<oni-on-ion> oh 4 times...
<jasom> it's not copied twice, 53 lines total.
<oni-on-ion> i see 4 of the same thing, my dyslexia is acting up and im starting to see moire patterns
<jasom> oh, the first line of each are: json:encode, clj:encode-json, :yason:encode, :cl-json:encode-json
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<oni-on-ion> right.... so about those macros..... ^_^
<jasom> which macros?
<oni-on-ion> the ones missing in the code
<oni-on-ion> one*
<jasom> which code?
<oni-on-ion> the... one sec.
* jasom is lost
Bike has quit [Ping timeout: 256 seconds]
<_death> I think he wants a macro to "abstract" the 4 forms.. not realizing it would serve no purpose but obfuscation
lnostdal has joined #lisp
<aeth> oni-on-ion, jasom, etc.: You can't do "FOO-BAR" and be fully portable. If you use literal strings you have to generate them at read time with #.(symbol-name '#:foo-bar) to get "FOO-BAR"
<jasom> aeth: I disagree
<aeth> The reader case is customizable and configurable!
<jasom> aeth: yes it is, but the name of the package cl-user is "CL-USER", ne pas?
<oni-on-ion> here you are jasom. not sure how you are lost. what other code is there?
varjag has joined #lisp
<aeth> jasom: In most implementations, yes. Several proprietary ones? Not necessarily.
<oni-on-ion> _death: would it seriously obfuscicate it for you?
<oni-on-ion> aeth: i think i will be happy with full case string lits
<jasom> aeth: in any conforming implementation
<_death> aeth: someone who changes the readtable case and expects things to work is deluding himself
<jasom> clhs 11.1.2
<aeth> _death: As long as the readtable case doesn't change *multiple* times during the execution of the program #.(symbol-name '#:foo-bar) will work.
<oni-on-ion> now that i would definately obfuscate. who would want to read/type that ?
rumbler31 has joined #lisp
<jasom> aeth: if the readtable case has been changed, then #.(symbol-name '#:cl-user) will not work.
Roy_Fokker has joined #lisp
<aeth> oni-on-ion: I use it everywhere in my code, e.g. if I wanted to prefix foo- in a macro I would use #.(symbol-name '#:foo-)
<jasom> if it's e.g. case-preserving then it will look for "cl-user" which is not required to exist, while "CL-USER" *is* required to exist.
<_death> my immediate reaction when seeing #. is disgust
<jasom> I'm fine with #. for such short uses, but in this case it's flat out worse than using a string, as a string will always be right.
<jasom> and this could be wrong.
rumbler31 has quit [Remote host closed the connection]
<_death> there are many uses of #. that lead to fragile code.. few that are justified
<jasom> also (in-package #.(symbol-name '#:foo)) is going to be identical to (in-package '#:foo) since there is an implicit call to symbol-name (probably via cl:string) in the in-package macro
<aeth> _death: There are two acceptable uses for #. imo. symbol-name (like above) and to get a constant number in an unquoted type specifier like (let ((bar 42)) (check-type bar (integer 0 #.(isqrt most-positive-fixnum))) bar)
<aeth> Assuming it's a one-off, of course. Use it more than once and just use deftype.
<_death> aeth: in most-positive-fixnum that may work.. in your own constants that may not depending on when you define them
<aeth> _death: Just wrap the constant in eval-when and that fixes it, at least for CCL, which does complain about such things. But almost all of the time it will be something like most-positive-fixnum
<oni-on-ion> shift 3 dot shift 9 symbol-name quote shift 3 shift semicolon foo shift 0 shift 0 ..... thats a lot of dang-ed typing !!
<aeth> Because you're e.g. trying to make sure it stays a fixnum
<_death> right, wrapping with eval-when is another put off
Shinmera has left #lisp ["しつれいしなければならないんです。"]
<_death> one ugly leads to another
<oni-on-ion> path of least resistance. like lightening !
<aeth> _death: something like this: (defun fixnum-square (number) (check-type number (integer 0 #.(isqrt most-positive-fixnum))) (expt number 2))
<aeth> Probably not particularly practical/useful in that case
<aeth> But there are non-toy examples that could be useful
<jasom> aeth: I'm also trying to figure out why you are using #. for the symbol-name; symbol-name 'foo will never change since foo is read in once; is it just an optimization?
pjb has joined #lisp
<aeth> jasom: I've been doing this for a while now but I believe that the reasoning was to get the performance of "FOO" but with more reliability. I don't think it would make a difference in SBCL, though.
charh has quit [Ping timeout: 268 seconds]
<_death> instead use deftype.. and fixnum declarations is yet another put off :/
<aeth> At the very least SBCL seems to turn (defun foo () (symbol-name '#:bar)) into a function that constantly returns "BAR"
<aeth> _death: The actual use of this in my code is in a sieve
<aeth> _death: You will run out of memory long before you leave fixnum
<_death> so why declare it fixnum instead of actually specifying a boundary
<_death> if you've already bounds in mind
<aeth> Why specify a boundary? All that's required is to prove to the compiler that is remains a fixnum so the arithmetic stays inline. The actual bounds are your memory and patience.
<aeth> It would be impossible to leave fixnum with that algorithm, though, because you would certainly run out of memory.
jinkies has quit [Ping timeout: 276 seconds]
<younder> agreed the need for 16 bit float means some programming to make DNN's efficient.
<younder> The marshaling and representation stands the potential of being a major bottleneck.
<_death> would an implementation where fixnum is (signed-byte 16) run out of memory
rozenglass has joined #lisp
<aeth> _death: If it's a 16 bit computer with a 16 bit address space, yes
<_death> and if it's not
<aeth> Then why are you using a 16 bit implementation
<_death> then why do you care about fixnum there?
<_death> just use (signed-byte 61)
<aeth> But, actually, a 16 bit Lisp would run out of array space
<younder> DNN's
<aeth> Arrays are some fixnum size long
jkordani has quit [Quit: Leaving]
<_death> so now you actually care about array-length
Bike has joined #lisp
<aeth> No, what I actually care about is generating the primes as quickly as possible. I would rather have every implementation generate as many as it is capable of doing efficiently than artificially limit 64-bit SBCL or create a misleadingly high bound for the rest.
<aeth> I can use fixnum, I can create something that is efficiently only in 64-bit SBCL, or I can artifically limit what 64-bit SBCL is capable of doing. (This is the case because 64-bit SBCL has the largest fixnum.)
<_death> but, if you have an array of things, then you don't care about fixnum, but a subtype of it
fikka has joined #lisp
<aeth> _death: But if I bound things with #.(isqrt most-positive-fixnum) I know it works.
<_death> what if array-dimension-limit is 1024
<aeth> Don't run a high-performance prime sieve on a 16-bit CL with the standards-specified 16-bit-friendly absolute minimums for everything, then.
<aeth> My programs are portable to useful implementations, not every implementation ever.
<_death> right.. so your answer is not to run your code on an implementation where it breaks
<aeth> Yes.
<aeth> Even CLISP is absolutely painful for a lot of numerical code.
<_death> so you see that fixnum-based declarations can lead to fragile code as well
<aeth> My experiences with the painfulness of CLISP are actually double-float
<aeth> If you use double-floats in a computationally intensive way, CLISP exists to make your life hell.
<aeth> (upgraded-array-element-type 'double-float) => T ; in CLISP
<aeth> In general, though, in my personal experiences, code involving numbers will run almost instantly in SBCL, may run almost as fast in SBCL or have unexpected slowdowns in CCL, will sometimes be much slower in ECL, and will usually be basically unusable in CLISP.
<aeth> s/as fast in SBCL/as fast as SBCL/
robotoad_ has quit [Read error: Connection reset by peer]
robotoad has joined #lisp
<aeth> Hypothetical 16-bit everything-is-the-minimum-in-hyperspec Common Lisp would be even worse than CLISP here. And I'm pretty sure I have some docstrings longer than 1024, which would also not be conforming.
<aeth> Okay, the longest docstring I can think of in my code is 749, but it will probably pass 1024 at some point as more details are added. That will no longer be fully portable. Will I limit myself to 1024 character docstrings? Absolutely not.
pjb has quit [Ping timeout: 260 seconds]
<_death> so my approach would be to give bounds, and if an implementation can't generate efficient code for that bound, so be it, don't use them if you expect something fast, but at least they won't break..
<aeth> _death: So your approach would either (1) make code that's only fast in SBCL or (2) artificially limit SBCL so you can at least support CCL and maybe a few others similarly. Depending on whether your bounds are SBCL-friendly or CCL/etc.-friendly.
charh has joined #lisp
<aeth> _death: If you want #2 you can write a trivial inline function with a lower CHECK-TYPE.
<anamorphic> What 16 bit Common Lisps are there?
<aeth> anamorphic: The standard permits 16-bit implementations (otherwise it wouldn't have ridiculously low minimums like 1024 for arrays, which include strings)
<aeth> anamorphic: Ones that actually exist(ed) were probably ones for MS-DOS
<aeth> They were probably slow, barely usable, not very useful, and a subset of the language. Almost certainly made for the old CL, pre-CLOS.
<_death> but again, in this specific case you actually care about array length, not about fixnum.. even if you don't have explicit bounds to specify, fixnum is often a poor candidate
pierpa has joined #lisp
<LdBeth> Just hack DEFUN to ignore docstring
<aeth> _death: This is low level code that would ideally produce efficient code in any reasonable implementation. If you want a constant interface so (foo n) will work for any constant value n in a program, wrap it with a trivial inline function that establishes a second set of bounds. The inner function has bounds that produces efficient code (keeping it fixnum).
<aeth> _death: You cannot go the other way around and make an efficient function from one that either artificially limits SBCL or produces code that's only efficient on SBCL (since intermediate values might become bignum in the other implementations).
nowhere_man has joined #lisp
<aeth> _death: It's possible in some strange cases, the part that keeps it fixnum for efficient fixnum arithmetic won't line up so one of the arrays will be created too large. This isn't C, though. You'll get an error there.
<aeth> If for some reason that shows up in an implementation (unlikely), then that's the time to spend the time addressing it.
pjb has joined #lisp
<aeth> I don't even check for bounds with my float functions in general because that would greatly slow things down because there are too many of them (think things like vec+). I do find and document them, though.
<aeth> A user who cares could wrap the functions or, more ideally, wrap a function that uses several of these and derive the final safe input bounds (and it's actually unnecessary here because you'll get an overflow/etc. error at some point unless you turn off float traps... and the documented bounds just document what causes *these*)
LiamH has quit [Quit: Leaving.]
<aeth> But in general, when I work with integers they're either (1) trivial enough that I'll just inline them and bignums are OK if that's what you want or (2) nontrivial enough that fixnums or (un)signed bytes of size 32 or 64 are imo the right thing. Usually the latter two these days, actually.
rumbler31 has joined #lisp
rumbler31 has quit [Remote host closed the connection]
<_death> if you generate two versions of code, for fixnums and bignums, that's good and non-fragile.. that's how CL works..
<aeth> There is one place where I use fixnums very incorrectly, though. I use them as the type of a vector index. Afaik array-dimension-limit should be the bound instead, which in SBCL is off by 2 (in practice, no difference since you'll run out of memory before getting to those 2). So the type alexandria:array-index
vlatkoB has quit [Remote host closed the connection]
<aeth> (I'm not surprised that this is common enough of a type that it's in alexandria.)
<_death> I think it was codified as a CDR
<aeth> Hmm, in CCL a fixnum is about 16x larger than array-dimension-limit... but again, you'll run out of memory first because array-dimension-limit, assuming a *bit* array, would make that array be about 8 PiB or 9 PB
razzy has quit [Ping timeout: 252 seconds]
kristof has joined #lisp
<aeth> (And, for semi-completeness, ECL's most-positive-fixnum is its array-dimension-limit.)
random-nick has quit [Ping timeout: 244 seconds]
<_death> array-dimension-limit is much more telling than fixnum..
asymptotically2 has quit [Remote host closed the connection]
random-nick has joined #lisp
<aeth> This seems to be fairly common: (let ((foos #(1 2 3))) (loop :for foo :across foos :for i :of-type alexandria:array-index :from 0 :do (format t "~D ~S~%" i foo)))
<aeth> Of course it'll probably not have a type, or it will incorrectly have the type fixnum if there is one... and it probably won't be optimized
<_death> and usually it won't matter that it's not optimized
<aeth> Yes, but it could be optimized. Without the type declaration, the compiler will not know enough to realize that i cannot be a bignum, and with the type declaration of array-index or fixnum, there will be a type check every iteration.
<aeth> The type declaration is probably the way to go if you're doing something fancier with it... but the type declaration shouldn't be necessary for it to be known that it's not a bignum.
<aeth> (It's probably actually better to use fixnum here than array-index because the fixnum type check might be faster.)
anamorphic has quit [Quit: anamorphic]
anamorphic has joined #lisp
<_death> I would write this as (dotimes (i (length foos)) (format t "~D ~S~%" i (aref foos i))) btw
<aeth> _death: It's hard to come up with a trivial LOOP that demonstrates something about LOOP without the LOOP itself being unnecessary.
<_death> yep
kristof has quit [Ping timeout: 272 seconds]
random-nick has quit [Ping timeout: 244 seconds]
anamorphic has quit [Ping timeout: 246 seconds]
<aeth> Conditional collect/append is probably the only place where a somewhat trivial LOOP is actually the nicest way to write it.
<_death> a "smart enough compiler" could deduce that I is of type array index.. loop or no loop, but of course you don't want to rely on a mythical compiler if performance is important
lumm has quit [Quit: lumm]
<aeth> _death: But how would you work around something like that other than turning safety off (assuming that even turns safety off)? I guess the way in the loop would be to do :from 0 :to (length foos) except that might now do two end condition checks when one will do
<aeth> The equivalent map nil with an outer i variable will behave very similarly, including potentially having optimized access for iterating across vectors. dotimes might actually be the most efficient here, but only when the bounds of foos are known.
<_death> not sure what you mean
<aeth> _death: I guess my point is only the sufficiently smart compiler will have this optimized at all, so you would have to rely on the "mythical compiler" for maximum performance here.
<_death> PROG. just go PROG :)
<aeth> prog's always unnecessary since you can just use tagbody instead.
<_death> I think PROG predated TAGBODY.. and it was all the rage ;)
<_death> and now it's time to SLEEP
rumbler31 has joined #lisp
<LdBeth> SO when will be the next compiler with AI include?
<no-defun-allowed> interlisp 2.0 with DWIM2
<aeth> Compilers already include AI. For example, style-warnings are 'automated code review', which should be a pretty hot field of AI, right?
rumbler31 has quit [Remote host closed the connection]
<aeth> (Just brand everything as some kind of AI)
<no-defun-allowed> yeah
<no-defun-allowed> the compiler is a complicated expert system for generating fast assembler
kristof has joined #lisp
random-nick has joined #lisp
<_death> quite an interesting page from historical perspective https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node91.html
varjag has quit [Ping timeout: 252 seconds]
aindilis has quit [Remote host closed the connection]
anewuser has joined #lisp
nowhere_man has quit [Ping timeout: 260 seconds]
robotoad has quit [Quit: robotoad]
<jcowan> Compilers are "automatic programming", one of the first AI fields. In fact, so are assemblers.
nowhere_man has joined #lisp
void_pointer has joined #lisp
random-nick has quit [Ping timeout: 252 seconds]
<jcowan> "Here is a fine example of what can be done with prog:" Indeed.
frodef has quit [Ping timeout: 252 seconds]
nullniverse has joined #lisp
pjb has quit [Ping timeout: 252 seconds]
rumbler31 has joined #lisp
ryan_vw has joined #lisp
rumbler31 has quit [Ping timeout: 252 seconds]
<jasom> has anyone tried writing an ASDF plugin that lets you specify a particular lisp file should be loaded with a particular read-table?
void_pointer has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
<jcowan> jasom: cool idea!
<jasom> It seems obvious enough that *someone* must have looked into it. I was just mulling over racket's language modules and considering how I might implement something similar in CL.
<scymtym> jasom: fare's syntax-control (i think that was the name) branch would probably be good starting point
<jcowan> PROG did indeed precede TAGBODY as well as LET and BLOCK
<jasom> scymtym: that branch had different purposes; I was thinking of just defining a new component type
<jcowan> IMO TRT is to allow specifying the version of read that the compiler/loader/eval uses
<scymtym> jasom: ok
robotoad has joined #lisp