freenode/#lisp - IRC Chatlog
Search
2:17:24
loke`
elderK: Well, that's your problem right there. How else would you do Lisp development without an easy way to compile functions, etc.
2:18:40
loke`
I can't even imagine what a nightmare it would be to develop in Lisp without Emacs. How would you even do it? You'd end up writinf code, and then manually load and compile eveeyr time. Probably restarting the runtime over and over again.
2:19:21
elderK
LdBeth: Now that I've defined a couple macros, is there anything special I need to do to make sure like, everything works? Like, I've heard of eval-when.
2:20:18
aeth
jcowan: In CL, I think that "everything" in this category (e.g. array indices) has to be a fixnum and these things are normally positive, so in effect if fixnums are 2 ^ n then the upper bound for things like array-total-size-limit would be 2 ^ (n - 1) - 1. In SBCL, array-total-size-limit is 2 ^ 62 - 3. In CCL, though, it isn't anywhere close to the theoretical maximum iirc.
2:22:05
LdBeth
elderK: it's usually a good practice collecting macro definitions in one place and load them first
2:22:35
aeth
In practice they seem to have given extra room, so e.g. array-total-size-limit is 2 ^ 10 even though most-positive-fixnum has to be at least 2 ^ 15 - 1
2:24:28
aeth
You only need eval-when for helper functions called by defmacro located in the same file as the defmacro iirc.
2:24:37
macaroni_destroy
welp submitted this to kattis team. hope they will add sbcl https://github.com/optimisticlisper/kattis_sbcl_different
2:25:11
no-defun-allowed
aeth: regarding the gitlab-ci stuff, you may not need git since it clones into a subdirectory of /builds/
2:25:40
LdBeth
aeth: in CCL not warp macros in eval-when could cause problem expending macrolet form
2:25:58
aeth
no-defun-allowed: instead you can just ln -s that directory to make sure it shows up in ~/quicklisp/local-projects/
2:26:22
aeth
no-defun-allowed: I think that git is used in the recipe so that you can have dependencies that require being downloaded from git.
2:30:13
LdBeth
the example is (some-macro (macrolet a b c)) where the argument form is just a list of symbol but ccl tries to expand it if some-macro defined in the same file is not warped in eval-when
2:30:40
aeth
no-defun-allowed: I would probably just comment out the part that requires git rather than removing it because once you need to load a dependency that is either not in Quicklisp or newer than the latest version in Quicklisp you're going to need it back in.
2:34:28
aeth
LdBeth: Perhaps there's a problem with order where if a defmacro foo is located below where it's used in the file CCL complains?
2:34:44
aeth
LdBeth: I definitely use macros in the same file where I define them all of the time with no problems
2:49:38
LdBeth
aeth: the actual situation is a little complex, the problem occurs when I use a custom code walker that idex symbols after macroexpand, and somehow ccl treats macrolet differently than sbcl that it tries to expand that form
2:55:10
LdBeth
Bike: function-information or something on ccl give different thing for macrolet than sbcl
3:39:33
aeth
elderK: If I'm understanding your problem correctly, you want a do that runs the body at least once, even if it would initially terminate. So (do () (t) (format t "Hello~%")) doesn't print "Hello~%" even once but you want it to show up once, correct?
3:39:34
elderK
So far, I've just been making sure my functions are reasonably small, so easy to "analyze". But, I have a bug now where stepping would be useful.
3:40:23
elderK
I'm using some hand-rolled macros this time around too, although I'm not sure how much they're contributing. :P
3:41:18
aeth
elderK: That's as trivial as this: (defmacro foo (varlist endlist &body body) `(progn ,@body (do ,varlist ,endlist ,@body)))
3:41:41
aeth
That will work just like (do () (t) (format t "Hello~%")) but it executes the body once at the start.
3:42:17
aeth
Naming it, however, is harder. Do isn't a while loop... it's sort of a not-while loop, so do-while would be misleading.
3:44:17
aeth
Oh, not quite as trivial as I said because you'll also want a let for the bindings in the varlist
3:47:50
aeth
If you wanted to use do* instead of do you could (afaik) avoid all of these issues with (defmacro foo (varlist endlist &body body) (let ((gensym (gensym))) `(do* (,@varlist (,gensym ,@body)) ,endlist (declare (ignore ,gensym)) ,@body)))
3:59:48
elderK
When should I use values to return multiple things, instead of just using a cons to return two things?
4:01:00
|3b|
if you always need both things, and usually want to keep them around for a while, it might be worth putting them in some data structure
4:01:35
|3b|
if you usually want 1 of the things, but sometimes need the other and have to calculate it anyway, use VALUES
4:09:44
elderK
Also, out of curiosity, is the "in things" evaluated once at the beginnign of the loop? Like, if I add more things to the list I'm moving over, will loop handle that?
4:10:38
|3b|
there are some specific modifications you are allowed to do, so check specs if it matters
4:11:28
|3b|
usually if i want to iterate a changing list i do something like (loop with tmp = list for x = (pop tmp) while tmp ...) or similar
4:13:47
|3b|
modifying the car of a cons doesn't change the structure of any lists it is part of, i think that is allowed while iterating a list
5:04:58
|3b|
you can destructure result of multiple-value-list though, at the expense of probably consing
5:05:44
|3b|
(not sure if any of the loop implementations in general usage optimize that out or not, i think sacla LOOP does)
5:26:38
beach
It is important to read those Common Lisp HyperSpec entries, because the Common Lisp language is not defined by what an implementation accepts.
5:32:20
|3b|
ACTION hadn't thought about it previously, but i guess you could put loop-finish in a for = clause to terminate early for some of the cases where mixing them would be convenient
5:34:55
elderK
So it's okay to use a loop without actually like, doing any looping? It's ability to like, destructure stuff is very, very useful.
6:08:54
elderK
:) Are there any like, libraries or something worth studying to see how to do binary-IO well in CL? Say, parsing image formats and stuff?
6:09:31
elderK
I've been pestering you all a lot today, so, I just wanted to say thanks. You guys have helped me so much, and have made jumping into Lisp much more enjoyable than it would be otherwise.
6:10:21
on_ion
this one -> https://www.reddit.com/r/lisp/comments/6uc0s2/pngload_fast_and_fully_conforming_png_decoder_in/
7:33:10
flip214
help, please. slime git HEAD, sbcl git HEAD, and I get a message "invalid number of arguments: 5" but with an unusable stack trace.
8:05:21
flip214
well, the CREATE-REPL seems to cause it in some way. don't think that vlime is at fault per se
8:08:20
flip214
sadly, (TRACE "SWANK") or similar only leads to Help! 11 nested errors. SB-KERNEL:*MAXIMUM-ERROR-DEPTH* exceeded.
8:21:02
flip214
even a (sleep 3600) or (loop) in close-connection% (I planned to attach via GDB) doesn't work as expected
8:24:33
flip214
hmmm, #+(or) before (defun monkey-patch-stream-printing ...) makes it look okay again
8:29:44
flip214
luis: contrib/swank-presentation-streams.lisp (defun monkey-patch-stream-printing) for sbcl
8:41:28
flip214
minion: memo for dougk: Hi Doug, your SBCL change 14c8a92609 breaks current SLIME. JFI. basic workaround in https://github.com/phmarek/slime/commit/7c3a4c48f6804510c1bd26f97ff09f58f2bfe85a.
8:47:49
flip214
any SLIME maintainers (luis?): basic workaround for https://github.com/sbcl/sbcl/commit/14c8a92609 in https://github.com/phmarek/slime/commit/7c3a4c48f6804510c1bd26f97ff09f58f2bfe85a
8:54:59
luis
flip214: swank-presentation-streams has been very problematic in the past so it's basically unsupported at this point. We need a proper API from SBCL for this to ever work reliably
8:58:34
elderK
Guys, how do you do the equivalent of (define x (let ((stuff.)) (lambda (....) ....))) in CL?
9:11:15
luis
flip214: what could we do? Rename it to something scary? Did you notice that there was some even fishier monkey patching going on? (#+#:disable-dangerous-patching) I thought that at that point the contrib had stopped doing anything interesting on SBCL
9:28:17
elderK
At least, as far as I care to go with it. I don't really need to read stuff from file.
10:17:34
elderK
The idea is, you are given a world of some configuration. Find out how to add to that such that after simulation, the entire world is infected. The goal is to use the minimum number of infected individuals.
11:11:30
flip214
luis: https://github.com/phmarek/slime/commit/e3c3540786a000d7afee1cd420b99c3ba3c5f7f7 instead of the old version
11:11:42
flip214
minion: memo for dougk: https://github.com/phmarek/slime/commit/e3c3540786a000d7afee1cd420b99c3ba3c5f7f7 is a newer version
11:59:05
luis
flip214: found the e-mail where Stas outlines what a proper API should look like: https://sourceforge.net/p/sbcl/mailman/message/33102884/
13:58:50
beach
I think I may have gotten Quicklisp confused with an incorrect ASDF file. Is there a way to clear the idea that Quicklisp has of local projects, so that I can do the register-local-projects from scratch?
13:59:45
jdz
beach: have you tried removing the system-index.txt from local-projects? Or is it something else you're after?