<no-defun-allowed>
Well, there's no requirement for tail recursion to work in CL.
<joinr>
if I invoke that with (f 0 1 2 3 4 5 6) on either sbcl or clisp
<joinr>
I get a infinite recursion.
<joinr>
tail or no
<no-defun-allowed>
Or do you mean that it never returns?
<joinr>
expectation is that the null condition will be met eventually and computation stops. Instead, you get Nil printing out
uplime has left #lisp ["/me scurries away"]
<joinr>
expectation for the input would be, printing the numbers 0 to 6 then return
<joinr>
this is a small reproducible case for a larger metprogramming deal. I thought labels would work fine (and it does) seemingly as long as you don't go into &rest arg territory and try to apply.
<Bike>
you have (aux (first xs) (rest xs))
<Bike>
so you're always calling aux with two arguments
<Bike>
so xs is never null
<joinr>
ah...
<joinr>
so I need to apply within the body?
<Bike>
you meant (apply #'aux (first xs) (rest xs)), probably
<no-defun-allowed>
Is there a -- oh, yeah, that's probably important.
omarish has joined #lisp
<joinr>
beautiful, thanks for the eyes.
<Bike>
or just (apply #'aux xs) i guess
<no-defun-allowed>
I'm not sure if you intend for this to happen, but (f 0) will print nothing.
<Bike>
yeah it drops the last value
<Bike>
dunno why so i'm gonna leave it as an exercise to ze reader
<joinr>
this is more of a toy problem, the exact behavior isn't as interesting though.
<Bike>
oh, no, i get it
<joinr>
the non-terminating phenomena was what got me. totally forgot I'd have to apply on recurse.
<joinr>
which works
malfort has joined #lisp
lottaquestions has joined #lisp
<lottaquestions>
Hi all, is there a way of listing all the global variables in a running instance in slime?
earl-ducaine_ has quit [Ping timeout: 265 seconds]
patrixl has joined #lisp
<Bike>
Sort of. You can do (let (c) (do-all-symbols (s c) (when (boundp s) (push s c))))
<Bike>
On my system there are 5493, so be careful
<Bike>
technically there could also be variables named by inaccessible symbols, but that doesn't happen much
wiselord has quit [Ping timeout: 268 seconds]
<lottaquestions>
thanks. Worth a try
<no-defun-allowed>
(do-symbols (s) (when (and (boundp s) (eql (symbol-package s) package)) (print s))) will print all the symbols that are bound in the current package, which isn't all of them, but might be what you want.
Dibejzer has joined #lisp
Dibejzer has quit [Client Quit]
omarish has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
omarish has joined #lisp
omarish has quit [Client Quit]
buffergn0me has joined #lisp
sjl has quit [Ping timeout: 276 seconds]
dan64 has quit [Ping timeout: 276 seconds]
enrioog has joined #lisp
enrio has quit [Ping timeout: 268 seconds]
shifty has joined #lisp
wiselord has joined #lisp
elfmacs has quit [Ping timeout: 252 seconds]
slyrus_ has joined #lisp
slyrus has quit [Ping timeout: 268 seconds]
gravicappa has joined #lisp
lottaquestions has quit [Remote host closed the connection]
joinr has quit [Ping timeout: 260 seconds]
Bike has quit [Quit: Lost terminal]
ggole has joined #lisp
libertyprime has joined #lisp
slyrus_ has quit [Ping timeout: 240 seconds]
vaporatorius has quit [Ping timeout: 268 seconds]
zaquest has quit [Quit: Leaving]
enrioog has quit [Ping timeout: 276 seconds]
vaporatorius has joined #lisp
efm has quit [Remote host closed the connection]
efm has joined #lisp
wiselord has quit [Ping timeout: 240 seconds]
vaporatorius has quit [Read error: Connection reset by peer]
<beach>
Good morning everyone!
malfort_ has joined #lisp
malfort has quit [Ping timeout: 252 seconds]
torbo has quit [Remote host closed the connection]
dddddd has quit [Ping timeout: 250 seconds]
ebzzry has quit [Ping timeout: 265 seconds]
xkapastel has joined #lisp
toorevitimirp has joined #lisp
Inline__ has quit [Quit: Leaving]
nullniverse has quit [Ping timeout: 268 seconds]
saravia has joined #lisp
wiselord has joined #lisp
nullniverse has joined #lisp
sauvin has joined #lisp
elfmacs has joined #lisp
<beach>
jackdaniel: Thanks for the link to Graham's article. He seems to put his finger on something important.
Bourne has joined #lisp
vlatkoB has joined #lisp
wiselord has quit [Read error: Connection reset by peer]
wiselord has joined #lisp
libertyprime has quit [Read error: Connection reset by peer]
brown121408 has quit [Ping timeout: 245 seconds]
brown121408 has joined #lisp
slyrus has joined #lisp
toorevitimirp has quit [Remote host closed the connection]
<boeg>
beach: mornings!
orivej has joined #lisp
<boeg>
second day with sick kid at home, keeping me up all night. Think I'm gonna see if I can optimize on my advent of code adventure from yesterday
Duuqnd has quit [Ping timeout: 246 seconds]
varjag has joined #lisp
<beach>
Sounds good.
elfmacs has quit [Ping timeout: 265 seconds]
dale has quit [Quit: My computer has gone to sleep]
malfort_ has quit [Ping timeout: 240 seconds]
elfmacs has joined #lisp
saravia has quit [Remote host closed the connection]
Cymew has quit [Ping timeout: 245 seconds]
scymtym has quit [Ping timeout: 265 seconds]
JohnMS_WORK has joined #lisp
Cymew has joined #lisp
Cymew has quit [Read error: Connection reset by peer]
Cymew has joined #lisp
vaporatorius has joined #lisp
vaporatorius has quit [Changing host]
vaporatorius has joined #lisp
elfmacs has quit [Ping timeout: 268 seconds]
Lycurgus has joined #lisp
wiselord has quit [Ping timeout: 268 seconds]
elfmacs has joined #lisp
Duuqnd has joined #lisp
Davd33 has joined #lisp
Davd33 has quit [Remote host closed the connection]
frgo has quit [Ping timeout: 240 seconds]
thonkpod has quit [Ping timeout: 245 seconds]
thonkpod has joined #lisp
<boeg>
Is there a built in like `intersection` for lists, but for hash tables?
<boeg>
testing for the key being in both hash tables, not the content
xkapastel has quit [Quit: Connection closed for inactivity]
<phoe>
no idea if that's been done, #ecl might know
enrio has joined #lisp
bendersteed has quit [Remote host closed the connection]
bendersteed has joined #lisp
bendersteed has quit [Remote host closed the connection]
frgo has quit [Remote host closed the connection]
quazimodo has quit [Read error: Connection reset by peer]
hhdave has joined #lisp
buffergn0me has joined #lisp
buffergn0me has quit [Read error: Connection reset by peer]
mathrick has quit [Ping timeout: 268 seconds]
quazimodo has joined #lisp
quazimodo has quit [Read error: Connection reset by peer]
frgo has joined #lisp
quazimodo has joined #lisp
quazimodo has quit [Read error: Connection reset by peer]
dkrm has quit [Quit: WeeChat 2.5]
lavaflow has joined #lisp
frgo_ has joined #lisp
frgo has quit [Ping timeout: 240 seconds]
frgo_ has quit [Read error: Connection reset by peer]
frgo has joined #lisp
quazimodo has joined #lisp
Davd33 has joined #lisp
quazimodo has quit [Read error: Connection reset by peer]
frgo has quit [Ping timeout: 250 seconds]
Davd33 has quit [Remote host closed the connection]
dkrm has joined #lisp
gxt has quit [Remote host closed the connection]
jonatack has joined #lisp
gxt has joined #lisp
quazimodo has joined #lisp
Davd33 has joined #lisp
quazimodo has quit [Read error: Connection reset by peer]
<boeg>
if I have a hash table `hash-t` and two variables `key-a` and `key-b` bound to `(cons 1 0)` and I do `setf (gethash key-a hash-t) 1)` why can't I do `(gethash key-b hash-t)` to access the value stored at `key-a`? My guess is that the key where I stored the `1` is a reference to the `key-a` variable, and so even though `key-b` contains a similar looking cons, it's not the same, so it doesn't work, but how do I make it work?
quazimodo has joined #lisp
jonatack_ has joined #lisp
<no-defun-allowed>
EQ and EQL will not work, and EQUAL and EQUALP will.
bendersteed has joined #lisp
<boeg>
right, maybe I should check again, because I blindly tried telling gethash to use equal with `:test #'equal` but it didn't work and I just ... yeah, take a look at the documentation again :)
jonatack has quit [Ping timeout: 268 seconds]
<no-defun-allowed>
Yeah, the tests have to be provided in MAKE-HASH-TABLE.
<boeg>
no-defun-allowed: oh, alright, thanks
makomo has quit [Ping timeout: 250 seconds]
grabarz has joined #lisp
Davd33 has quit [Remote host closed the connection]
<boeg>
pjb: indeed - problem was I hadn't configured the hash-table to use it
<boeg>
pjb: it's working and my advent of code is now speedy
<boeg>
went from maybe 5+ minutes to sub zero second
pilne has quit [Quit: Light travels faster then sound, which is why some people appear bright, until you hear them speak]
<pjb>
Good.
xkapastel has quit [Quit: Connection closed for inactivity]
<boeg>
yes i feel like advent of code is a good way to learn a language for me
elfmacs has quit [Ping timeout: 276 seconds]
<boeg>
It throws you around in corners you wouldn't have thought of yourself. I have been reading practical common lisp and land of lisp a bit, but there's nothing like real experience, even though advent of code is taking me soo much longer compared to if I was doing it in a language I know better
elfmacs has joined #lisp
gxt has quit [Remote host closed the connection]
gxt has joined #lisp
Guest75462 has quit [Read error: Connection reset by peer]
Guest75462 has joined #lisp
Kevslinger has quit [Quit: Connection closed for inactivity]
amerigo has quit [Quit: Connection closed for inactivity]
<no-defun-allowed>
Morning heisig
kritixilithos has joined #lisp
<no-defun-allowed>
Should I start doing those kind of problem sets? Usually I find approaching whatever comes to mind more enjoyable, but I've heard several times that usually those tend to not be unfamiliar or difficult.
m00natic has joined #lisp
smokeink has joined #lisp
nullniverse has quit [Remote host closed the connection]
ljavorsk has joined #lisp
cosimone has joined #lisp
mathrick has joined #lisp
<jackdaniel>
beach: sure
jeosol has quit [Remote host closed the connection]
pfdietz has quit [Remote host closed the connection]
harold6841 has joined #lisp
harold6841 has quit [Remote host closed the connection]
brown121408 has quit [Read error: Connection reset by peer]
brown121408 has joined #lisp
ebrasca has quit [Remote host closed the connection]
_whitelogger has joined #lisp
akoana has joined #lisp
earl-ducaine has quit [Ping timeout: 268 seconds]
cosimone has quit [Quit: Quit.]
cosimone has joined #lisp
JohnMS has joined #lisp
JohnMS_WORK has quit [Ping timeout: 265 seconds]
earl-ducaine has joined #lisp
mathrick has quit [Read error: Connection timed out]
mathrick has joined #lisp
cosimone has quit [Quit: Quit.]
<boeg>
So whats a good source for how to set up a common lisp project? Right now I just create .lisp files and manually use quickload to load dependencies - well, dependency, I have only used a single library yet, split-sequence :P - but I was thinking if theres a good source to create a project for my advent of code project where I can have it handle bringing in split-sequence and so on
<pjb>
create an asd file and quickload it!
<earl-ducaine>
boeg: are you using quicklisp?
<boeg>
yes, I have been using quickload, earl-ducaine
<earl-ducaine>
boeg: You'll find all the sources of the projects that used at: quicklisp/dists/quicklisp/software/
<boeg>
pjb: ill check that out
<earl-ducaine>
boeg: each one will have at least one *.asdf so you'll have a bunch of examples of how to write them.
<boeg>
_death: thanks, ill check it out
bitmapper has joined #lisp
<boeg>
earl-ducaine: alright, thanks!
enrio has quit [Read error: Connection reset by peer]
<earl-ducaine>
boeg: ASDF has a comprehensive manual, so you should get that. But a warning, it's quite terse.
enrio has joined #lisp
<boeg>
earl-ducaine: I'm checking out the stevelosh article right now, and then I'll see afterwards if i'm still missing things :)
<earl-ducaine>
boeg: It has few examples and for stupid people like myself it can be frusterating to use on its own.
Davd33 has joined #lisp
JohnMS has quit [Read error: Connection reset by peer]
mathrick has quit [Quit: Leaving]
<earl-ducaine>
boeg: one thing that you'll find quite convenient once you have your ASDF project set up is creating a symbolic filesystem link to it at: quicklisp/local-projects/
JohnMS has joined #lisp
mathrick has joined #lisp
<earl-ducaine>
boeg: Then you'll be able to load it using quicklisp! e.g. (ql:quickload :my-new-project)
<boeg>
earl-ducaine: interesting, thanks!
<boeg>
ill see if I can figure it out :P
Davd33 has quit [Remote host closed the connection]
lucasb has joined #lisp
Davd33 has joined #lisp
jfb4 has joined #lisp
frgo has quit [Remote host closed the connection]
jfb4_ has quit [Ping timeout: 246 seconds]
akoana has quit [Quit: leaving]
Davd33 has quit [Remote host closed the connection]
wxie has joined #lisp
smokeink has quit [Ping timeout: 265 seconds]
sz0 has joined #lisp
mathrick has quit [Ping timeout: 268 seconds]
scymtym has quit [Remote host closed the connection]
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rustik has quit [Read error: Connection reset by peer]
rustik has joined #lisp
rustik has quit [Read error: Connection reset by peer]
<vms14>
Guys I want to rotate a list, but rotatef does not really "rotate" it just switches positions. I'm using (cons (car (last the-list))) + (remove (car (last the-list)))
<vms14>
it works, but there is a better way to do it?
rustik has joined #lisp
AnimalCl` has joined #lisp
<vms14>
I'm trying to make the snake game and the snake is just a list of points, to move the snake, I want to rotate the last item so the last part of the tail will be the head
Ven`` has joined #lisp
<Bike>
you can use butlast instead of remove.
bitmapper has quit [Remote host closed the connection]
<vms14>
ty bike <3
rustik has quit [Read error: Connection reset by peer]
<Bike>
this is not really an efficient operation to do on lists, though.
<Bike>
well you compute LAST twice, and you use REMOVE even though you only want one element removed
<oni-on-ion>
iCons
<dlowe>
vms14: construct a circular list?
<Bike>
oh, good idea
AnimalClatter has quit [Ping timeout: 265 seconds]
<vms14>
never made a circular list, I'll try, ty dlowe
bbsl has joined #lisp
<vms14>
oh I did one while looking at the land of lisp book I guess
rustik has quit [Read error: Connection reset by peer]
rustik has joined #lisp
davepdotorg has quit [Remote host closed the connection]
<vms14>
works fine
cosimone has joined #lisp
<vms14>
thanks dlowe, I guess I'll use that and just update the list every time I push a new item
clothespin has joined #lisp
<vms14>
well idk if will work or I'll have troubles while pushing stuff into a circular list
<beach>
You just have to be careful what you are doing.
<vms14>
should I save the list before making it circular? so to push stuff I can update the saved list
<dlowe>
pushing stuff onto a circular list means adding it after the head
rgherdt has quit [Ping timeout: 250 seconds]
<beach>
So you can use (push ... (cdr list))
<beach>
... or to some later point of course.
smazga has joined #lisp
rustik has quit [Read error: Connection reset by peer]
<vms14>
thanks for the advices
<vms14>
it looks much better than setf cons + remove + using last twice
<beach>
Here is another piece of advice for you: "advice" does not take a plural form. It is like a substance in English. In singular, it would be "a piece of advice". :)
<vms14>
thanks, I really need those corrections
<vms14>
people just let me kick the English dictionary and they say nothing, but this way I'll never learn
<beach>
I am glad this is your attitude.
<vms14>
I like to learn and improve
<clothespin>
beach: any progress on second climacs?
<vms14>
this is why I come here to ask stuff
EvW has quit [Ping timeout: 245 seconds]
<beach>
clothespin: Nothing substantial. I have been giving some thought to how to compute indentation, which is why I suspended development on it. But I am mostly working on SICL now.
<vms14>
pjb: I guess I'll use your approach instead of a circular list
<vms14>
I'm not sure, but I think with a circular list I'll need to save the list before being circular, or remove the last element any time I'll update it
buffergn0me has quit [Remote host closed the connection]
buffergn0me has joined #lisp
EvW1 has joined #lisp
<pjb>
vms14: walking a circular list is the fastest. What do you want to do exactly?
sauvin has quit [Read error: Connection reset by peer]
<vms14>
pjb: oh
<pjb>
vms14: alternatively, using a vector is fast too.
<vms14>
and even easier
<vms14>
I want to make the snake game
<vms14>
but the snake movement is really a bit of fake
<vms14>
instead of moving all the "points" you just make the last point of the tail be the head
<vms14>
this is why I want to rotate a list
<pjb>
Since there is a maximum snake length, you could use a vector, and too indices (head tail).
<vms14>
the snake then only moves one point, instead of the whole body
vlatkoB has quit [Remote host closed the connection]
<pjb>
s/too/two/ of course.
<pjb>
An alternate representation is to use the board itself to represent the snake.
gravicappa has quit [Ping timeout: 250 seconds]
<pjb>
A cell can contain a code to represent empty apple and the various possible snake sections. (up down) (up left) (up right) … (down left) (head up) (head down) … (tail right) (tail left).
whiteline has quit [Read error: Connection reset by peer]
whiteline has joined #lisp
<pjb>
So to find the snake you only need the head and tail coordinates, and you can know what cell to update by using the code for the from/to cells.
<vms14>
I like that, but not for the snake case
<vms14>
I really only need to check for collision with the head
<vms14>
and the snake can be just a list of points
<vms14>
well, not true that I only need to check the head
<pjb>
Obviously when we have gigabytes of RAM, nothing matters much anymore. It would be different in 1KB :-)
<vms14>
I like what you say about having everything in the board directly, so every cell has a value. I had this in mind for another game
<vms14>
but for the snake I think is even easier to have a list of points being the snake, and check those points
srji has joined #lisp
<vms14>
for moving I only need to rotate the last element so it will be the first (head) and 1+ point-x for example if it moves to the right
<vms14>
first-point-x *
<pjb>
vms14: this solution would work well for very big boards. With 5K screens, you could easily go up to (640 360) cells.
<pjb>
So instead of pre-allocating 230K cells, you would just have a list of apples, and grow a list for the snake; the user will probably fail long before reaching a 230K cell long snake.
<vms14>
xD
<vms14>
you're tempting me
<vms14>
because I wanted to do that in other game, so it would be a nice opportunity to get used to this approach
<didi>
OK, I've hacked a version of `read-until-string'. Resuming.
<pjb>
didi: haven't you not considered com.informatimago.common-lisp.cesarum.ascii:read-ascii-line ?
<pjb>
right, it's AGPL3 and you're afraid of giving your code…
<pjb>
kmeow: notice how my *print-case* is set to :downcase. So using format ~A would generate "iac" instead of "IAC". Using string or symbol-name is better if you want to have a consistent case.
<pjb>
kmeow: or you can use ~(~A~) or ~:@(~A~).
<pjb>
kmeow: nirved solution computes the string at run-time. This might be not what you want.
ebrasca has joined #lisp
scymtym has joined #lisp
bitmapper has joined #lisp
mathrick__ has joined #lisp
mathrick_ has quit [Ping timeout: 265 seconds]
mathrick__ has quit [Ping timeout: 240 seconds]
mathrick__ has joined #lisp
madmonkey has quit [Remote host closed the connection]
<_death>
an aggregate-struct-slot has a count, but the methods defined for it take no notice (and foreign-struct-slot-value errors with missing method for translate-aggregate-to-foreign when I trying to use)
davepdotorg has joined #lisp
ineiros has joined #lisp
<phoe>
_death: it seems that slot-count is only assigned during the creation of the object.
<phoe>
L604 of that file.
<nirved>
_death: looks like it's used with libffi
<_death>
yes.. there is another reference in cffi-libffi (which I'm using)
davepdotorg has quit [Ping timeout: 276 seconds]
amerlyq has quit [Quit: amerlyq]
kotrcka has joined #lisp
<_death>
but given (defcstruct foo (a :int :count 4)) and (defcfun bar :void (foo (:struct foo))), C function void bar(struct foo foo);, a call like (bar (list 'a '(1 2 3 4))) will result in the error I mentioned
Bourne has quit [Remote host closed the connection]
<_death>
I could get around it just munging the memory myself.. but it seems like a cffi bug
kotrcka has left #lisp [#lisp]
<Bike>
Shinmera: do you actually use extensible sequences? i'm looking for examples of users but github search is as shit as always
buffergn0me has quit [Ping timeout: 245 seconds]
<Shinmera>
I have a use for it in Trial
<Shinmera>
But nothing else because it's not very widely supported yet.
<Shinmera>
I would like to add support for it in FOR and Flare
<Shinmera>
is probably why it's not unrolled automatically
<Shinmera>
In any case it's too late and my brain is fried, so I don't think I have any useful input on this.
<Bike>
that's fine, the example is already helpful
<Bike>
there are two different efficiency concerns - this map unrolling biznis, but also the sequence might have some specific ability to be more efficient. if the protocol is such that sequence:map HAS to be called, you only get the latter. if not, only the former
gabiruh has quit [Quit: ZNC - 1.6.0 - http://znc.in]
gabiruh has joined #lisp
clothespin has joined #lisp
LiamH has quit [Quit: Leaving.]
buffergn0me has joined #lisp
<Bike>
seeing systems t hat define sequence methods beyond the core and iteration protocol would be interesting. if anyone happens to know any. if they even exist
rgherdt has quit [Quit: Leaving]
<jasom>
Does CFFI have a type for a function pointer, or does it just assume that function pointers and data pointers are compatible?
varjag has quit [Ping timeout: 276 seconds]
<fe[nl]ix>
the latter
mathrick__ has quit [Ping timeout: 276 seconds]
asarch has joined #lisp
krisfris has quit [Ping timeout: 246 seconds]
mathrick__ has joined #lisp
<_death>
seems I got it working.. (bar (list 'a '(1 2 3 4))) => (A (4 3 2 1)) (with bar returning a foo with reversed array contents)
vms14 has quit [Remote host closed the connection]
<_death>
I see some cffi tests failing, but it seems some unmodified cffi tests are failing as well
sahara3 has joined #lisp
<sahara3>
:-/
ebrasca has quit [Remote host closed the connection]