<edgar-rft`>
soon the web will be embedded in Common Lisp
<jackdaniel>
(ql:quickunload "js")
yitzi has joined #commonlisp
decweb has joined #commonlisp
admich1 has joined #commonlisp
pranav has joined #commonlisp
admich1 has quit [Ping timeout: 276 seconds]
admich1 has joined #commonlisp
yitzi has quit [Ping timeout: 252 seconds]
Fade has quit [Server closed connection]
Fade has joined #commonlisp
BierLiebHaber has quit [Server closed connection]
BierLiebHaber has joined #commonlisp
ingeniot has joined #commonlisp
yitzi has joined #commonlisp
yitzi has quit [Client Quit]
Fade has quit [Changing host]
Fade has joined #commonlisp
Lycurgus has joined #commonlisp
ingeniot has quit [Ping timeout: 252 seconds]
Guest47 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Guest47 has joined #commonlisp
Lycurgus has quit [Quit: irc.renjuan.org (juan@acm.org)]
yitzi has joined #commonlisp
<beach>
jackdaniel: Again, congratulations to the grant.
triffid has quit [Remote host closed the connection]
triffid has joined #commonlisp
Guest47 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<acdw>
such great news!
attila_lendvai_ has quit [Ping timeout: 248 seconds]
zxcvz has joined #commonlisp
Guest47 has joined #commonlisp
zxcvz has quit [Client Quit]
admich1 has quit [Remote host closed the connection]
admich1 has joined #commonlisp
jonatack has joined #commonlisp
robin has quit [Quit: Leaving]
<acdw>
how would yall serialize a function to a string in CL? for incluseion in a sqlite database. is that even a good idea really?
<acdw>
or should i rethink how to structure my data
admich1 has quit [Ping timeout: 248 seconds]
<beach>
You can't serialize a function.
<acdw>
yeah that'swwhat i figured
mooseball has quit [Quit: Leaving]
<pl>
acdw: nothing portable, there were projects that handled that but nothing portable and everything brittle because most implementations don't have any support for that kind of operation other than writing out a fasl or dumping core
<dlowe>
You can store the source if you control the definition process
<dlowe>
it's probably not a good idea though
<acdw>
yeah that makes sense. i think i've figured out a better way to do it anyway
jon_atack has joined #commonlisp
<acdw>
list as a string, then read it in , gotta love it
jonatack has quit [Ping timeout: 240 seconds]
admich1 has joined #commonlisp
<pl>
Generally that sort of things is outside the scope of *standard* - nothing stops an implementation from providing a way to do it, but it's rare enough use case that people don't bother
King_julian has quit [Ping timeout: 248 seconds]
King_julian has joined #commonlisp
<pl>
closest I have seen was a short lived patchy system that essentially dumped partial "cores" of SBCL to disk for super fast loading
<pl>
hacky as hell
<acdw>
oh jeez
<acdw>
yeah i'll just print sexps to strings and read them then code-walk them to resolve values
<dlowe>
if you're going to code-walk them anyway, might as well generate CL on the way and the you can compile it
<acdw>
o like, save '(defun blah (foo) ...) then read and eval it?
<dlowe>
I was thinking if you were saving a DSL, you could code-walk it while emitting CL expressions.
<ixelp>
GitHub - s-expressionists/Khazern: A portable and extensible Common Lisp LOOP implementation
<yitzi>
The documentation is very light right now. Apologies.
jonatack has joined #commonlisp
<yitzi>
To summarize: Khazern-extension can accumulate into any sequence type. It can iterate over streams, any sequence type and multidimensional arrays.
<acdw>
oh that's cool
<yitzi>
It has a pile of additional accumulation clauses. It can accumulate in subforms via named functions, and it has a CLEANUP clause that uses UNWIND-PROTECT.
jon_atack has quit [Ping timeout: 252 seconds]
<yitzi>
acdw: its been around quite a while, I've just been hacking on it a bit this summer.
<acdw>
oh lol cool
ndudaev1 has joined #commonlisp
admich1 has quit [Remote host closed the connection]
<yitzi>
Oh, at it also has some combintorics iteration, like permutations, combinations and cartesian products.
admich1 has joined #commonlisp
<yitzi>
Just pushed an update to the README for those that are interested.
admich1 has quit [Remote host closed the connection]
admich1 has joined #commonlisp
<jackdaniel>
yitzi: sounds cool
<yitzi>
thx, buddy.
ingeniot has joined #commonlisp
admich1 has quit [Remote host closed the connection]
<ixelp>
GitHub - s-expressionists/Khazern: A portable and extensible Common Lisp LOOP implementation
LainIwakura has quit [Ping timeout: 272 seconds]
phil_bb has joined #commonlisp
<decweb>
jackdaniel, yes, I use serapeum:with-collector frequently
<decweb>
yitzi: I don't remember the situations, but there have definitely been times where I had a DO in the loop and wanted to use COLLECT as well, and couldn't.
<decweb>
For those times I fell back on serapeum:with-collector.
<jackdaniel>
cmuutil has a macro collecting that I'm reusing in various projects
Lycurgus has joined #commonlisp
<jackdaniel>
it composes well with loop, do, mapping amd other lexically scoped constructs
<yitzi>
decweb: I'd like to see the example. DO and COLLECT are both selectable clauses, which means they can be used in the exact same places.
<jackdaniel>
yitzi: I think that he means `do (let () (collect x))` kind of thing
<yitzi>
Yeah, I addressed that with the USE clause.
X-Scale has quit [Ping timeout: 260 seconds]
X-Scale has joined #commonlisp
<gilberth>
yitzi: What I miss most from LOOP is iterating over a sequence. Be it a list or a vector.
<yitzi>
Gotcha. Khazern has the ELEMENTS iteration path for that. \
Lycurgus has quit [Quit: irc.renjuan.org (juan@acm.org)]
yitzi has joined #commonlisp
rakka has quit [Remote host closed the connection]
<yitzi>
gilberth: The original iteration path syntax supported inclusive paths, which is the reason the verbose syntax. I don't really see a reason the these types of paths. So I could add a somewhat abbreviated syntax: (loop for x IS elements of y) where "IS" is some unique token. I just choose IS as a example. Would that make it better in your eyes?
rakka has joined #commonlisp
<gilberth>
I have a hack that just says (LOOP FOR X OVER <sequence> ...). As confusing or not confusing as IN, ACROSS, and ON.
<jackdaniel>
(loop for x over elements do (print x))
<jackdaniel>
ha!
<jackdaniel>
n.b hash iterator in loop is a disaster when it comes to remembering it
<gilberth>
Apropos ON. In CLIM we have the issue that there are coordinate sequences like (x1 y1 x2 y2 ...) or the like. Could be lists or vector. Can we can come up with something here? (FOR (X Y) <???> <coord-sequence> ...).
ggb has quit [Server closed connection]
ggb has joined #commonlisp
<yitzi>
jackdaniel: I understood it more after I got the iteration path syntax. USING accesses the internal loop variables.
<gilberth>
Yes, iirc there's some horrible macro for coordinate sequences in McCLIM.
<jackdaniel>
do, dohash, dohash mesh
<jackdaniel>
yes, that one is truly ugly
<jackdaniel>
do-sequence if I remember correctly
<gilberth>
I wonder who wrote it.
<jackdaniel>
but it gets the job done, so I'm glad that it is in there (:
<jackdaniel>
speaking of coordinates, I think that the correct way to deal with that is to store points as a canonical form; if anyone comes with an idea CLIM but in 3d, operating on coordinate sequences will become even bigger headache
<ixelp>
GitHub - yitzchak/loop-iteration-paths: Common iteration paths for LOOP
<jackdaniel>
perhaps a custom metaclass would store groups of points as a single vector
<jackdaniel>
could*
Ruby has quit [Ping timeout: 252 seconds]
<yitzi>
Even more abbreviated in the khazern readme.
<gilberth>
Well, for something like draw-polygon* you may want to be able to blast out those coordinates into the general direction of whoever renders. So having a "flat" representation is reasonable option.
<yitzi>
If the coordinate sequence is a list you can already do that destructuing with CL:LOOP.
<yitzi>
To do it with vectors you'd have to extend the destructuring code, I suppose.
<gilberth>
Well, it works on list because you can say BY #'CDDR.
<yitzi>
Yes, with ON
ingeniot has joined #commonlisp
<gilberth>
Yes. But that pattern doesn't work with OVER that jackdaniel and I want to have. And not with ACROSS either.
<gilberth>
Would I go baroque I could imagine something like (LOOP FOR REPEATED (X Y) IN/ACROSS/OVER ...) or something like that. Matching successive elements to X and Y.
<jackdaniel>
(loop for (x y) over seq by n ..) ;?
<gilberth>
Could also be something like (MIN-X MIN-Y MAX-X MAX-Y) or perhaps (X Y W H).
<yitzi>
The destructuring code in CL:LOOP isn't specific to ON. So to extend it to sequences for ACROSS and the proposed OVER you'd have to extend it everywher.
<gilberth>
jackdaniel: Nice!
<yitzi>
You can destructure in any variable binding. WITH include.
<yitzi>
included.
* gilberth
disappears.
decweb has quit [Quit: Konversation terminated!]
decweb has joined #commonlisp
<gilberth>
Almost. ,(loop for x in '(1 2 3 4) by #'cddr collect x) ;BY is taken
<ixelp>
(loop for x in '(1 2 3 4) by #'cddr collect x) => (1 3)
varjag has joined #commonlisp
<yitzi>
tokens aren't unique like that in the LOOP parser
<gilberth>
We rather want that a pattern (x y) is matched against the current and the next element not as a whole to the current element. So REPEATED again? Or some better name.
<yitzi>
You can use BY with OVER. ON doesn't own it.
<gilberth>
Fully generic would be (LOOP FOR REPEATED (I J) BELOW 3 COLLECT (LIST I J)) => ((0 1) (1 2)). ;-)
<gilberth>
yitzi: Sure, but I won't like it that when I s/OVER/IN/ or s/IN/OVER/ the meaning changes beyond whether only lists are accepted or not. That would be confusing, I think.
<decweb>
With apologies for flogging my repo, on the theme of iteration without worries, if you like Clojure, https://github.com/dtenny/clj-coll brings all its sequence/collection abstractions to Common Lisp. Not only do all its map/reduce/doseq constructs handle all the immutable collections it provides, but they also work on Common Lisp collections too, (lists, vectors, hash-tables), all via the `seq` abstractions.
<ixelp>
GitHub - dtenny/clj-coll: Clojure collection and sequence APIs in Common Lisp, with optional Clojure collection syntax
<jackdaniel>
then over standing for in/across, and inside standing for on/???
<gilberth>
And when traversing polygons we might want to iterate like so that we have (x1 y1 x2 y2) be (1 2 3 4) and then (3 4 5 6) then (4 5 6 7) and so on. So both "spliced" matching and some distance might be useful.
<decweb>
You can also use the seq abstractions with CL:LOOP in a fairly bland way, i.e. (loop for elt = (seq <coll>) then (next elt) while elt do ...)
TactfulCitrus has joined #commonlisp
<jackdaniel>
generally that's why I'm usually making do-foo macros
<jackdaniel>
you don't need to think very hard about syntax verbs and such
<gilberth>
Yes, and less confusing. And perhaps easier to understand when looking at the macro.