#perl - Tue 6 Mar 2007 between 02:55 and 03:11



GumbyBRAINI say give it some time, maybe it's just a cancer on my machine.
somiandammit. I am going to have to read the src to solve this annoyance.
Jmax-i hate doing that
i'm doing that right now with POE::Wheel::ReadLine :\
carsonhow do i pass a EXPR (anonymous sub?) to a function?
i want to write a sub like map
Woostafoo( sub{ do this } )
carsonso i can do sum_from_1_to_5 { $i * $i } or whatever
somianYou use "prototypes", carson
carsonwhy don't i have to do do sub{..} with map? is it special?
Woostawhuh?
yes, map is special
carsonk.
somiancarson: here's how
sub mywacky (&) { stuff ... }
You will want a "prototype" of (&@) actually, IIRC
That's all in the Camel btw, buy it, read it, cherish it.
WoostaYou don't need the prototype though ..
somianWoosta?
Woostaeval: with_1_to_5( sub{ print $_ } ); sub with_1_to_5{ for( 1 .. 5){ $_[0]->($_) } }
buubotWoosta: 1 2 3 4 5
somianThat's not what the op ask ed for, tho.
Woosta[17:59] <carson> how do i pass a EXPR (anonymous sub?) to a function?
carsoni basically just want to do whatever map does.
let me experiment for a sec.
somianmap { stuff } @list
carsonbut not on a list. :-)
somianThere's no "sub" there.
You don't need to experiment, you just need to buy the Camel and read it.
WoostaAhh .. so you don't really want an anonymous sub .. you want it to evaluate {} as an anonyfunc rather than a hashref ..
carsonyeah i don't want a hash.
crayolarxmmmm...hash
actionsomian taps the mic ... hmm, is this thing on?
somiantaps the mic ... hmm, is this thing on?
crayolarxyes it is
WoostaSetting the prototype doesn't fix that though
somianI think carson has me on /ign
His loss, {shrug}
carsoni'm just doing an integration.. i want to do a: sumOnAtoB sub { f($_) * $width };
somian, no i hear you. i don't understand the &@ thing though.
WoostaSo .. how did my from_1_to_5 not answer that?

Page: 2 9 16 23 30 37 44 51 58 65 72 79 86 93 100 

IrcArchive