Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2012-12-24

Perl 6 | Reference Documentation | Rakudo

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

All times shown according to UTC.

Time Nick Message
00:02 skids r: my @permuted = [^5], { [ (1,3,2,4,0)[$_[]] ] } ... *[0] == 4; @permuted.perl.say; # my most interesting use of ... so far.
00:02 p6eval rakudo c8de2e: OUTPUT«Array.new([0, 1, 2, 3, 4], [1, 3, 2, 4, 0], [3, 4, 2, 0, 1], [4, 0, 2, 1, 3])␤»
00:10 jeffreykegler joined #perl6
00:24 mj41 joined #perl6
00:58 cognominal joined #perl6
01:00 nuba joined #perl6
01:04 cognominal_ joined #perl6
01:17 anuby joined #perl6
01:28 hypolin joined #perl6
01:36 raiph joined #perl6
01:55 Abcxyz r: my $t; $_ > 5 && last or 11 % $_ or $t = 1 and last for 1..20
01:55 p6eval rakudo c8de2e: OUTPUT«[31m===[0mSORRY![31m===[0mâ�¤Undeclared routine:â�¤    or used at line 1â�¤â�¤Â»
01:55 Abcxyz What is wrong with this?
01:56 Abcxyz I can see no grammar errors from this line...
02:12 raiph o/ Abcxyz
02:13 dayangkun joined #perl6
02:18 * sorear wonders if Abcxyz is diakopter
02:18 sorear n: my $t; $_ > 5 && last or 11 % $_ or $t = 1 and last for 1..20
02:18 p6eval niecza v24-12-g8e50362: OUTPUT«[31m===[0mSORRY![31m===[0mâ�¤â�¤Undeclared routine:â�¤     'or' used at line 1â�¤â�¤Unhandled exception: Check failedâ�¤â�¤  at /home/p6eval/niecza/boot/lib/CORE.setting line 1443 (die @ 5) â�¤  at /home/p6eval/niecza/src/STD.pm6 line 1147 (P6.comp_unit @ 37) â�¤  at /home/…
02:19 raiph nr: my $t; ($_ > 5) && last or 11 % $_ or $t = 1 and last for 1..20
02:19 p6eval rakudo c8de2e: OUTPUT«[31m===[0mSORRY![31m===[0mâ�¤Undeclared routine:â�¤    or used at line 1â�¤â�¤Â»
02:19 p6eval ..niecza v24-12-g8e50362: OUTPUT«[31m===[0mSORRY![31m===[0mâ�¤â�¤Undeclared routine:â�¤     'or' used at line 1â�¤â�¤Unhandled exception: Check failedâ�¤â�¤  at /home/p6eval/niecza/boot/lib/CORE.setting line 1443 (die @ 5) â�¤  at /home/p6eval/niecza/src/STD.pm6 line 1147 (P6.comp_unit @ 37) â�¤  at /home/…
02:19 raiph nr: my $t; ($_ > 5 && last) or 11 % $_ or $t = 1 and last for 1..20
02:19 p6eval rakudo c8de2e, niecza v24-12-g8e50362:  ( no output )
02:19 sorear Abcxyz: it's not a grammar error.  it's an undeclared routine error
02:23 Abcxyz OK
02:23 Abcxyz But or is not routine
02:23 Abcxyz Should be a bug, right?
02:23 Abcxyz BTW, I am not diakopter
02:28 Abcxyz r: my @s = qw/ 123 456 789 /; say @s.join.comb
02:28 p6eval rakudo c8de2e: OUTPUT«1 2 3 4 5 6 7 8 9␤»
02:28 Abcxyz r: my @s = qw/ 123 456 789 /; say @s.join.split: ''
02:28 p6eval rakudo c8de2e: OUTPUT«1 2 3 4 5 6 7 8 9␤»
02:28 Abcxyz r: my @s = qw/ 123 456 789 /; say split '', join @s
02:28 p6eval rakudo c8de2e: OUTPUT«Nil␤»
02:29 Abcxyz What's the difference from " @s.join.split: '' ", and " split '', join @s "?
02:31 sorear Abcxyz: "last" takes an optional argument.  last or ... parses as last(or(...))
02:31 raiph r: say <a b>.join.split ' '; say split ' ', join <a b>
02:31 p6eval rakudo c8de2e: OUTPUT«[31m===[0mSORRY![31m===[0mâ�¤Two terms in a rowâ�¤at /tmp/0rJEQTnm36:1â�¤------> [32msay <a b>.join.split [33mâ��[31m' '; say split ' ', join <a b>[0mâ�¤    expecting any of:â�¤        method argumentsâ�¤        postfixâ�¤        infix or meta-infixâ�¤        infix stopperâ�¤ …
02:32 Abcxyz r: say <a b>.join.split ' ';
02:32 p6eval rakudo c8de2e: OUTPUT«[31m===[0mSORRY![31m===[0mâ�¤Two terms in a rowâ�¤at /tmp/WGVxACWq10:1â�¤------> [32msay <a b>.join.split [33mâ��[31m' ';[0mâ�¤    expecting any of:â�¤        method argumentsâ�¤        postfixâ�¤        infix or meta-infixâ�¤        infix stopperâ�¤        statement endâ�¤     …
02:32 Abcxyz r: say <a b>.join.split: ' ';
02:32 p6eval rakudo c8de2e: OUTPUT«ab␤»
02:32 Abcxyz r: say split ' ',  join <a b>
02:32 p6eval rakudo c8de2e: OUTPUT«␤»
02:34 raiph Abcxyz: did u see my recent reply on perlmonks re euler?
02:35 raiph Abcxyz: if you wish you can do private evals: /msg p6eval r: say Whatever
02:40 Abcxyz r:  my $t; $_ > 5 && last() or 11 % $_ or $t = 1 and last for 1..20
02:40 p6eval rakudo c8de2e:  ( no output )
02:40 Abcxyz r:  my $t; $_ > 5 && last or 11 % $_ or $t = 1 and last for 1..20
02:40 p6eval rakudo c8de2e: OUTPUT«[31m===[0mSORRY![31m===[0mâ�¤Undeclared routine:â�¤    or used at line 1â�¤â�¤Â»
02:40 diakopter sorear: lol
02:46 Abcxyz raiph: I've seen it.
02:46 Abcxyz Thanks.
02:46 Abcxyz Nice and succinct solution!
02:50 [Coke] sorear: (length vs. chars) argh. And I had already fixed that in 4 other places! Thank you.
02:56 hash_table joined #perl6
03:02 Abcxyz is heredoc working in Rakudo?
03:04 sorear I thin so
03:05 Abcxyz OK, then it is my own problem.
03:06 Abcxyz I couldn't make it work in my script, it always reports the next variable not to be declared.
03:19 * [Coke] gets close on t2, but the damn thing is hanging.
03:22 anuby joined #perl6
03:38 FROGGS_ joined #perl6
03:42 tcpr1347 joined #perl6
03:49 FROGGS_ joined #perl6
03:50 [Coke] r: my %l; %l<5><32>.elems.say; # why is this 1 and not 0?
03:50 p6eval rakudo c8de2e: OUTPUT«1␤»
03:52 [Coke] n: my %l; %l<5><32>.elems.say;
03:53 p6eval niecza v24-12-g8e50362: OUTPUT«1␤»
03:53 lue r: my %l; say %l.perl; say %l<5>.perl; say %l<32>.perl;
03:53 p6eval rakudo c8de2e: OUTPUT«().hash␤Any␤Any␤»
03:53 lue r: my %l; say %l.perl; say %l<5>.perl; say %l<5><32>.perl;
03:53 p6eval rakudo c8de2e: OUTPUT«().hash␤Any␤Any␤»
03:57 Abcxyz [Coke]: I think you should use %l.elems instead
03:57 Abcxyz [Coke]: %l<1>.elems is a scalar container, I guess.
04:01 Abcxyz I think the hash value should always be a scalar container, which contains "refs" to other objects.
04:04 Tabrenus joined #perl6
04:13 [Coke] r: my %l; my @a = %l<5><32>; say @a.elems;
04:13 p6eval rakudo c8de2e: OUTPUT«1␤»
04:20 mikemol joined #perl6
04:23 am0c joined #perl6
04:24 Abcxyz [Coke]: r: Nil.elems
04:24 Abcxyz r: Nil.elems
04:24 p6eval rakudo c8de2e:  ( no output )
04:24 Abcxyz r: say Nil.elems
04:24 p6eval rakudo c8de2e: OUTPUT«0␤»
04:24 Abcxyz r: say Any.elems
04:24 p6eval rakudo c8de2e: OUTPUT«1␤»
04:25 Abcxyz r: my %h; say %h<2 3 4>.elems
04:25 p6eval rakudo c8de2e: OUTPUT«3␤»
04:25 Abcxyz Hash always give the required number of elements.
04:26 Abcxyz Just that you are receiving 3 elements of undef here.
04:26 Abcxyz each element is represented by an Any object
04:27 Abcxyz which has count of 1, but is undef, and in Boolean context, evaluates to False.
04:27 Abcxyz Only Nil will give you zero element count, because Nil represents an empty list.
04:28 Abcxyz While Any represents a scalar, being undef, it is still a scalar
04:28 [Coke] makes the autoviv less than useful.
04:29 Abcxyz and it is counted as one element.
04:29 Abcxyz Why?
04:29 Abcxyz It is not autovivified, is it?
04:30 Guest1875 joined #perl6
04:31 Guest1875 haiii
04:31 barbie_kaneyo helloww
04:33 [Coke] r: my %l; @(%l<5><32>).elems.say; # this also autovivs to a single element list of Any.
04:33 p6eval rakudo c8de2e: OUTPUT«1␤»
04:39 raiph goodnight all
04:39 Abcxyz Good night
04:40 Abcxyz But Any means undef in Perl6
04:40 Abcxyz Is this still considered as autovivification?
04:46 kaleem joined #perl6
04:51 [Coke] (I misspoke, not a 1 elem list, but Any.elems == 1)
04:52 thou joined #perl6
04:52 Abcxyz %l.elems still equals 0
04:53 Abcxyz Any.elems == 1 is always true
04:54 kaleem_ joined #perl6
05:09 Abcxyz left #perl6
05:12 cognominal joined #perl6
05:25 cognominal_ joined #perl6
05:30 kaleem joined #perl6
05:48 kaleem joined #perl6
05:54 kaleem joined #perl6
05:54 kaleem joined #perl6
06:29 birdwindupbird joined #perl6
06:32 [Coke] rakudo's .lines doesn't seem to be very lazy. (takes 18s to get to the die in  "for $fh.lines -> $line { die "done" }" where $fh is a file with 235886 lines.
06:33 diakopter ...
06:33 [Coke] ***
06:34 diakopter what has that many l~nes
06:35 diakopter perl6 cant handle substantial input yet
06:35 [Coke] Hacking on p6cc2012
06:36 diakopter I'll haiku you
06:39 [Coke] if I keep the lexicon down to about 2500 words, it's not horrible.
06:43 [Coke] ... aaahhha, just found a great lexicon.
06:43 SamuraiJack joined #perl6
06:44 quester joined #perl6
06:50 Khisanth joined #perl6
06:57 quester left #perl6
07:00 noggle joined #perl6
07:16 cognominal joined #perl6
07:38 xinming joined #perl6
07:41 [Coke] rn: say so "soüth" ~~ /:m 'south' /;
07:41 p6eval rakudo c8de2e: OUTPUT«[31m===[0mSORRY![31m===[0m�Unrecognized regex modifier :m�at /tmp/pZGoLiUtru:1�------> [32msay so "soüth" ~~ /:m[33m�[31m 'south' /;[0m�»
07:41 p6eval ..niecza v24-12-g8e50362: OUTPUT«[31m===[0mSORRY![31m===[0mâ�¤â�¤Action method mod_internal:sym<:m> not yet implemented at /tmp/QefPPJlpt3 line 1:â�¤------> [32msay so "soüth" ~~ /:m[33mâ��[31m 'south' /;[0mâ�¤â�¤Unhandled exception: Check failedâ�¤â�¤  at /home/p6eval/niecza/boot/lib/CORE.settin…
07:44 [Coke] that's a bummer. :(
07:45 Woodi joined #perl6
07:53 [Coke] dissolve groundwork cramp / transfer hairy taboo span / schoolyard leopard charge
07:53 [Coke] \o/
07:53 [Coke] I need the :m for my cool lexicon to work, I'll make that a stretch goal.
08:07 cognominal joined #perl6
08:07 kaare_ joined #perl6
08:12 azawawi joined #perl6
08:12 azawawi hi
08:13 azawawi sorear: ping
08:15 azawawi phenny: tell sorear im trying to integrate farabi web-based REPL with Niecza.exe. Please see code... somehow im not getting it right. Rakudo worked like a charm. http://paste.debian.net/218732/
08:15 phenny azawawi: I'll pass that on when sorear is around.
08:24 mj41 joined #perl6
08:28 sorear azawawi: do you realize that rakudo and niecza use different terminal input libraries?
08:28 phenny sorear: 08:15Z <azawawi> tell sorear im trying to integrate farabi web-based REPL with Niecza.exe. Please see code... somehow im not getting it right. Rakudo worked like a charm. http://paste.debian.net/218732/
08:28 GlitchMr joined #perl6
08:30 GlitchMr joined #perl6
08:30 sorear azawawi: sorry, that was unnecessarily harsh.  what I meant is that this is not a bug and I lack the time/energy to help you
08:30 mj41 joined #perl6
08:31 GlitchMr joined #perl6
08:31 azawawi sorear: no problem
08:32 azawawi sorear: :)
08:34 azawawi sorear: im basically sending output through IPC::Run and reading it back
08:34 azawawi sorear: i'll check it more and report back. thx
08:36 sorear I need a new weekend project.  $work is so much more fun than doing anything with niecza
08:40 azawawi http://feather.perl6.nl:3030/   # Farabi 0.21 released... Refactored, Better REPL and stability
08:40 Woodi sorear: niecza refactor time come :) for Rakudo it help a lot...
08:41 azawawi https://metacpan.org/source/​AZAWAWI/Farabi-0.21/Changes  # Changes
08:42 sorear Woodi: I would like very much to never touch programming languages again
08:42 azawawi then play games :)
08:42 azawawi it helps
08:42 Woodi it destroys too, watch my programming skills :)
08:43 au there are also programming games, such as SpaceChem :)
08:43 sorear o/ au
08:43 au \o
08:44 Woodi hallo au
08:44 au greetings
08:44 sorear au: should I come to yapcna?
08:45 au good question
08:45 au June 3-7 is a bit far to plan for me
08:48 Woodi sorear: I have colegue I wanted to bring to YAPC::EU once (to capture him into p6 world :) ) he is good programmer but finished pragmatist too... I couldn't convince him to future-be-great-Perl6 :) becouse he thinked .Net is good enought... sometimes you just want to shoot that be-right-pragmatists :)
08:52 Woodi anyway, I hear in North America are just two kinds of apples - red and green... But someone tell me it's not true :)
08:58 LlamaRider joined #perl6
09:07 sbox joined #perl6
09:11 GlitchMr joined #perl6
09:13 sorear We used to have rainbow striped apples but now they're all black and white.
09:22 mj41 joined #perl6
09:24 rindolf joined #perl6
09:26 noggle_ joined #perl6
09:37 arkydo joined #perl6
09:46 Woodi I think winter is here
09:46 Psyche^ joined #perl6
09:57 rindolf joined #perl6
10:12 MayDaniel joined #perl6
10:36 FROGGS_ joined #perl6
10:38 spider-mario joined #perl6
10:47 dalek specs: 77f6462 | moritz++ | S32-setting-library/Containers.pod:
10:47 dalek specs: [S32] spec uniq
10:47 dalek specs: review: https://github.com/perl6/specs/commit/77f6462c4d
10:58 jerome joined #perl6
11:08 GlitchMr joined #perl6
11:09 FROGGS_ joined #perl6
11:30 noggle joined #perl6
11:33 rummik joined #perl6
11:44 mj41 joined #perl6
12:18 PacoAir joined #perl6
12:18 att__ joined #perl6
12:41 hash_table joined #perl6
12:49 cognominal joined #perl6
13:07 Kharec joined #perl6
13:27 noggle joined #perl6
13:31 geekosaur joined #perl6
13:37 geekosaur joined #perl6
13:40 masak hola, #perl6
13:41 masak allow me to project a bit of love and warmth from the masak household. Merry Christmas, people.
13:44 Chillance joined #perl6
13:57 bbkr joined #perl6
13:57 moritz merry Christmas from the moritz.families housholds too :-)
14:01 cognominal joined #perl6
14:06 mj41 joined #perl6
14:07 masak moritz.families>>.households :)
14:07 masak er, moritz.families>>.household, I mean.
14:17 pmurias joined #perl6
14:24 mikemol So, someone referred me to this list yesterday: http://www.cs.yale.edu/quotes.html
14:25 mikemol Here's something for the perl 6 folks to ponder: #59: In English every word can be verbed. Would that it were so in our programming languages.
14:26 mikemol I'm not even certain what that means in a programming context, but I expect there are people in here who will enjoy playing with the notion. :)
14:29 rurban joined #perl6
14:29 mj41 joined #perl6
14:32 rurban joined #perl6
14:40 lolage joined #perl6
14:41 masak "verbing" in programming would correspond to making it into something callable.
14:41 cognominal mikemol: verbing names and changing the grammatical category of words is a recurrent theme in #perl6
14:43 cognominal Deep thought about world gramatical category is everywhere in Perl 6. See A04  "In the first place, as a quasi-linguist, I loathe the keywords switch and case. I would prefer keywords that read better in English. Much as I love verbing nouns, they don't work as well as real verbs or real prepositions when topicalizers are called for. After thrashing over several options with Damian and other folks, we've settled on using given instea
14:43 cognominal d of switch, and when instead of case"
14:44 cognominal s/world/word
14:45 mikemol cognominal: "Deep thought about world gramatical category is everywhere in Perl 6." I know. It goes with the mindset of you guys. Which is why I dropped that quote in here.
14:45 cognominal :)
14:45 mikemol Started reading the spec a while back, got interrupted by life. :)
14:47 cognominal Apocalypses are historical, but I quoted them to show that this kind of tought is nothing new in Larry's mind.
14:47 mikemol Oh, I'm _certain_ it's nothing new in his mind; he's got the linguist bug more than any other technically-apt person I know.
14:48 mikemol I'm just amazed he doesn't pun more. :)
14:51 cognominal that's why we all love Perl;  and some programmers don't because they seem to forget about their skills because their mind is shaped by computer languages which have been constrained by physical limits that are becoming irrelevant today.
14:57 stopbit joined #perl6
14:57 azawawi joined #perl6
14:57 azawawi hi
14:58 azawawi http://feather.perl6.nl:3030/     # Farabi now has editor tabs.. new and open file works :)
14:58 masak azawawi++
14:59 azawawi perl6 REPL works also
14:59 azawawi just dont press enter :)
15:00 masak who would ever press Enter in a REPL... oh.
15:00 masak :P
15:00 azawawi i have simplified it a lot... ALT-A opens the action menu... which lists all the actions that work with farabi
15:02 azawawi feedback is welcome
15:05 timotimo when i press enter in the repl, it works. what am i doing wrong?
15:06 azawawi works sometimes... not all the time
15:06 azawawi basically it is a shared REPL process at the moment
15:06 azawawi no session
15:07 azawawi once i add a persistent configuration store, things will start to show up... persistent editor session, options, ...etc
15:07 masak nice.
15:07 masak what's it like building a web application such as this?
15:08 azawawi fun
15:08 azawawi at first i was like im gonna to write a lot of javascript to get this done
15:08 azawawi but then i started researching here and there
15:08 mj41 joined #perl6
15:09 azawawi farabi6 was an interesting experiment (Farabi JS on Perl 6 backend)
15:09 azawawi i learned a lot from it and moved stuff back into Farabi (Perl backend)
15:10 azawawi im going to cut on dependencies though
15:10 azawawi if you have Perl::Tidy, then Farabi will enable that feature
15:10 azawawi if you have perl6, ... same
15:10 timotimo hm, how good is padre for perl6 by now?
15:11 * hoelzro tries to figure out how he's differentiate $a / $b vs / regex / and $a < $b vs < words >
15:11 timotimo does it integrate the debugger for instance?
15:11 azawawi nop
15:11 azawawi btw... padre::plugin::perl6  is my work :)
15:11 timotimo is padre the kind of ide that would integrate a debugger?
15:12 azawawi it has a nice perl debug interface but that's for perl not perl 6
15:13 timotimo i see. maybe there will be something compatible one day :)
15:13 azawawi jnthn previously suggested adding a web API for perl6-debug... once that's there, i will be more than happy to integrate it.
15:13 timotimo i should check out padre and tell you how much i like it :)
15:13 timotimo gotta run now, though
15:16 hoelzro hang on...do regexes in Perl 6 *have* to begin with m? (as in m/.../)
15:16 masak no.
15:16 hoelzro damn.
15:16 masak if they do, they're executed in-place.
15:17 masak if they don't, they're regex objects.
15:17 * masak just had a need for a .join which inserts separators outside of the elements, too, like this: |e|e|e|
15:17 * masak defined a local sub outerjoin for this :)
15:19 cognominal there is a need for a     method join($inner, $before = $inner, $after = $inner) { … }
15:21 masak nah :)
15:21 masak it's important to provide the right primitives for a language. it's also important to know when to stop.
15:22 Patterner the PHP-Effect?
15:23 masak PHP suffers more from lack of "provide the right primitives" than from lack of "know when to stop", if you ask me.
15:23 masak to the extent that PHP suffers, that is :)
15:25 Patterner there are so many primitives, pure statictics makes it unlikely that all of them are wrong :)
15:26 masak if only that were true.
15:27 masak this may interest some people on-channel: http://cstheory.stackexchange.com/questions​/14811/what-is-the-enlightenment-im-suppose​d-to-attain-after-studying-finite-automata
15:30 masak r: enum Day <Sun Mon Tue Wed Thu Fri Sat>; say Day(3)
15:30 p6eval rakudo c8de2e: OUTPUT«Wed␤»
15:30 masak \o/
15:34 stevan_ joined #perl6
15:41 masak 28 people have signed up for p6cc2012! still a few days left before registration closes.
15:42 masak I wonder if there's anything I can do to make more people sign up. would be nice to break last year's record of 35 signups.
15:45 FROGGS_ joined #perl6
15:50 cognominal joined #perl6
15:56 cognominal joined #perl6
16:07 stevan_ joined #perl6
16:18 GlitchMr joined #perl6
16:28 kaare__ joined #perl6
16:30 kaare_ joined #perl6
16:35 Celelibi joined #perl6
16:44 jaldhar joined #perl6
16:50 Tabrenus joined #perl6
17:01 jaldhar joined #perl6
17:10 fgomez joined #perl6
17:11 stevan_ joined #perl6
17:13 SamuraiJack joined #perl6
17:37 nyuszika7h joined #perl6
17:40 rummik joined #perl6
17:40 lorn joined #perl6
17:45 cognominal_ joined #perl6
17:53 cognominal__ joined #perl6
18:00 jaldhar joined #perl6
18:09 cognominal__ joined #perl6
18:17 popl joined #perl6
18:23 cognominal__ joined #perl6
18:34 cognominal joined #perl6
18:38 fgomez joined #perl6
18:40 pmichaud good morning, #perl6
18:41 kaleem joined #perl6
18:41 pmichaud actually, good afternoon I guess
18:42 masak pmichaud! \o/
18:44 ggoebel o/
18:47 pmichaud glad to see we all survived the mayan apocalypse.  I wasn't sure I'd make it through... :-) :-)   (long story, not for web publication)
18:48 pmichaud oh, I'm being called for lunch, will bbl
18:48 masak glad to hear you made it through too, then.
18:48 popl If I see one more joke about the apocalypse...
18:49 masak popl: ...you might decide to trigger it, a few days late?
18:50 cognominal joined #perl6
18:53 popl IÄ! IÄ! CTHULHU FTHAGN! PH'NGLUI MGLW'NAFH CTHULHU R'LYEH WGAH-NAHL FHTAGN!
18:55 popl :(
18:55 popl It didn't work.
18:56 masak popl: http://www.youtube.com/watch?v=FnbYcB9ctu8 :)
18:58 popl haha
18:58 popl that's awesome
19:04 cognominal joined #perl6
19:19 cognominal joined #perl6
19:39 abcxyz joined #perl6
19:42 abcxyz r: substr '1234567890', 0, -50
19:42 p6eval rakudo c8de2e: OUTPUT«Length argument to substr out of range. Is: -50, should be in 0..Inf; use *-50 if you want to index relative to the end␤current instr.: 'throw' pc 329649 (src/gen/CORE.setting.pir:147534) (src/gen/CORE.setting:9196)␤called from Sub 'sink' pc 358851 (src/gen/CORE.se…
19:42 Pleiades` joined #perl6
19:45 FROGGS_ good evening
19:45 abcxyz Is there any way to let substr return an empty string with: " r: say substr '1234567890', 0, *-50 " without using conditional?
19:45 abcxyz Good evening.
19:46 abcxyz Since I am translating my working Perl5 code. And I needed to do this because I do not know the length of the input string: I want it to be truncated to empty string if it is too short.
19:46 abcxyz r: say substr '1234567890', 0, *-5
19:46 p6eval rakudo c8de2e: OUTPUT«12345␤»
19:46 abcxyz r: say substr '1234567890', 0, *-50
19:46 p6eval rakudo c8de2e: OUTPUT«Length argument to substr out of range. Is: -40, should be in 0..Inf; use *-40 if you want to index relative to the end␤  in method gist at src/gen/CORE.setting:10337␤  in sub say at src/gen/CORE.setting:7514␤  in block  at /tmp/KV8rN9R9aH:1␤␤»
19:49 cognominal joined #perl6
19:57 sorear good * #perl6
20:00 _jaldhar joined #perl6
20:02 masak sorear! \o/
20:09 sorear masak! \o/
20:10 abcxyz I figured it out!
20:10 abcxyz r: say substr '1234567890', 0, 0 max *-50
20:10 p6eval rakudo c8de2e: OUTPUT«␤»
20:12 FROGGS joined #perl6
20:16 FROGGS hi there
20:20 aindilis joined #perl6
20:22 sorear hi FROGGS.
20:23 FROGGS hi sorear
20:27 Pleiades` joined #perl6
20:46 cognominal joined #perl6
20:54 Pleiades` joined #perl6
20:54 masak abcxyz: nice!
20:57 masak r: say 0 max *-50
20:57 p6eval rakudo c8de2e: OUTPUT«0␤»
20:57 masak abcxyz: though you might have a precedence problem...
20:58 masak hm, no. that should work out right. infix:<-> binds tighter.
20:58 masak r: say 0 > *-50; say 0 < *-50
20:58 p6eval rakudo c8de2e: OUTPUT«WhateverCode.new()␤WhateverCode.new()␤»
20:58 abcxyz yeah
20:58 abcxyz max is very low precedence
20:58 masak loose precedence, yes :)
20:59 masak hm, is there something wrong with infix:<max> and the whatever star?
20:59 abcxyz I am thinking about reinplementing the perl5 style substr myself. It seems to be simple.
20:59 abcxyz Just add: multi substr(Str $s, Int $pos where { $pos < 0 }){ $s.substr(0 max *-$pos) }
20:59 abcxyz Something like this.
21:00 abcxyz It will wrap the negative indice and polish them into what Perl6 expects.
21:01 masak aye.
21:01 masak that's definitely playing by the rulebook.
21:01 flussence joined #perl6
21:01 abcxyz What do you mean by "playing by the rulebook"?
21:01 abcxyz Sorry, my English needs to be improved...
21:02 masak in that it's not a horrible solution that breaks good practices in any way.
21:02 masak although I guess it could be argued that you force the reader to familiarize themselves with your version of substr before understanding your code...
21:02 abcxyz Ah, yeah.
21:03 abcxyz That's just for fun.
21:04 masak if the dimension optimized for is "fun", rather than "maintainability", then I don't see the harm.
21:04 masak go forth and multi.
21:05 abcxyz :)
21:06 abcxyz for readability AND fun, we can do this:
21:06 abcxyz sub-str(Str $s, Int $pos where { $pos < 0 }){ $s.substr(0 max *-$pos) }
21:07 abcxyz sub_MINUS_str
21:07 masak :)
21:17 abcxyz I am still think about yesterday's 1..10 problem.
21:18 abcxyz What if you do a simple forward tracking after '1.', to make sure it is a single '.' or a double '..'?
21:24 masak you could do that.
21:24 masak but that would insert an exception into the parser.
21:24 masak which maybe doesn't sound so bad until you realize that that parser is simply a Perl 6 grammar. it literally runs on rules, not exceptions.
21:25 masak it's not that it isn't possible. it's that it would hurt future extensibility.
21:25 masak and for what? for being able to write numbers like '1.'
21:25 masak the cost outweighs the benefit.
21:26 abcxyz I see.
21:26 abcxyz That's a design decision.
21:26 masak aye.
21:26 abcxyz But I am think about a new feature.
21:27 abcxyz Called "forgiveness"
21:27 abcxyz Since one difference between computer language and human language
21:28 abcxyz is that computer can understand things when they are grammatically correct, as human do;
21:28 rindolf Hi all.
21:29 abcxyz but when the input is not grammatically correct, computer has to complain and pass the error message for human to treat it.
21:29 abcxyz While human being are just more forgiving, and can still go on and understand the sentence, as long as there is no severe ambiguity.
21:31 abcxyz To implement the feature of "forgiveness",
21:31 moritz forgiveness or magic is very dangerous
21:32 moritz becaues it usually comes back to byte you in some way or another
21:32 abcxyz Please let me express my idea first.
21:32 abcxyz the first layer is the same: just define and implement a strict and complete grammar system.
21:32 moritz example: perl 5's reverse()
21:32 abcxyz Including the afore-mentioned "1.".reject rule.
21:33 abcxyz But right before it generates a error message, the computer can do one more thing.
21:33 timotimo is day24 about to be released?
21:34 abcxyz Instead of saying directly: There is no operator defined to be used in this way! This sentence doesn't make sense!
21:34 moritz dunno, PerlJam has claimed the slot
21:34 timotimo OK
21:35 abcxyz It can say, Umm, let me re-think about it, may be he just simply means "1 .. 10" without puting the spaces in?
21:35 timotimo i've been inspired to try and implement a general multiplayer-capable card game framework, a bit similar to what masak did for his Game::Adventure module and implement a simplish game and AI for it some time ...
21:36 timotimo abcxyz: and then if someone in some module implements a postfix:<..> or even postfix:<.> operator, the parser will have to interpret the same code in a different way and it will break :(
21:37 abcxyz Then it decides to interpret it this way, and at the same time generates an (optional) warning message: (Although your sentence does not have strictly correct grammar, but Perl6 understands that you are saying: "1 .. 10")
21:38 abcxyz timotimo: That's why this feature is called forgiveness, and it executes the next layer after the correct grammar parsing.
21:39 timotimo so, you'd get a warning, but it would run. and if you 'use' a module that makes it change its mind you won't get the warning any more
21:39 timotimo so because the warning is missing you'll know you've got a different interpretation now?
21:40 abcxyz It means that if someone actually implements something like postfix:<.>, then the sentence would be grammatically correct, and the pathway I have mentioned will not be triggered at all.
21:41 abcxyz This keeps the extensibility of what masak mentions, but it also adds in all the good features of Perl5's heuristics in.
21:42 abcxyz It's just like an exception list: if the sentence is grammatically incorrect, then catch the exception and treat it this way.
21:43 abcxyz Microsoft Word corrects our typos in this way also.
21:44 abcxyz This can make a more high-level, in the sense that it is closer to human-language.
21:45 abcxyz If the sentence is already grammatically correct, then the exception handling wouldn't be triggered at all, since this is probably what you are intending to do anyway.
21:45 flussence I'd prefer not having to think like microsoft word when reading someone else's code.
21:45 timotimo :D
21:46 abcxyz Remember, even with the current implementation, yesterday I have shown that defining infix:<< ...^*> >> can change the parsing of the current working code also.
21:46 timotimo oh, that's true.
21:47 timotimo also, a bit irritating
21:47 timotimo i will make sure to always put enough whitespace everywhere i go ...
21:47 abcxyz But I consider this definition: infix:<< ...^*> >> as malicious.
21:47 abcxyz It means that a good programmer probably shouldn't do this kind of definition to begin with.
21:48 abcxyz C++ enforces operator overloading only uses the current known operators, that C++'s decision.
21:48 timotimo also, what about simply adding a postfix:<.> to allow numbers to be written as 1.?
21:48 abcxyz Perl allows in general any operators, but the user should limit themselves.
21:49 timotimo it could even be spec'd, could it not?
21:49 abcxyz i.e. defining certain operators are grammatically legal, but can be considered ethically immoral.
21:49 timotimo seems cleaner than to add it as a special case to the grammar
21:49 masak abcxyz: if I understand your concept of "forgiveness", it would actually make some new programs compile that didn't before.
21:49 masak abcxyz: as such, it would actually fail to catch some errors the parser caught before.
21:50 abcxyz masak: That depends.
21:50 masak I must say I prefer errors to be caught rather than forgiven, in the case of parsing.
21:50 masak now, having said that, the Perl 6 compilers are actually able to keep parsing in some cases where the errors are recoverable.
21:50 abcxyz masak: Since the exception list is added by human, you can decide what condition is truly clear, and what are pretty ambiguious and you still pass it on as an error.
21:50 timotimo you always say forgiveness > permission :P
21:51 masak timotimo: depends on the context, I guess :)
21:51 masak abcxyz: even if the exception list is added by a human, it hinders future extensibility.
21:51 timotimo if there's a nqp-js backend and i want to create javascript for a website to be served by another module, would it be possible to rely on panda to get nqp-js?
21:51 masak which was the point of not allowing '1.' in the first place.
21:56 timotimo masak: do you think the game state + event mechanism is a good fit for card games?
21:57 masak timotimo: I don't see why not.
21:57 timotimo cool
21:57 lue .oO(when slangs are implemented, you can unstrict the grammar however much you please.)
21:57 timotimo and a html websockets based frontend could be done, too
21:57 masak lue: "all is fair if you predeclare", yes.
21:58 masak lue: that is, you can implement your own subjective opinion of a good idea, as long as the end user has to 'use'-statement it to get it going.
21:59 timotimo good night!
21:59 lue use SyntaxLike::Python;
21:59 timotimo well, good *, really
21:59 lue good knight, timotimo o/
22:00 masak 'night, #perl6
22:01 lue ♞, masak o/
22:27 c1sung joined #perl6
22:30 am0c joined #perl6
23:18 pmurias joined #perl6
23:18 pmurias timotimo: nqp-js is not yet a panda package
23:25 pmurias abcxyz: giving a warning for compile time things is annoying
23:29 pmurias abcxyz: as they force to either fix the situation or live with an annoyance
23:29 pmurias s/force/force you
23:31 pmurias abcxyz: their main benefits is that they can be introduce without breaking backwards compatibility

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

Perl 6 | Reference Documentation | Rakudo