2009 -- the year of November. <november-wiki.org> <github.com/viklund/november> <irclog.perlgeek.de/november-wiki> <nopaste.snit.ch>
Set by moderator on 27 May 2009.
03:22 ihrd joined, ihrd left 05:57 ZuLuuuuuu joined 08:33 viklund joined 11:44 mj41 joined 11:47 mj41_ joined 12:50 masak joined 14:42 lichtkind joined
masak eiro: ping 15:03
16:16 viklund joined 16:21 ZuLuuuuuu joined
eiro masak, pong 16:34
masak I got a one-liner working for the Conway sequence.
eiro \\o/
masak rakudo: my $n = 1; for ^10 { say $n; $n = $n.subst(/(\\d) $0*/, { $/.chars ~ $0 }, :g) } 16:35
p6eval rakudo 1b06df: OUTPUT«1␤11␤21␤1211␤111221␤312211␤13112221␤1113213211␤31131211131221␤13211311123113112211␤»
eiro masak, as my perl5 version, it relies on $n as a string. i definitely prefer the haskell version and guess we can do something like that in perl6 16:37
:)
masak yes, I think so.
eiro thanks for your help: i'll post this one anyway
actually: i'm tired of perl5: i try a complete switch to haskell and perl6 16:38
masak that's the spirit! 16:39
eiro well ... i saw lot of mongers telling me that perl5 is not dead ...
masak it isn't. 16:40
eiro yeah ... but even it's alive: i am bored :)
so ... i'll give the bath to the children. Cya tomorrow all 16:41
lichtkind p5 will never die 16:42
masak of course it will. 16:43
lichtkind in 100 years maybe 16:44
masak rakudo: my $n = 1; sub group(@a is copy) { return gather while @a { my $e = @a.shift; my $l = 1; while @a && @a[0] == $e { @a.shift; ++$l }; take $l; take $e } }; say group([1,1]).perl
p6eval rakudo 1b06df: OUTPUT«[2, 1]␤»
lichtkind or is magically a perfect p5-6 converter appears somehow
masak rakudo: my $n = 1; sub group(@a is copy) { return gather while @a { my $e = @a.shift; my $l = 1; while @a && @a[0] == $e { @a.shift; ++$l }; take $l; take $e } }; say group([2,1]).perl
p6eval rakudo 1b06df: OUTPUT«[1, 2, 1, 1]␤»
masak eiro: there you go. but it's hard to get it as succinct as the Haskell version. 16:45
eiro: would be an interesting exercise to translate all the Haskell functions involved (iterate, group...) to Perl 6, trying to keep as close to the originals as possible. 16:46
Rakudo doesn't have lazy lists yet, that's a limitation.
spinclad (1) the haskell version is quite close to a string version, as a string _is_ a list of characters in haskell; it would just have to translate the length integers 1, 2, 3 to characters '1', '2', '3'; 18:33
(2) when i saw haskell use group without having to define it, i felt 'that's cheating', which is of course unfair. once perl 6 has some mature libraries to draw on, i expect it to be comparable. (so i second the 'interesting exercise'.) 18:43
(3) conversely to (1), itwouldbeniceif .subst and regexes applied to Lists of Anything, not just strings. something for p6l and the specs, me thinks. 18:48
23:05 ihrd joined