IRC Logs for #io Friday, 2013-11-08

*** gatesphere has joined #io01:20
*** mkroehnert has quit IRC01:35
*** parched has joined #io01:58
*** nisstyre has joined #io02:00
zephyrtroniumare all symbols as defined in the grammar appendix of the io guide - identifiers, numbers, operators, and quotes - represented by the IoSymbol type?03:13
*** parched has joined #io03:32
*** nisstyre has quit IRC04:24
*** nisstyre has joined #io05:04
*** gatesphere has quit IRC05:05
prologicjer: how would you do list comp in an io like lang.07:30
prologicsomething like select/collect ala smalltalk.07:30
prologicsee http://en.wikipedia.org/wiki/List_comprehension#Smalltalk07:31
*** pchalupa has joined #io08:01
*** hashmal has joined #io09:25
*** pchalupa has quit IRC10:15
*** liquorvicar has joined #io11:49
*** liquorvicar has quit IRC11:50
*** pchalupa has joined #io11:59
*** pinupgeek has quit IRC13:05
*** pinupgeek has joined #io13:05
jerprologic, probably the same way i did it in io14:10
jerto reproduce that example at least14:11
jerRange; 1 to(100) asList select(x, x *(x) > 3) reduce(* 2)14:12
jerthe intermediate list wouldn't be required if i wasn't lazy =]14:13
jerso the way ranges work, is any object can participate in a range so long as it has a "nextInSequence" method that optionally takes one argument (the number of "next" objects to skip)14:24
jerconceptually it's like a lazilly constructed linked list in this respect14:24
jerimplementing function composition in io is a bit harder than i was hoping14:37
jercompose := method(fs, x, fsR := fs reverse; fsR reduce(a, f, getSlot("f") callWithArgList(list(a, x))))14:41
jernot quite working14:41
jerhrmm14:49
jercompose := method(fs, x, fs reverse reduce(a, f, f call(a)))14:49
jerbetter but still not working14:49
jerthat should probably be getSlot("f") call(a) actually14:50
jerah damnit i know why14:56
jerreduce() is implemented poorly14:56
jerit takes the initial value as the first item in the list instead of allowing me to specify it14:56
*** fredreichbier has joined #io15:00
jerideally i'd want to be able to define compose to be a method taking a list of methods, and an initial value, do a right fold over that list of functions, calling them with the accumulated value (starting from that initial) which is held in the 'x' variable in the method above, and then invoke the reduced function with the initial value15:03
locksaka, how reduces usually work :P15:06
jeryup15:06
*** fredreichbier_ has joined #io15:06
jerwell, this'd be a right reduce, not a left reduce... io only supports reducing left15:06
locksright15:06
jerbut same idea, different direction =]15:06
jerin scheme this'd be two lines of code15:07
jer(define ((compose fs) x) (foldr (lambda (f a) (f a)) x fs))15:08
jerthen called like: ((compose (list abs inc)) -2) == 115:09
*** fredreichbier has quit IRC15:10
jeroh well, works in haskell (ignoring . for a moment):15:17
jerPrelude> let compose = \ fs x -> foldr (\ f a -> f a) x fs15:17
jerPrelude> (compose [abs, inc]) (-2)15:17
jer115:17
jer=D15:17
jernot in io15:17
jerbut yeah... curried functions.15:18
*** pinupgeek has quit IRC15:57
*** pchalupa has quit IRC16:28
*** pchalupa has joined #io16:29
*** pchalupa has quit IRC16:30
*** hashmal has quit IRC16:42
*** OpenSpace has quit IRC17:01
*** nisstyre has quit IRC17:17
*** OpenSpace has joined #io17:18
*** OpenSpace has quit IRC17:18
*** OpenSpace has joined #io17:41
*** hashmal has joined #io18:07
*** fredreichbier_ has quit IRC18:41
*** nisstyre has joined #io22:13
*** gatesphere has joined #io23:09
*** nisstyre has quit IRC23:12
prologicjer, so basically list comps in an Io langauge would be done with select()23:16
prologicgotcha :)23:16
prologicand it's nice and readable too23:16
prologicjer, yeah I implemented my reduce function to take an optional start value23:16
prologic:)23:16
jerprologic, hopefully you implemented a reduce function which iterates from the right (end to start) not just start to end23:34
jerassuming in this case, start means left, and end means right, if we strung your collection out into a straight line23:34

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