<ixelp>
Lisp Life Lessons; An evening with Kent Pitman, Tue, Dec 12, 2023, 6:00 PM | Meetup
Eoco has quit [Quit: WeeChat 4.1.1]
waleee has quit [Ping timeout: 264 seconds]
tyson2 has quit [Remote host closed the connection]
Eoco has joined #commonlisp
dcb has quit [Quit: MSN Messenger 4.1.1]
alfplayer has quit [Quit: Ping timeout (120 seconds)]
meritamen has joined #commonlisp
meritamen has quit [Read error: Connection reset by peer]
dajole has quit [Quit: Connection closed for inactivity]
jon_atack has quit [Ping timeout: 276 seconds]
habamax has quit [Remote host closed the connection]
jonatack has joined #commonlisp
ym has quit [Ping timeout: 255 seconds]
decweb has quit [Ping timeout: 255 seconds]
wonko-the-sane has quit [Ping timeout: 240 seconds]
azimut has quit [Ping timeout: 240 seconds]
xaltsc has quit [Ping timeout: 252 seconds]
masinter_ has quit [Ping timeout: 268 seconds]
molson_ has joined #commonlisp
zephyr6 has joined #commonlisp
cayley54 has joined #commonlisp
fiddlerwoaroof has quit [Ping timeout: 245 seconds]
molson has quit [Read error: Connection reset by peer]
hexology has quit [Remote host closed the connection]
hexology has joined #commonlisp
fiddlerwoaroof has joined #commonlisp
ryanbw has quit [Ping timeout: 245 seconds]
b3lm0nt has quit [Ping timeout: 245 seconds]
zephyr has quit [Read error: Connection reset by peer]
zephyr6 is now known as zephyr
ryanbw has joined #commonlisp
cayley5 has quit [Ping timeout: 245 seconds]
MetaYan has quit [Ping timeout: 245 seconds]
cayley54 is now known as cayley5
MetaYan has joined #commonlisp
b3lm0nt has joined #commonlisp
Pixel_Outlaw has joined #commonlisp
rtypo has joined #commonlisp
pve has joined #commonlisp
donleo has joined #commonlisp
traidare has joined #commonlisp
dinomug has quit [Remote host closed the connection]
rgherdt has joined #commonlisp
Oladon has quit [Quit: Leaving.]
dnhester26 has quit [Remote host closed the connection]
dnhester26 has joined #commonlisp
Pixel_Outlaw has quit [Remote host closed the connection]
avocadoist has quit [Ping timeout: 255 seconds]
anticrisis has quit [Read error: Connection reset by peer]
zxcvz has joined #commonlisp
zxcvz has quit [Client Quit]
shka has joined #commonlisp
JamesF has quit [Ping timeout: 240 seconds]
jrx has joined #commonlisp
JamesF has joined #commonlisp
JamesF has quit [Ping timeout: 255 seconds]
JamesF has joined #commonlisp
mgl has joined #commonlisp
<phoe>
jcowan: will this be recorded? asking as a European
Gleefre has quit [Remote host closed the connection]
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 264 seconds]
mgl has quit [Ping timeout: 260 seconds]
habamax has joined #commonlisp
Lord_of_Life_ is now known as Lord_of_Life
JamesF has quit [Ping timeout: 245 seconds]
JamesF has joined #commonlisp
simendsjo has joined #commonlisp
JamesF has quit [Ping timeout: 255 seconds]
JamesF has joined #commonlisp
<jcowan>
phoe: yes, if nothing goes wrong
waleee has joined #commonlisp
meritamen has joined #commonlisp
zxcvz has joined #commonlisp
zxcvz has quit [Client Quit]
JamesF has quit [Ping timeout: 245 seconds]
JamesF has joined #commonlisp
JamesF has quit [Ping timeout: 276 seconds]
JamesF has joined #commonlisp
meritamen has quit [Remote host closed the connection]
JamesF has quit [Ping timeout: 245 seconds]
JamesF has joined #commonlisp
simendsjo has quit [Ping timeout: 245 seconds]
Inline has quit [Quit: Leaving]
random-nick has joined #commonlisp
habamax has quit [Remote host closed the connection]
JamesF has quit [Ping timeout: 255 seconds]
JamesF has joined #commonlisp
Inline has joined #commonlisp
jjnkn has joined #commonlisp
JamesF has quit [Ping timeout: 255 seconds]
JamesF has joined #commonlisp
JamesF has quit [Ping timeout: 245 seconds]
JamesF has joined #commonlisp
random-nick has quit [Ping timeout: 268 seconds]
Gleefre has joined #commonlisp
chomwitt has joined #commonlisp
mgl has joined #commonlisp
tyson2 has joined #commonlisp
random-nick has joined #commonlisp
szkl has quit [Quit: Connection closed for inactivity]
Gleefre has quit [Remote host closed the connection]
jjnkn has quit [Quit: leaving]
_cymew_ has joined #commonlisp
NotThatRPG has quit [Ping timeout: 276 seconds]
skeemer has joined #commonlisp
<skeemer>
hello everyone i was considering reading the seasoner schemer but with common lisp, i know it's a scheme book mainly but it was just to grasp the concepts explained without leaving slime/cl
<skeemer>
i was wondering does sbcl has TCO ? i mean tail call optimization
<bike>
yes, but unlike in scheme it is not considered a necessity for the semantics, so whether the optimization is applied can vary based on optimization settings etc.
<beach>
And the standard doesn't require it, so some implementations might not have it.
<beach>
skeemer: In Scheme, iteration is explained in terms of tail recursion. In Common Lisp, that is not the case. Common Lisp has a lower-level primitive that iteration is usually defined in terms of, namely TAGBODY.
<skeemer>
beach: clear, it was more of a curiosity
<skeemer>
but good to know
<skeemer>
i knew TCO was not in the standard and it is up to the implementation
<skeemer>
also do you know if following the seasoned and the reasoned schemer is viable through cl ?
<beach>
Not me. I haven't read them.
<beach>
Is there something wrong with "Practical Common Lisp"?
<skeemer>
beach: PCL has nothing wrong... but PCL is "Practical", the TLP series explores more CS concepts
<skeemer>
i guess a problem i will have with cl is that cl does not have continuations iirc
<skeemer>
can somebody confirm that ?
<skeemer>
i guess the seasoned schemer goes a bit deeper with continuations
<beach>
Common Lisp does not have first-class continuation if that is your question.
<skeemer>
beach: as opposed to scheme ?
<beach>
Scheme does have first-class continuations, yes.
cage has joined #commonlisp
chomwitt has quit [Ping timeout: 256 seconds]
<pranavats>
skeemer: The reasoned schemer does Logic Programming using miniKanren. You might want to use kanren-trs library from quicklisp for that. Or you can implement microKanren in CL (mostly 1-to-1 translation from the scheme code) Continuations are not required for miniKanren. Don't know about the seasoned schemer.
<skeemer>
pranavats: thanks a lot
<skeemer>
yes pranavats seasoned schemers plays a lot with continuations
<skeemer>
iirc
<skeemer>
maybe there is some porkaround i could use from CL
<bike>
let/cc is just call/cc framed as a binding operation. letrec is unrelated.
Lycurgus has joined #commonlisp
JamesF has quit [Ping timeout: 256 seconds]
JamesF has joined #commonlisp
<beach>
skeemer: call/cc (call-with-current-continuation) is a very low-level primitive that requires the possibility to save the current stack (the current continuation). You can't emulate that in a language that doesn't have it already.
<beach>
yottabyte: Why all the blank lines inside top-level forms? That's not conventional style.
<beach>
yottabyte: Top-level comments should have three or four semicolons.
<yottabyte>
that's actually something my friend told me to do, before I had no blank lines so it was just one line after another
<beach>
It sounds like you should not listen to that friend for advice on Common Lisp.
<beach>
Where did that friend learn Common Lisp?
<yottabyte>
maybe I misunderstood him... are you saying I should not have any blank lines in a function?
NotThatRPG has joined #commonlisp
<beach>
Not inside a top-level form, no. Between top-level forms, one blank line.
<beach>
yottabyte: Do you use SLIME and Emacs to write your code? I am asking because your LOOP indentation is not what SLIME gives.
<yottabyte>
yup, slime and emacs
<yottabyte>
if my formatting is ever off I highlight the entire function and press tab and that's what it gives me
<beach>
Then your WHILE and your DO should line up with your FOR.
<beach>
You are using an IF without an `else' form. If the value of your IF is used, then you should provide and `else' form. If not, you should use WHEN instead.
<beach>
You didn't answer my question about where your friend learned Common Lisp.
<beach>
The indentation of LOOP clauses is inconsistent on that page.
JamesF has quit [Ping timeout: 260 seconds]
<beach>
The LOOP clause keywords should line up. And that's what SLIME does, at least when you use SLIME-INDENTATION which I believe is the default now.
<beach>
You should never indent things manually, or at least only exceptionally.
JamesF has joined #commonlisp
<yottabyte>
so like for, while, and do should be vertically aligned?
<beach>
If a person reading your code discovers incorrect indentation, that person must, in order to understand your code, count parentheses (because the indentation can't be trusted). And that is not polite.
<beach>
Yes.
<yottabyte>
yeah my emacs doesn't do that for some reason...
<yottabyte>
but use WHEN if you don't have an else form for IF, got it
<beach>
Also, line 10 is incorrectly indented I think.
<beach>
Are you using SLIME-indentation?
<yottabyte>
how do I find out?
<beach>
Look in your Emacs startup file where SLIME is configured. There should be a slime-indentation there somewhere. But I thought it was the default these days.
<beach>
Silly question: did you start SLIME before editing your code?
<yottabyte>
yup, I always have the slime repl open in another buffer
<yottabyte>
I C-x C-e all day
<beach>
You should have something like this: (slime-setup '(slime-fancy slime-tramp slime-asdf slime-indentation))
<beach>
... in your Emacs startup file.
<yottabyte>
I actually have no slime setup in my .emacs. I do load slime-helper.el from quicklisp
<beach>
Maybe it's done differently these days. Quicklisp used to tell you what to put in your .emacs, or perhaps even add it for you.
<beach>
Maybe someone else knows how to get the correct SLIME setup these days.
dnhester26 has joined #commonlisp
<beach>
You might consider using the "p" suffix like "validp" and "valid-subset-p" rather than "valid" and "is-valid-subset".
<yottabyte>
blank lines look better now though? or should I have blank lines in my let and let*
<yottabyte>
ah yes, I know about that "p" suffix convention
<beach>
There is usually no blank lines inside a top-level form.
<yottabyte>
but aren't there multiple top level forms in the let, and you said to blank line between top level forms? each variable bound
<beach>
If you have the desire to put blank lines inside a top-level form, it is better to split it into several top-level forms.
<beach>
A top-level form is one that is not inside another form, so anything inside a LET is not top-level.
<yottabyte>
ohhh so I still have blank lines I need to remove
<beach>
Instead of a (LET ((CUBES...)...) ...) inside another LET in the LOOP, you can do (LOOP FOR SUBSET IN SUBSETS FOR CUBES = (UIOP:SPLIT....)).
yitzi has joined #commonlisp
<beach>
Same thing with the LET* inside the DO inside LOOP. You can do FOR CUBE-INFO = ... FOR CUBE-COUNT = ...
<beach>
And you might want to insert a few newlines to avoid very wide lines.
<beach>
Stuff like IF gets more readable if you put the test and the `then' and `else' forms on different lines when the sub-forms are big.
<yottabyte>
okay, so doing them inside the DO acts like a LET*?
<beach>
Not inside the DO, as separate LOOP clauses.
dnhester26 has quit [Remote host closed the connection]
dnhester26 has joined #commonlisp
<yottabyte>
ah
<beach>
Doing them as separate FOR <stuff> = ... will act as a LET*.
<yottabyte>
gotcha
<beach>
And you can use (LOOP WITH CUBES = ... WITH VALID = T ...) to avoid a surrounding LET as well.
<beach>
This will save you some horizontal space which is a precious resource.
<beach>
Am I reading GET-GAME-POWERS right that you create GAME-POWERS in the beginning and then no use it until the end?
<beach>
A very general rule in programming is that you want to minimize the scope of your variables so that the person reading your code has fewer things to keep in mind simultaneously.
<yottabyte>
that's what I want to return, and I add to it when I'm able to
<beach>
Oh, wait, I see. The loop adds to it.
<beach>
You might try to use the LOOP keywords COLLECT and APPEND to avoid such side effects.
<yottabyte>
ah yeah, that would be cleaner than the verbose setf I have
<beach>
Or in this case, perhaps a DO iteration variable. I can't read DO, so I can't tell.
<yottabyte>
I might have to still setf actually. but yeah
<beach>
You might want to extract the (loop for value being...) to a separate function.
<beach>
In general, several small functions (correctly named) will give a more readable program.
<moon-child>
in my experience slime is completely broken for nontrivial use of loop
<beach>
moon-child: Your experience is totally different from mine. SLIME-INDENTATION is quite good actually.
<beach>
It even does stuff line AND correctly.
<moon-child>
I don't have an example handy. But I find it gets completely confused for any nontrivial nesting
<beach>
I am guessing you are not using SLIME-INDENTATION.
<yottabyte>
right, I just kinda copied and pasted that loop for value thing. I shouldn't extracted it out into its own function, that was just laziness haha
<yottabyte>
I should've*
<beach>
yottabyte: Anyway, that should give you some work for a while. Perhaps you can resubmit after those improvements.
<yottabyte>
for sure, I took down all of your notes and I will address them beach. thanks
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jrx has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.1.50)]
NotThatRPG has joined #commonlisp
_whitelogger has joined #commonlisp
JamesF has quit [Ping timeout: 245 seconds]
JamesF has joined #commonlisp
azimut has quit [Ping timeout: 240 seconds]
chomwitt has joined #commonlisp
JamesF has quit [Ping timeout: 252 seconds]
JamesF has joined #commonlisp
pfdietz has quit [Quit: Client closed]
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
NotThatRPG has joined #commonlisp
zxcvz has joined #commonlisp
Grauwolf has quit [Quit: WeeChat 4.1.1]
pfdietz has joined #commonlisp
notzmv has quit [Ping timeout: 260 seconds]
dnhester26 has quit [Remote host closed the connection]
Grauwolf has joined #commonlisp
waleee has quit [Ping timeout: 256 seconds]
jmdaemon has quit [Ping timeout: 255 seconds]
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
azimut has joined #commonlisp
JamesF has quit [Ping timeout: 268 seconds]
JamesF has joined #commonlisp
attila_lendvai has joined #commonlisp
NotThatRPG has joined #commonlisp
JamesF has quit [Ping timeout: 240 seconds]
JamesF has joined #commonlisp
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dnhester26 has joined #commonlisp
JamesF has quit [Ping timeout: 240 seconds]
JamesF has joined #commonlisp
fiveop has joined #commonlisp
fiveop is now known as fiveop-web
JamesF has quit [Ping timeout: 260 seconds]
JamesF has joined #commonlisp
dcb has joined #commonlisp
Guest63 has joined #commonlisp
mgl has quit [Ping timeout: 246 seconds]
skeemer has quit [Ping timeout: 246 seconds]
luis has quit [Ping timeout: 256 seconds]
JamesF has quit [Ping timeout: 268 seconds]
JamesF has joined #commonlisp
JamesF has quit [Ping timeout: 255 seconds]
seveno4 has quit [Quit: Leaving]
NotThatRPG has joined #commonlisp
skeemer has joined #commonlisp
waleee has joined #commonlisp
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tyson2 has quit [Remote host closed the connection]
xlymian has joined #commonlisp
zxcvz has quit [Quit: zxcvz]
Guest63 has quit [Quit: Ping timeout (120 seconds)]
<yottabyte>
oh interesting... so should I change my for ... = ... to with ... = ...?
<yottabyte>
oh, I think I still need the for ... = ... for things that are in my iterable, but yeah, the with is nice for the outer lets
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<aeth>
right... for iterates, with stays constant unless you SETF it
<yottabyte>
it looks strange because for ... = ... I'm not iterating, I just need this set for each iteration. but I guess I can read it like that and then it's not so strange
NotThatRPG has joined #commonlisp
<fourier>
"loop with a = x" is essentially the same as "let ((a x)) (loop ...". Just saves you an indentation :)