rgrau has quit [Ping timeout: 256 seconds]
rgrau has joined #picolisp
orivej has joined #picolisp
aw- has joined #picolisp
stultulo has joined #picolisp
f8l has quit [Ping timeout: 248 seconds]
stultulo is now known as f8l
f8l has quit [Ping timeout: 265 seconds]
stultulo has joined #picolisp
stultulo is now known as f8l
f8l has quit [Ping timeout: 248 seconds]
f8l has joined #picolisp
f8l has quit [Ping timeout: 240 seconds]
f8l has joined #picolisp
orivej has quit [Ping timeout: 240 seconds]
orivej has joined #picolisp
aw- has quit [Quit: Leaving.]
orivej has quit [Read error: Connection reset by peer]
<
Regenaxer>
t4nkf33der, the pattern yesterday can also be used in coroutines:
<
Regenaxer>
(de permute (N)
<
Regenaxer>
(co 'permute
<
Regenaxer>
(let (Lst (range 1 N) L Lst)
<
Regenaxer>
(recur (L)
<
Regenaxer>
(if (cdr L)
<
Regenaxer>
(do (length L)
<
Regenaxer>
(recurse (cdr L))
<
Regenaxer>
(rot L) )
<
Regenaxer>
(yield Lst) ) ) ) ) )
<
Regenaxer>
(do 3 (println (permute 12)))
<
Regenaxer>
(co 'permute) # Stop coroutine
<
Regenaxer>
I still think this is the most efficient way to do permutations
<
Regenaxer>
as it does no consing
<
Regenaxer>
It rotates (destructively) the sublists
<
t4nkf33der>
but aw need perm with repetition
<
t4nkf33der>
(perm 3 (range 1 5))
<
Regenaxer>
ok, I did not check that specific task
<
Regenaxer>
But should be possible in the same way
<
t4nkf33der>
10:52 <aw-> (de permrep (N Lst) ... where N = 3 and (length Lst) = 256 ... (256^3)
<
Regenaxer>
yes, and I did that rosetta task, but I don't remember the details
<
Regenaxer>
Can't 'samples' be used for "n elements drawn from choice of k"?
<
t4nkf33der>
no one knows how it works and you too.
<
t4nkf33der>
? (samples 3 (range 1 5))
<
t4nkf33der>
-> (3 4 5)
<
Regenaxer>
Isn't that "n elements drawn from choice of k"? (Sorry, did not read the task details now ;)
jibanes has quit [Ping timeout: 256 seconds]
jibanes has joined #picolisp
jibanes has quit [Ping timeout: 240 seconds]
jibanes has joined #picolisp
orivej has joined #picolisp
orivej_ has joined #picolisp
orivej has quit [Ping timeout: 264 seconds]
t4nkf33der has quit []
t4nkf33der has joined #picolisp
libertas has joined #picolisp
orivej_ has quit [Ping timeout: 256 seconds]
alexshendi has joined #picolisp
Regenaxer has quit [Ping timeout: 276 seconds]
jibanes has quit [Ping timeout: 256 seconds]
jibanes has joined #picolisp
alexshendi has quit [Ping timeout: 256 seconds]
rob_w has joined #picolisp
Regenaxer has joined #picolisp
orivej has joined #picolisp
akkad has quit [Excess Flood]
yumaikas is now known as yumaikas|away
akkad has joined #picolisp
alexshendi has joined #picolisp
rob_w has quit [Read error: Connection reset by peer]
alexshendi has quit [Read error: Connection reset by peer]
orivej has quit [Ping timeout: 248 seconds]
Regenaxer has quit [Ping timeout: 240 seconds]
yumaikas|away is now known as yumaikas