Search
Friday, 21st of July 2017, 22:22:01 UTC
22:37:59
quotation
pjb: I'm entirely for deprecating the entirety of the english language if not wholly extending it further into a "special" dialect accompanying the flavors of homoiconicity
22:49:13
slark
hello can someone explain why it works ? http://paste.lisp.org/display/351376
22:49:47
Bike
i uh, would not expect that to work.
22:50:00
slark
when i pass a variable to the macro it fails, but it works with a number can't really understand why it works
22:51:00
Bike
okay so you did everything wrong in such a way that it appears to work.
22:51:08
slark
Bike: well i know the macro def should be (list 'setq var (list '- var amount))) but well was just trying to mess a bit
22:51:22
Bike
right, so since you didn't do that, the macro /expander/ is what does the setq
22:51:48
Bike
and it sets var (not the symbol passed to the macro, var, every time) to (+ var amount)
22:52:02
Bike
and then returns that as the macroexpansion, because that's what setq returns.
22:52:43
slark
so it set the variable with the name "var"
22:53:12
Bike
because it's just a normal setq.
22:56:44
slark
Bike: .. macro is hard ;;
22:58:22
pjb
slark: it sets the variable named VAR in the compilation environment!
22:58:38
slark
pjb: yeah i finally understood it
22:58:48
pjb
Since this variable has not been declared (in the compilation environment) the actual behavior is actually implementation dependent.
22:59:04
Bike
pjb: it's a parameter to the macro function
23:00:15
slark
well in fact was thinking why should i return an expression to inc a variable when the inc could be done at expansion time
23:01:09
pjb
Because expansion time is normally done at compilation time, long before the values of the arguments are known.
2:07:58
warweasle1
** NICK warweasle
5:11:56
beach
Good morning everyone!
10:13:32
axion
I'm looking for help in a basic task I'm trying to do as efficiently as I can.
10:14:43
axion
http://paste.lisp.org/display/351414
10:16:46
|3b|
ACTION would just sort list then split result
10:18:46
phoe
sort list then destructively split it
10:19:27
axion
Is there a common 'split' function or should I look to build one?
10:19:30
phoe
or alternatingly push into two accumulator lists, then nreverse them
10:19:37
phoe
axion: that's a good question
10:19:41
|3b|
ACTION probably wouldn't even bother with destructive split
10:20:06
phoe
|3b|: he wants efficience, I think destructive splitting of conses is going to be as efficient as he can get it
10:20:16
phoe
performance- and consing-wise
10:20:38
|3b|
yeah, i was including programmer efficieny as well :)
10:20:46
axion
How would you efficiently split a list?
10:21:08
phoe
if you want programmer effiicience, alternatingly push into two lists, then nreverse them
10:21:20
phoe
if you want fastest possible code, I think I have a possible algorithm in my mind
10:21:39
|3b|
(loop for (a b) on (sort ...) by #'cddr collect a into as when b collect b into bs finally (return (list as bs)))
10:21:45
axion
Doesn't have to be 'fastest possible' but this will occur with every page load, so milliseconds count.
10:21:53
phoe
axion: how long are the lists?
10:21:57
phoe
how many elements are there?
10:21:58
jackdaniel
axion: use uiop:while-collecting (or even better - cmuutil collect macro)
Saturday, 22nd of July 2017, 10:22:01 UTC