IRC Logs for #io Saturday, 2017-02-25

*** TheMonkey has joined #io02:04
*** ElMonkey_ has quit IRC02:06
*** ElMonkey_ has joined #io05:10
*** petr_ has joined #io05:13
*** TheMonkey has quit IRC05:16
*** petr has quit IRC05:16
*** fredreichbier has joined #io11:35
*** psYchotic has joined #io15:44
psYchoticHey guys, I'm trying to do something, but I'm not quite sure how to accomplish this15:45
psYchoticI wanted to write a "cond" method, to which you pass pairs of arguments. It should loop over the pairs, and if the first element of the pair evaluates to true, return the second element of the pair. Otherwise, it'll continue with the next pair15:45
psYchoticI had something like this:15:46
psYchoticcond := method(15:46
psYchotic for(i, 0, call message arguments size - 1, 2,15:46
psYchotic  if(call evalArgAt(i) ifTrue(return call evalArgAt(i + 1)))))15:46
psYchoticwhich works fine, but I wanted to try making it recursive, instead of using a loop (for science)15:46
psYchoticthis would look something like this:15:47
psYchoticcond := method(15:47
psYchotic if(call message argCount < 2, Exception raise("cond needs pairs of arguments"))15:47
psYchotic if(call evalArgAt(0),15:47
psYchotic  call evalArgAt(1),15:47
psYchotic  call sender cond(call message arguments slice(2))))15:47
psYchoticbut, obviously, that last line won't work, as that call to cond only has a single argument15:48
psYchoticIs what I'm trying to do possible, and if so, how?15:48
*** psYchotic has quit IRC16:49
*** psYchotic has joined #io17:01
*** psYchotic has quit IRC17:11
*** psYchotic has joined #io17:42
*** psYchotic has quit IRC18:04
*** fredreichbier has quit IRC18:56

Generated by irclog2html.py 2.14.0 by Marius Gedminas - find it at mg.pov.lt!