Camelia, the Perl 6 bug

IRC log for #november-wiki, 2009-06-21

| Channels | #november-wiki index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
03:22 ihrd joined #november-wiki
03:22 ihrd left #november-wiki
05:57 ZuLuuuuuu joined #november-wiki
08:33 viklund joined #november-wiki
11:44 mj41 joined #november-wiki
11:47 mj41_ joined #november-wiki
12:50 masak joined #november-wiki
14:42 lichtkind joined #november-wiki
15:03 masak eiro: ping
16:16 viklund joined #november-wiki
16:21 ZuLuuuuuu joined #november-wiki
16:34 eiro masak, pong
16:34 masak I got a one-liner working for the Conway sequence.
16:34 eiro \o/
16:35 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␤111​3213211␤31131211131221␤13211311123113112211␤»
16:37 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 eiro :)
16:37 masak yes, I think so.
16:37 eiro thanks for your help: i'll post this one anyway
16:38 eiro actually: i'm tired of perl5: i try a complete switch to haskell and perl6
16:39 masak that's the spirit!
16:39 eiro well ... i saw lot of mongers telling me that perl5 is not dead ...
16:40 masak it isn't.
16:40 eiro yeah ... but even it's alive: i am bored :)
16:41 eiro so ... i'll give the bath to the children. Cya tomorrow all
16:42 lichtkind p5 will never die
16:43 masak of course it will.
16:44 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
16:44 p6eval rakudo 1b06df: OUTPUT«[2, 1]␤»
16:44 lichtkind or is magically a perfect p5-6 converter appears somehow
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([2,1]).perl
16:44 p6eval rakudo 1b06df: OUTPUT«[1, 2, 1, 1]␤»
16:45 masak eiro: there you go. but it's hard to get it as succinct as the Haskell version.
16:46 masak 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 masak Rakudo doesn't have lazy lists yet, that's a limitation.
18:33 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:43 spinclad (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:48 spinclad (3) conversely to (1), itwouldbeniceif .subst and regexes applied to Lists of Anything, not just strings.  something for p6l and the specs, me thinks.
23:05 ihrd joined #november-wiki

| Channels | #november-wiki index | Today | | Search | Google Search | Plain-Text | summary