Perl 6 - the future is here, just unevenly distributed

IRC log for #rosettacode, 2011-06-04

| Channels | #rosettacode index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:49 kpreid joined #rosettacode
00:50 eel joined #rosettacode
01:32 eel left #rosettacode
01:33 kpreid left #rosettacode
02:25 kpreid joined #rosettacode
02:26 eel joined #rosettacode
02:33 kpreid left #rosettacode
02:33 kpreid joined #rosettacode
02:59 eel left #rosettacode
03:00 kpreid left #rosettacode
03:02 kpreid joined #rosettacode
03:03 kpreid_ joined #rosettacode
03:07 kpreid left #rosettacode
03:07 kpreid_ is now known as kpreid
05:15 axisys joined #rosettacode
05:22 kpreid left #rosettacode
06:53 r4m joined #rosettacode
08:06 MigoMipo joined #rosettacode
08:24 r4m left #rosettacode
09:12 MigoMipo left #rosettacode
11:00 kpreid joined #rosettacode
11:45 MigoMipo joined #rosettacode
16:09 axisys left #rosettacode
16:10 axisys joined #rosettacode
17:06 mwn3d_phone left #rosettacode
17:07 mwn3d_phone joined #rosettacode
17:55 dagnyscott1 left #rosettacode
19:26 soniakeys joined #rosettacode
19:30 mikemol I know Python and Perl 6 are capable of some similar things in terms of lazy lists.
19:30 mikemol I have some questions on the specifics, though.
19:31 mikemol First, in Perl 6, you have the ability to say my @list := some_func_which_always_returns_a_value;
19:32 mikemol I know Python has the concept of generators, but I don't know that that's demonstrated anywhere on RC.
19:32 mikemol I can see how that would work for infinite series, but what about finite series?
19:33 mikemol In those languages, how would one take mechanisms like those and return a dynamically-generated, finite list?
19:33 soniakeys a search for yield turns up a few python programs
19:34 mikemol So if I have a method which uses 'yield' to provide a return, how do make that method the object of a foreach? Also, how do I have that case signal the end of a sequence?
19:37 soniakeys i don't remember my python so well.  looking...
19:39 Hypftier In C# you can use yield break to stop emitting things (thereby ending the sequence) and if you use yield return and yield break to build an iterator then the end is implied by letting control flow outside of that. Could be similar in Python.
19:39 soniakeys there's this __iter__() thing
19:40 mikemol Hypftier: I was wondering about that.
19:40 mikemol Exploring the code from [[List comprehensions]]
19:40 fedaykin http://rosettacode.org/wiki/List_comprehensions
19:40 mikemol http://codepad.org/vrTgKUmq
19:41 fedaykin "Python code - 3 lines - codepad"
19:41 soniakeys raise StopIteration  that's it
19:43 Hypftier [List_comprehensions#Iterator] is wrong, right? Given that it violates the second criterion, i.e. no nested loops.
19:43 Hypftier [[List_comprehensions#Iterator]]
19:43 fedaykin http://rosettacode.org/wiki/List_comprehensions#Iterator
19:46 mikemol 'raise' is Python's means of throwing an exception?
19:46 Hypftier *nods*
19:50 TimToady for Perl6's gather/take, you just return out of the gather any which way you like
19:57 mikemol Ok, the upload spam is getting ridiculous.
19:59 sorear leaving via CORE::exit probably won't help though.
20:02 mikemol Ok, hopefully that will fix it.
20:03 mikemol In LocalSettings.php, I had: $wgFileExtensions = array_diff(array('jpg'), $wgFileExtensions);
20:03 mikemol That was supposed to remove 'jpg' from $wgFileExtensions. Unfortunately, the array_diff returned array(). Switching the order of the arguments fixed that.
20:08 sorear hmm
20:09 sorear niecza: my @list := gather { take 1; goto "OUT" }; say @list; OUT: say "out!"
20:09 p6eval niecza v6-56-g84360d1: OUTPUT«Unhandled exception: Illegal control operator: goto(OUT, dynamic)␤  at /home/p6eval/niecza/lib/CORE.setting line 538 (CORE _lexotic @ 2) ␤  at /home/p6eval/niecza/lib/CORE.setting line 543 (CORE goto @ 2) ␤  at /tmp/dpUEZ3S0Qq line 1 (MAIN C1_ANON @ 2) ␤  at
20:09 p6eval ../home/p6eval/niecza/lib…
20:11 sorear niecza: my @list; try { @list := gather { die "pie" } }; say "out"; ?@list; take 2
20:11 p6eval niecza v6-56-g84360d1: OUTPUT«out␤Unhandled exception: pie␤  at /home/p6eval/niecza/lib/CORE.setting line 513 (CORE die @ 2) ␤  at /tmp/oOjjcjJn0e line 1 (MAIN C2_ANON @ 1) ␤  at /home/p6eval/niecza/lib/CORE.setting line 913 (CORE GatherIterator.reify @ 5) ␤  at  line 0 (ExitRunloop @ 0) ␤  at
20:11 p6eval ../tmp/oOjjcjJn0e l…
20:50 mwn3d_phone left #rosettacode
21:00 BenBE left #rosettacode
21:20 mwn3d_phone joined #rosettacode
21:29 dagnyscott joined #rosettacode
21:35 BenBE joined #rosettacode
21:41 MigoMipo left #rosettacode
22:08 mwn3d_phone1 joined #rosettacode
22:12 mwn3d_phone left #rosettacode
22:21 mwn3d_phone1 is now known as mwn3d_phone
22:45 soniakeys left #rosettacode
23:06 Coderjoe_ joined #rosettacode
23:08 Coderjoe left #rosettacode
23:44 FireFly left #rosettacode

| Channels | #rosettacode index | Today | | Search | Google Search | Plain-Text | summary