freenode/lisp - IRC Chatlog
Search
1:20:56
npfaro
I have something like (loop for x in ls when (not (member x other-ls)) for y = (car x) do ...) but I'm getting an error
4:01:07
npfaro
Yeah, the issue is that I have another `for` clause in the loop that uses one of the previous values, and that value cannot be nil
4:03:17
npfaro
or actually i really didn't, now that i'm coming back to it. i'm just looping over a remove-if
4:03:58
White_Flame
ah, so you're not using the restarts to get around the LOOP iteration, that's okay
4:04:45
White_Flame
you could use ignore-errors, which will return NIL for you on error, but adding the debugging FORMAT might be a bit more verbose
4:06:51
npfaro
Is there anyting analogous to a named let in scheme, other than using flet or labels and calling it?
4:09:48
npfaro
not exactly, because you can call the named let with whatever parameters you want just like a recurisve function
4:10:43
npfaro
do isn't exactly as powerful because you have to define a step form for each var instead of being able to specify it in the body
4:13:00
White_Flame
having a specific entry point wiht initializers seems to be the more accepted style than reusing it for the inner loop
4:16:01
White_Flame
at least in SBCL, self-recursive functions compile down to the proper set as needed & jump code
4:32:05
beach
I have seen so many programs become incomprehensible by someone insisting on using tail recursion rather than iteration.
4:34:56
beach
Also, it is usually a bad idea to use idioms from a different language. That goes for programming languages and natural languages alike.
4:36:16
beach
I say, use recursion when recursion is pretty much the only solution, like on trees and graphs. For linear structures like sequences, iteration is usually preferable.
4:50:28
White_Flame
npfaro: I use tail calls a lot, and tend to use self-recursion whenever it goes beyond simple LOOP usage
8:18:09
fiddlerwoaroof
tail-recursion, to me, is a bit like REDUCE: it's great when needed, but it's usually better to use it to make intermediate-level abstractions
8:18:46
fiddlerwoaroof
e.g. I could use REDUCE to do what MAPCAR does, but MAPCAR is less noisy and expresses my intent more clearly
8:21:41
npfaro
tail recursion and a pattern matcher are a "match" made in heaven when it comes to parsing lists
9:30:53
npfaro
is there any way to do a nested loop in a single `loop` form or do you have to do (loop for x do (loop for y do))
11:31:38
daphnis
did something change about the way one should load the code from Practical CL? i tried putting the practicals-... directory into asdf:*central-registry* and doing (asdf:oos 'asdf:load-op :practicals)
12:30:46
phoe
https://github.com/Apress/practical-common-lisp/blob/339dbf0224db6b3b23fd69b336c21625ca9142be/practicals/Chapter24/binary-data.asd
12:40:03
daphnis
phoe: yeah, it's just that the method suggested in the readme doesn't seem to work very well. but someone on so suggested putting it into quicklisp/local-projects/. that still doesn't work with everything at once, but at least i was able to load the package i needed.