»ö« | perl6.org/ | evalbot usage: 'perl6: say 3;' or rakudo:, alpha:, pugs:, std:, or /msg p6eval perl6: ... | irclog: irc.pugscode.org/ | UTF-8 is our friend!
Set by moritz_ on 25 June 2010.
TimToady well, i vs ī can be worse; usually makes it a different verb, kita vs kiita 00:01
00:02 Psyche^ joined
lue would the u in rune be a better approximation than the oo in boot? [en:wikipedia page for Japanese IPA says the latter, but that doesn't seem right] 00:03
TimToady those are the same sound in my dialect
though boot is perhaps a better example because un will tend to be pre-nasalized 00:04
diakopter rakudo: my$n=3;my@m=0 xx (my$v=$n*$n);my($r,$c,$d)=$n div 2,$n div 2-($n %% 2),($n %% 2??2!!4);sub t{$d=4 if --$d<1};sub m{if $d%%2 {$r+=$d==4??-1!!1}else {$c+=$d==3??-1!!1}};sub l{t;m;my$x=@m[$r*$n+$c];t;t;m;t;$x};while $v {@m[$r*$n+$c]=--$v;t if!l;m};say ~@m.splice(0,$n).fmt('%'~($n*$n).Str.chars~'d') for ^$n
p6eval rakudo d9aa57: OUTPUT«0 1 2␤7 8 3␤6 5 4␤»
TimToady and r also tends to distort nearby sounds in english 00:05
lue mine too, just wondering if there was a molecule of difference between the two [and curses to the wide array of accents in English]
diakopter rakudo: my$n=4;my@m=0 xx (my$v=$n*$n);my($r,$c,$d)=$n div 2,$n div 2-($n %% 2),($n %% 2??2!!4);sub t{$d=4 if --$d<1};sub m{if $d%%2 {$r+=$d==4??-1!!1}else {$c+=$d==3??-1!!1}};sub l{t;m;my$x=@m[$r*$n+$c];t;t;m;t;$x};while $v {@m[$r*$n+$c]=--$v;t if!l;m};say ~@m.splice(0,$n).fmt('%'~($n*$n).Str.chars~'d') for ^$n
p6eval rakudo d9aa57: OUTPUT« 0 1 2 3␤11 12 13 4␤10 15 14 5␤ 9 8 7 6␤»
diakopter TimToady: :)
it's a turtle
TimToady especially if you pronounce boot with a glo'al stop at the end, it sounds cut off like a japanes would pronounce bu
00:06 Patterner left, Psyche^ is now known as Patterner
TimToady because they would be distinguishing it from buu 00:06
lue is reminded of how the phrase 'glottal stop' is like the term 'lisp': if you have it, saying what it is will give you away. 00:07
diakopter TimToady: that's a Turtle-y spiral matrix you were discussing... now if only it could be more idiomatic p6
TimToady yes, also "shibboleth" in the original usage
diakopter lots o' help from masak++ on the last statement (outputting) 00:08
TimToady yes, a number of solutions do it that way. I was thinking of something that abstracted the turtle's direction a little more
diakopter the non-golfed-for-p6eval-irc is a bit easier to read, but not by much 00:10
I didn't see [m]any solutions that started from the middle...? 00:11
TimToady the nice thing about starting from the middle is you don't have to worry about edges 00:12
and the nice thing about starting from the edges is you don't have to worry about the middle :)
diakopter heh 00:13
00:13 justatheory left
diakopter any suggestions for cleaning up this? fmt('%'~($n*$n).Str.chars~'d') 00:13
TimToady lemme play with it a bit 00:14
diakopter (pad for the largest item)
I couldn't get an interpolating edition
er, that's supposed to be fmt('%'~($n*$n-1).Str.chars~'d')
sorear I chose rune because it's one letter 00:15
diakopter masak suggested log10 but I couldn't begin to guess how to do that in rakudo
sorear my brain was too much in Japanese mode to realize that boot and rune had the same vowel length
TimToady but the r and the n rune the sound of it
Tene diakopter: fmt() takes two args.
sorear lue: any more questions?
diakopter Tene: it's from my last msg to rakudo above 00:17
the last statement
Tene oh
TimToady the parens around ($n %% 2) should be unnecessary 00:18
and you won't get that proggy past STD
std: my$n=4;my@m=0 xx (my$v=$n*$n);my($r,$c,$d)=$n div 2,$n div 2-($n %% 2),($n %% 2??2!!4);sub t{$d=4 if --$d<1};sub m{if $d%%2 {$r+=$d==4??-1!!1}else {$c+=$d==3??-1!!1}};sub l{t;m;my$x=@m[$r*$n+$c];t;t;m;t;$x};while $v {@m[$r*$n+$c]=--$v;t if!l;m};say ~@m.splice(0,$n).fmt('%'~($n*$n).Str.chars~'d') for ^$n 00:19
p6eval std 32108: OUTPUT«===SORRY!===␤Variable $r is not predeclared at /tmp/KfWfpjIrl1 line 1:␤------> my$n=4;my@m=0 xx (my$v=$n*$n);my($r⏏,$c,$d)=$n div 2,$n div 2-($n %% 2),($n ␤Variable $c is not predeclared at /tmp/KfWfpjIrl1 line 1:␤------> my$n=4;my@m=0 xx
..(…
TimToady for more than one reason 00:20
std: my$n=4;my@m=0 xx (my$v=$n*$n);my ($r,$c,$d)=$n div 2,$n div 2-($n %% 2),($n %% 2??2!!4);sub t{$d=4 if --$d<1};sub m{if $d%%2 {$r+=$d==4??-1!!1}else {$c+=$d==3??-1!!1}};sub l{t;m;my$x=@m[$r*$n+$c];t;t;m;t;$x};while $v {@m[$r*$n+$c]=--$v;t if!l;m};say ~@m.splice(0,$n).fmt('%'~($n*$n).Str.chars~'d') for ^$n
p6eval std 32108: OUTPUT«===SORRY!===␤Whitespace required before < operator at /tmp/TxYJUO0W7d line 1:␤------> % 2),($n %% 2??2!!4);sub t{$d=4 if --$d<⏏1};sub m{if $d%%2 {$r+=$d==4??-1!!1}else␤ expecting escape␤Parse failed␤FAILED 00:01 123m␤»
TimToady std: my$n=4;my@m=0 xx (my$v=$n*$n);my ($r,$c,$d)=$n div 2,$n div 2-($n %% 2),($n %% 2??2!!4);sub t{$d=4 if --$d <1};sub m{if $d%%2 {$r+=$d==4??-1!!1}else {$c+=$d==3??-1!!1}};sub l{t;m;my$x=@m[$r*$n+$c];t;t;m;t;$x};while $v {@m[$r*$n+$c]=--$v;t if!l;m};say ~@m.splice(0,$n).fmt('%'~($n*$n).Str.chars~'d') for ^$n
p6eval std 32108: OUTPUT«===SORRY!===␤Variable $x is not predeclared at /tmp/ag_0yV1sh1 line 1:␤------> }else {$c+=$d==3??-1!!1}};sub l{t;m;my$x⏏=@m[$r*$n+$c];t;t;m;t;$x};while $v {@m[$␤Two terms in a row at /tmp/ag_0yV1sh1 line 1:␤------> =3??-1!!1}};sub 00:21
..l{t;m;my$…
diakopter confuzzled 00:23
I read through them all again; none start from the middle 00:25
unless you count the recursive ones that rotate/swap
but I'm not
I don't get why STD doesn't like it
TimToady m;foo;bar; 00:27
rakudo is letting you get into bad habits
diakopter what's wrong with m;foo;bar 00:28
oh; heh.
std: my$n=2;my@m=0 xx (my$v=$n*$n);my ($r,$c,$d)=$n div 2,$n div 2-$n%%2,($n%%2??2!!4);sub t{$d=4 if --$d <1};sub f{if $d%%2 {$r+=$d==4??-1!!1}else {$c+=$d==3??-1!!1}};sub l{t;f;my$x=@m[$r * $n+$c];t;t;f;t;$x};while $v {@m[$r*$n+$c]=--$v;t if!l;f};say ~@m.splice(0,$n).fmt('%'~($n*$n).Str.chars~'d') for ^$n 00:30
p6eval std 32108: OUTPUT«ok 00:02 123m␤»
diakopter rakudo: my$n=2;my@m=0 xx (my$v=$n*$n);my ($r,$c,$d)=$n div 2,$n div 2-$n%%2,($n%%2??2!!4);sub t{$d=4 if --$d <1};sub f{if $d%%2 {$r+=$d==4??-1!!1}else {$c+=$d==3??-1!!1}};sub l{t;f;my$x=@m[$r * $n+$c];t;t;f;t;$x};while $v {@m[$r*$n+$c]=--$v;t if!l;f};say ~@m.splice(0,$n).fmt('%'~($n*$n).Str.chars~'d') for ^$n
p6eval rakudo d9aa57: OUTPUT«0 1␤3 2␤»
00:31 macroron left
TimToady Perl 6 is not trying to be a golf-friendly language... 00:32
00:35 drbean joined 00:37 awwaiid left
diakopter added; feel free to edit/replace it... :) rosettacode.org/wiki/Spiral_matrix#Perl_6 00:39
TimToady working on it 00:42
00:44 awwaiid joined 00:52 whiteknight left
lue I find rosettacode a fun repository of stuff to try to code. 00:52
01:08 risou_ left 01:20 bjarneh joined 01:26 kid51 joined
diakopter rakudo: my$n=4;my@m=0 xx (my$v=$n*$n);my ($r,$c,$z)=0,0,0;while $v >= ($n*$n) div 2 { @m[($n-$r-1)*$n+$n-$c-1]=$v - 1; @m[$r*$n+$c]=$n*$n - --$v - 1; if $z%%2 { ++$c; if $r {--$r} else {++$z} } else { ++$r; if $c {--$c} else {++$z} }};say ~@m.splice(0,$n).fmt('%'~($n*$n).Str.chars~'d') for ^$n # zigzag array 01:27
p6eval rakudo d9aa57: OUTPUT« 0 1 5 6␤ 2 4 7 12␤ 3 8 11 13␤ 9 10 14 15␤»
diakopter rakudo: my$n=2;my@m=0 xx (my$v=$n*$n);my ($r,$c,$z)=0,0,0;while $v >= ($n*$n) div 2 { @m[($n-$r-1)*$n+$n-$c-1]=$v - 1; @m[$r*$n+$c]=$n*$n - --$v - 1; if $z%%2 { ++$c; if $r {--$r} else {++$z} } else { ++$r; if $c {--$c} else {++$z} }};say ~@m.splice(0,$n).fmt('%'~($n*$n).Str.chars~'d') for ^$n # zigzag array 01:33
p6eval rakudo d9aa57: OUTPUT«0 1␤2 3␤»
diakopter rakudo: my$n=1;my@m=0 xx (my$v=$n*$n);my ($r,$c,$z)=0,0,0;while $v >= ($n*$n) div 2 { @m[($n-$r-1)*$n+$n-$c-1]=$v - 1; @m[$r*$n+$c]=$n*$n - --$v - 1; if $z%%2 { ++$c; if $r {--$r} else {++$z} } else { ++$r; if $c {--$c} else {++$z} }};say ~@m.splice(0,$n).fmt('%'~($n*$n).Str.chars~'d') for ^$n # zigzag array
p6eval rakudo d9aa57: OUTPUT«Cannot modify readonly value␤ in '&infix:<=>' at line 1␤ in main program body at line 22:/tmp/JnMS7YQnqG␤»
diakopter oops
01:36 Transformer joined 01:38 Transformer left 01:39 justatheory joined
sorear rakudo: my$n=5;sub k($n,$x,$y){$n==1??1!!($x!=$n-1)??($y??($n*2-1+k($n-1,$n-2-$x,$n-1-$y))!!$x+1)!!$n+$y};for^$n ->$y{(^$n).map({k($n,$_,$y)}).Str.say} 01:42
p6eval rakudo d9aa57: OUTPUT«1 2 3 4 5␤16 17 18 19 6␤15 24 25 20 7␤14 23 22 21 8␤13 12 11 10 9␤»
diakopter oooo cool
01:43 justatheory left
Getty is there btw already a twitter account for that rakudo eval? lol 01:44
sorear twitter? why?
Getty just funny marketing ;)
diakopter heh 01:45
Getty you make @rakudo_eval something and he replies with @youraccount OUTPUT
sorear p6eval already runs on freenode and magnet, maybe something could be done with twirc 01:46
<-- clueless twitter non-user
Getty yeah twirc could work with a bit tweeking on the botside (the bot must anyway use the twirc server)
but Net::Twitter is anyway hell easy stuff 01:47
sorear the closest I've come to any twitter stuff was a nethack bot that tweeted high scores
diakopter now the coolest would be an omegle client 01:49
try to find a chat buddy; get rakudo! 01:50
sorear rakudo: my @a = (1); @a »+=» 2; 01:53
p6eval rakudo d9aa57: OUTPUT«Cannot modify readonly value␤ in '&infix:<=>' at line 1␤ in <anon> at line 204:CORE.setting␤ in 'hyper' at line 1␤ in 'hyper' at line 211:CORE.setting␤ in main program body at line 1␤»
sorear are lvalue arrays broken?
colomon might just be broken with respect to hyper 01:57
sorear rakudo: my @r = (1, 2, 3); @r»++; # stolen from S03-metaops/hyper.t 01:58
p6eval rakudo d9aa57: ( no output )
sorear rakudo: my @r = (1, 2, 3); @r»+=» 5;
p6eval rakudo d9aa57: OUTPUT«Cannot modify readonly value␤ in '&infix:<=>' at line 1␤ in <anon> at line 204:CORE.setting␤ in 'hyper' at line 1␤ in 'hyper' at line 211:CORE.setting␤ in main program body at line 1␤»
sorear so I guess »+=» is the problematic one
colomon rakudo: my @r = (1, 2, 3); @r»++; say @r.perl
p6eval rakudo d9aa57: OUTPUT«[2, 3, 4]␤»
colomon looks like. 01:59
sorear rakudo: my @a = [1,2],[3,4]; say @a.perl 02:00
p6eval rakudo d9aa57: OUTPUT«[[1, 2], [3, 4]]␤»
sorear rakudo: my @a = [1,2],[3,4]; @a = @a».reverse; say @a.perl
p6eval rakudo d9aa57: OUTPUT«[2, 1, 4, 3]␤»
02:01 kid51 left
sorear any good way to prevent flattening? 02:01
@a».=reverse seems to not-flatten 02:02
colomon rakudo: my @a = [1,2],[3,4]; say @a.perl; say @a>>.reverse.perl 02:04
p6eval rakudo d9aa57: OUTPUT«[[1, 2], [3, 4]]␤([2, 1], [4, 3])␤»
colomon It's the = part in @a = @a».reverse which is doing the flattening, maybe? 02:05
sorear what's happening is that .reverse returns a flatteny list 02:06
this is needed in order for @a = @a.reverse to work
colomon hmmm? 02:08
rakudo: say [1, 2, 3, 4].reverse.perl
p6eval rakudo d9aa57: OUTPUT«[4, 3, 2, 1]␤»
sorear .perl doesn't show flatteny
the act of calling a method strips off the flatteny bit 02:09
(ObjectRef w/ 'scalar' prop, in Rakudo)
rakudo: my$n=5;my@a=[1];for 2..$n ->$o{@a».=reverse;@a=[1..$o-1],(@a»»+»»($o*2-1)).reverse;for@a Z ($o..$o*2-1) { $^a.push($^b)}};.Str.say for @a 02:10
p6eval rakudo d9aa57: OUTPUT«1 2 3 4 5␤16 17 18 19 6␤15 24 25 20 7␤14 23 22 21 8␤13 12 11 10 9␤»
sorear diakopter: non-recursive list version
diakopter :) 02:23
sorear do you like either of them enough to use? 02:24
rakudo: say $*IN.getc.perl 02:30
p6eval rakudo d9aa57: OUTPUT«src/gc/gc_ms.c:1234: failed assertion 'PObj_is_movable_TESTALL(str)'␤Backtrace - Obtained 20 stack frames (max trace depth is 32).␤/home/p6eval//p2/lib/libparrot.so.2.7.0 [0x2ad8964641a3]␤/home/p6eval//p2/lib/libparrot.so.2.7.0(Parrot_confess+0x87) 02:31
..[0x2ad8964642d7]␤/home/p6eval//p2…
sorear reading a single character from stdin appears to be impossible
diakopter sorear: well, yeah. :) they're certainly more idiomatic. also, enigmatic, since I can't read them. of course, I haven't tried very hard. 02:37
02:38 yrgd joined
sorear here's a hint: they're both based on the recursion principle 02:39
the spiral matrix of order N contains the spiral matrix of order N-1, shifted 1 down, rotated 180 degrees, and with 2*N-1 added to each element
02:49 lue left
sorear rakudo really ought to have nightlies 02:49
02:50 molaf joined
diakopter sorear: yeah I understood the solutions that used that technique; I just didn't get that from your code 03:01
sorear probably because my code was so golfed, eh? 03:07
03:08 meppl left
diakopter sorear: ಠYಠ yeah :) 03:14
sorear .u ಠ 03:20
phenny U+0CA0 KANNADA LETTER TTHA (ಠ)
sorear kannawhat
TiMBuS ಠ_ಠ 03:24
sorear .u ಠ
phenny U+0CA0 KANNADA LETTER TTHA (ಠ)
isBEKaml kannada? :) 03:31
www.google.com/transliterate
I don't know kannada, but that's one of the spoken Indian languages. 03:32
sorear according to wikipedia kannada is also a script 03:36
isBEKaml I didn't literally mean *spoken*, but yes, it has its own script and spoken largely in Karnataka, one of the states in India. 03:37
Many Indian languages have their own written forms, only a few take forms from other Indian languages or don't have any at all(very few, I know only one here) 03:39
Though in the former case, it's largely Devanagari.
.u U+0BA4 03:46
phenny isBEKaml: Sorry, no results
isBEKaml .u 0BA4
phenny U+0BA4 TAMIL LETTER TA (த)
03:47 leprevost joined 03:58 yrgd left 04:12 shade\ left 04:14 shade\ joined 04:20 cognominal left, cognominal joined 04:22 molaf left, yrgd joined 04:27 envi^home joined 04:35 justatheory joined 04:49 drbean left
sorear reads on llvm 05:12
05:18 justatheory left 05:59 Guest23195 joined 06:09 awwaiid left
sorear it looks like llvm will not work well for a niecza target 06:13
it's a bit too ll
notably, I'd have to come up with my own garbage collector, and some thread sync stuff 06:14
How bad would it be if for ^* { eval q:s"class { method m$_ { } }" } # leaked memory? 06:36
sorear idly wonders how much faster nqp-rx would be with dynops 06:40
06:45 bjarneh left 06:59 zag joined 07:05 drbean joined 07:13 Ross joined 07:17 azawawi joined
azawawi hi 07:18
sorear: ping
sorear pong 07:29
azawawi sorear: I remember you said before about making viv more re-usable. Is that still the case?
sorear not reusable; installable 07:30
azawawi sorear: i see 07:31
sorear: When I based Perl6::Refactor on viv (not complete), I found out that updating custom-viv scripts are a bit hard on the maintaince part. That's why I am asking about the re-usability. 07:33
sorear azawawi: if you're trying to reuse viv, you're doing it wrong 07:34
azawawi sorear: what's the correct way of doing it then? 07:35
sorear use STD;
the reusable part of viv is called STD.pmc
you're only the second person to think that using any of the code in viv is a good idea
I have no clue why people think that
viv is a perl 6 to perl 5 compiler based on the STD framework 07:36
nothing more
you'll notice that none of the official tools use viv
azawawi Part of it comes from being able to hack viv scripts faster. 07:37
sorear ?
azawawi The tree is already represented in a OO-form that one can use right away.
sorear that's not even part of viv 07:38
that's standard functionality of STD 07:39
azawawi I see. Thanks. I will try to re-use STD then. I was thinking in doing a PPI-like package first to simplify things a bit. 07:40
sorear What does PPI do that STD doesn't? 07:41
azawawi wrap it like PPI... search functionality
sorear (note: the viv syntax tree is not quite the same as the native STD syntax tree; there's an impedence matching layer in Actions.pm. As far as I can tell it brings no benefits, only bugs and slowness, so I don't use it in new projects) 07:42
I had to fix about four bugs in Actions before it could correctly mediate the full syntax tree from parsing STD.pm6
azawawi: xpathy stuff? 07:43
azawawi sorear: simpler, search.cpan.org/~adamk/PPI-1.213/lib/PPI/Find.pm
sorear: although representing whitespace and comments maybe a problem with STD.pm if i remember correctly 07:45
sorear: To do proper solid refactor tools, you need to be able to search & traverse the parse tree for matches. 07:46
sorear azawawi: viv (older versions) preserved whitespace and comments by passing through the text between submatches verbatim 08:06
look at viv around line 500-520 for inspiration 08:07
azawawi looks above for more inspiration :)
sorear: thx
08:08 zulon joined 08:11 azawawi left 08:12 patspam left 08:19 Mowah joined 08:20 envi^home left 08:24 zag left
moritz_ moin 08:27
08:33 envi^home joined
moritz_ rakudo: my $x = 2; say 'aaaa' ~~ /a ** $x / 08:45
p6eval rakudo d9aa57: OUTPUT«a␤»
moritz_ rakudo: my $x = 2; say 'aaaa' ~~ /a ** {$x} / 08:48
p6eval rakudo d9aa57: OUTPUT«aaaa␤»
moritz_ rakudo: my $x = 2; say 'aaaa' ~~ /a ** <?{$x}> / 08:49
p6eval rakudo d9aa57: OUTPUT«aaaa␤»
moritz_ rakudo: my $x = 2; say 'aaaa' ~~ /a ** <{$x}> /
p6eval rakudo d9aa57: OUTPUT«a␤»
moritz_ how do I quantify with a variable number? 08:52
09:10 drbean left 09:11 isBEKaml left 09:43 Ross left
pugssvn r32109 | sorear++ | [viv] use Getopt::Long 09:56
09:58 whiteknight joined 10:06 christine left 10:15 meppl joined 10:28 christine joined 10:31 risou_ joined 10:32 M_o_C joined 10:36 molaf joined 10:45 risou_ left 11:11 espadrine` joined 11:17 zulon left 11:32 nimiezko joined 11:41 Alias joined 11:46 M_o_C left 12:04 whiteknight left 12:09 zulon joined 12:13 stepnem left 12:14 stepnem joined 12:16 jaldhar left 12:17 drbean joined 12:22 kirillm left 12:23 amkrankruleuen joined 12:25 amkrankr1leuen joined, stepnem left 12:26 amkrankruleuen left, amkrankr1leuen is now known as amkrankruleuen 12:28 amkrankruleuen left 12:30 stepnem joined, stepnem left 12:34 stepnem joined 12:40 feiquet joined, espadrine` left 12:46 plluksie joined
nimiezko rakudo: (+"2").WHAT 12:49
p6eval rakudo d9aa57: ( no output )
12:49 PacoLinux joined
nimiezko rakudo: (+"2").HOW 12:49
p6eval rakudo d9aa57: ( no output )
nimiezko rakudo my Int $a = +"2" ; 12:50
12:50 dimid left
nimiezko rakudo: my Int $a = +"2" ; 12:50
p6eval rakudo d9aa57: OUTPUT«Type check failed for assignment␤ in '&infix:<=>' at line 1␤ in main program body at line 22:/tmp/A55G4LSrJk␤»
TiMBuS rakudo: say (+"2").WHAT 12:53
p6eval rakudo d9aa57: OUTPUT«Num()␤»
TiMBuS that's a reported bug 12:54
12:54 kirillm joined 12:55 amkrankruleuen joined
TiMBuS rakudo: my Int $a = "2".Int; $a.say 12:55
p6eval rakudo d9aa57: OUTPUT«2␤»
13:03 rgrau_ joined 13:09 orafu left, orafu joined 13:11 drbean left
nimiezko TiMBuS: thanks 13:13
TiMBuS that's alright 13:14
nimiezko and why is there e
a difference between : 13:15
rakudo: map { ["a", @^t] }, [2] ;
p6eval rakudo d9aa57: ( no output )
TiMBuS you gotta make the bot print it
nimiezko Yes, I just begin to understand it
rakudo: say (map { ["a", @^t] }, [2]).perl ; 13:16
p6eval rakudo d9aa57: OUTPUT«(["a", 2])␤»
nimiezko rakudo: say (map ({ ["a", @^t] }, [2])).perl ; 13:17
p6eval rakudo d9aa57: OUTPUT«No candidates found to invoke for method 'map' on object of type 'Array'; available candidates have signatures:␤:(Mu : &block;; *%_)␤␤ in 'map' at line 1723:CORE.setting␤ in main program body at line 22:/tmp/A1bwGx7yab␤»
nimiezko I just put some parenthesis in between.
TiMBuS rakudo: say (map({ ["a", @^t] }, [2])).perl ; 13:18
p6eval rakudo d9aa57: OUTPUT«(["a", 2])␤»
13:19 jhuni left
nimiezko ok, understand it. function call vs. list construct 13:19
TiMBuS yep that's it
you can use unspace
function\ ('args')
but yeah it's best to avoid that 13:20
nimiezko the error message was not really helpful to me 13:21
TiMBuS you're right, but I'm not sure how to check for that error 13:24
13:24 dual left
nimiezko The thing is that the error message does not say what it considers to be arguments for the called function 13:26
I did not understood what was exactly the "object of type 'Array'" 13:28
13:29 risou joined
TiMBuS well, technically it didn't have any arguments 13:40
since it saw it as map(Array: )
which is the same as Array.map() 13:41
or, mostly the same
13:43 masak joined
masak oh hai, #perl6! 13:43
nimiezko The thing was to identify this "Array" when you are persuaded to have two distinct elements (a block code and an Array) 13:44
masak \㋡/ 13:51
TiMBuS Cannot resume dead coroutine. 13:57
well thats odd..
I was trying to shorten haskells pascal's triangle example 13:58
@list := gather loop { take ((0, @list) Z+ (@list, 0)) };
masak rakudo: @list := gather loop { take ((0, @list) Z+ (@list, 0)) }; say 'alive' 13:59
p6eval rakudo d9aa57: OUTPUT«===SORRY!===␤Symbol '@list' not predeclared in <anonymous> (/tmp/9x6ih5tQ73:22)␤»
masak rakudo: my @list := gather loop { take ((0, @list) Z+ (@list, 0)) }; say 'alive' 14:00
p6eval rakudo d9aa57: OUTPUT«alive␤»
TiMBuS it stays alive, it just refuses to work
i guess its because @list wont change each take
masak rakudo: my @list := gather loop { take ((0, @list) Z+ (@list, 0)) }; say @list[0, 1, 2]
p6eval rakudo d9aa57: ( no output )
masak hm. :/
TiMBuS it makes some of haskells self-referential lists impossible 14:01
stick with '...' i guess
masak I'd love to cram a rakudobug out of what you just said, though.
worst thing I see so far is that it doesn't give any output when told to do so. 14:02
a red-handed "Cannot resume dead coroutine" would be great.
masak tries locally
prints nothing here either. 14:03
14:06 espadrine joined
TiMBuS masak, 14:23
my @list = 1; @list := gather loop { take ((0, @list) Z+ (@list, 0)) }; @list[1]
try that
wait why don't i just try that 14:26
rakudo: my @list = 1; @list := gather loop { take ((0, @list) Z+ (@list, 0)) }; @list[1
uh
p6eval rakudo d9aa57: OUTPUT«===SORRY!===␤Unable to parse postcircumfix:sym<[ ]>, couldn't find final ']' at line 22␤»
TiMBuS rakudo: my @list = 1; @list := gather loop { take ((0, @list) Z+ (@list, 0)) }; @list[1]
p6eval rakudo d9aa57: ( no output )
TiMBuS :/
rakudo: my @list = 1; @list := gather loop { take ((0, @list) Z+ (@list, 0)) }; say @list[2]
p6eval rakudo d9aa57: ( no output )
masak locally, it also outputs nothing.
14:27 dual joined
TiMBuS well its gotta output something 14:27
i think i have both the latest parrot and rakudo revisions 14:28
masak I might not. 14:29
but p6eval ought to.
TiMBuS rakudo: my @list = 1; @list := gather loop { take ((0, @list) Z+ (@list, 0)) }; say @list[2]; say 'wtf'; 14:30
p6eval rakudo d9aa57: OUTPUT«wtf␤»
TiMBuS well ive got no idea then
14:31 risou left, risou_ joined
TiMBuS oookay so, locally that second one works 14:31
14:32 risou_ left
TiMBuS but without the second 'say' i get the error 14:32
14:32 risou_ joined
masak :/ 14:32
TiMBuS ===SORRY!===␤Cannot resume dead coroutine.
masak seems quite elusive still.
but that error definitely has to do with gather/take. 14:33
pmichaud++ will know more.
TiMBuS actually, if I use >>+<< instead of Z+
i get no error 14:34
in fact it works as expected 14:35
masak workarounds++ 14:37
14:37 timbunce joined
TiMBuS well it doesn't work how I want it to, but it works how perl wants it to 14:37
probably
rakudo: @list := gather { my $z = 1; loop { $z = take ((0, $z) >>+<< ($z, 0)) } }; say @list[2]; 14:38
p6eval rakudo d9aa57: OUTPUT«===SORRY!===␤Symbol '@list' not predeclared in <anonymous> (/tmp/0m8GuNiwW5:22)␤»
TiMBuS arg
rakudo: my @list := gather { my $z = 1; loop { $z = take ((0, $z) >>+<< ($z, 0)) } }; say @list[2];
p6eval rakudo d9aa57: OUTPUT«Sorry, sides are of uneven length and not dwimmy.␤ in 'hyper' at line 179:CORE.setting␤ in <anon> at line 202:CORE.setting␤ in 'hyper' at line 1␤ in <anon> at line 1␤ in 'List::at_pos' at line 1␤ in 'Any::postcircumfix:<[ ]>' at line 1660:CORE.setting␤ in main program
..body a…
TiMBuS didnt expect that 14:39
14:40 stepnem left
TiMBuS my @list := gather { my @z = 1; loop { @z = take ((0, @z) >>+<< (@z, 0)) } }; say @list[2]; 14:40
-_-
rakudo: my @list := gather { my @z = 1; loop { @z = take ((0, @z) >>+<< (@z, 0)) } }; say @list[2];
p6eval rakudo d9aa57: OUTPUT«1331␤»
TiMBuS woo
masak TiMBuS++
nicest solution I've seen yet. 14:41
14:41 timbunce left
TiMBuS close enough to a self-referential list 14:42
14:43 stepnem joined, timbunce joined 14:46 zulon left 14:48 zulon joined 14:49 stepnem left
TimToady rakudo: my @list := gather { my @z = 1; loop { @z := take ((0, @z) >>+<< (@z, 0)) } }; say @list[2]; 14:50
p6eval rakudo d9aa57: OUTPUT«1331␤»
TimToady binding is better
pity about: 14:51
rakudo: my @list := gather { loop { (state @z = 1) := take ((0, @z) >>+<< (@z, 0)) } }; say @list[2];
p6eval rakudo d9aa57: OUTPUT«===SORRY!===␤"state" not yet implemented at line 22, near "= 1) := ta"␤»
masak might take a look at 'state' in Rakudo
jnthn++ indicated that it wasn't extremely hard.
doesn't take a rocket surgeon to implement it, at least :P 14:52
14:52 stepnem joined
TimToady thinks about: my @list := gather { loop -> @z = 1 { take ((0, @z) >>+<< (@z, 0)) } }; say @list[2]; 15:02
15:04 kid51 joined
szbalint rakudo: my @foo = ("a", "b", "ab"); my @bar = ("a", "b", "ab" | "ba"); say "match!" if (@foo ~~ @bar); 15:19
15:19 pmurias joined
p6eval rakudo d9aa57: ( no output ) 15:19
pmurias ruoso: how should i send the gsoc code sample to google? 15:20
szbalint hm. Did I misunderstand it or smartmatching doesn't cooperate with junctions yet?
masak szbalint: seems to me that should work.
szbalint: but I guess it depends on what the inner comparison is. it might be something other than smartmatch.
szbalint rakudo: say "match!" if ("ab" ~~ any("ab", "ba")); 15:26
p6eval rakudo d9aa57: OUTPUT«match!␤»
15:30 Mowah left, amkrankruleuen left 15:34 Italian_Plumber left 15:36 rgrau__ joined
TiMBuS hmmmm is there a way to copy a list when you put it into a hash? 15:37
masak could you be a bit more specific?
TiMBuS %h = (foo => @foos.copy)
masak ah.
.clone
TiMBuS that doesnt seem to work 15:38
masak but please say array next time when you don't mean list :)
TiMBuS my bad
moritz_ foo => [@foos]
masak that might create an array of an array, though.
15:38 rgrau_ left
masak ...I think. 15:38
TiMBuS that's what I thought it would do 15:39
masak seems I'm wrong.
do what moritz_++ says.
TiMBuS done
so what does .clone do? 15:40
masak clones an object.
TiMBuS i guess it has a use elsewhere in perl
masak well, it's a fairly common use case in OO. 15:41
moritz_ my @a = 1, 2, 3; my %h = a => @a.clone; %h<a>.push: 4; say @a.perl 15:42
rakudo: my @a = 1, 2, 3; my %h = a => @a.clone; %h<a>.push: 4; say @a.perl
p6eval rakudo d9aa57: OUTPUT«[1, 2, 3]␤»
moritz_ you see, .clone actually gives you copy
15:42 BaggioKwok joined
TiMBuS rakudo: my @a = <1 2 3>; my $b = @a.clone; $b[1]=4; say @a; 15:43
p6eval rakudo d9aa57: OUTPUT«143␤»
moritz_ that's curious 15:44
TiMBuS im just glad it bugged because I thought I was going crazy 15:45
szbalint ouch :)
TiMBuS crazier
moritz_ did anybody submit it already?
moritz_ still waits for answers to his p6u mail 15:46
szbalint don't get warnocked :)
masak it's a warnock-friendly mail...
masak tries to recall why he didn't write a reply right away
15:47 feiquet left
moritz_ btw the last idea doesn't seem to work out in current rakudo 15:47
TiMBuS i think .clone copies the RPMCA 15:48
masak moritz_: high-level response: I think I'd match all [% %] things with the same rule, but have a closure by its end narrowing down what's accepted. 15:49
including logic involving a stack for nested things.
and an exception for the [% verbatim %] case.
moritz_ but I use a grammar because I don't want to maintain my own stack 15:50
masak that's one of many reasons to use a grammar.
myself, I'd be happy to get the other reasons, and do the stack manually. ymmv. 15:51
moritz_ if I could properly parameterize the rules, I'd be very happy 15:52
15:53 jferrero joined
moritz_ rule nested_command_helper($command, $args = 1, $slurpy = 0) { 15:53
[ $open ~ $close
[<arg> ** $args, <slurpy_arg> ** $slurpy ]
] ~ [ $open ~ $close 'end'$command ]
<chunks>*
}
then I could just use 15:54
<nested_command_helper('setvar', 1, 1)>
etc.
masak I don't grok, but it looks lovely.
moritz_ but currently <arg> ** $args doens't work that way in rakudo
masak doesn't the comma after that have to be escaped or quoted? 15:55
moritz_ you mean in the call?
std: / <alpha(1, 2, 3)> 15:56
p6eval std 32108: OUTPUT«===SORRY!===␤Regex not terminated at /tmp/VtZl5anNiJ line 1 (EOF):␤------> / <alpha(1, 2, 3)>⏏<EOL>␤ expecting quantifier␤Parse failed␤FAILED 00:01 119m␤»
moritz_ std: / <alpha(1, 2, 3)> /
p6eval std 32108: OUTPUT«ok 00:01 119m␤»
moritz_ that's just a normal capture
pmichaud good morning, #perl6 16:02
phenny pmichaud: 28 Aug 09:29Z <moritz_> tell pmichaud when you write a release guide for *, be sure to mention updating rakudo.org/how-to-get-rakudo
moritz_ good morning pmichaud
pmichaud I'm not sure that release managers will always have edit access to the how-to-get-rakudo page; perhaps it would be better to eliminate the direct links altogether. 16:03
moritz_ wfm 16:04
masak +1
moritz_: no, I mean in [<arg> ** $args, <slurpy_arg> ** $slurpy ] 16:05
moritz_ oh yes, the comma should be removed
pmichaud (changing FORBID_PIR from contextual to global) -- doesn't this lose lexical scoping? 16:08
moritz_ I don't think it was ever lexically scoped 16:09
pmichaud well, 'use' is supposed to be lexically scoped.
moritz_ star: { use FORBID_PIR }; pir::printerr__vP("Foo")
p6eval star 2010.07: OUTPUT«===SORRY!===␤pir::op forbidden in safe mode␤␤»
pmichaud anyway, it's fine as global for now. 16:10
pmichaud wonders if it's valid to export a dynvar :-)
that would be.... interesting.
masak can't believe that match failure introspection isn't a more common requirement 16:12
16:13 amiri left
masak right now I'm staring at a Perl 5 regex, wondering why it doesn't match against a given string. 16:14
16:14 amiri joined 16:19 nimiezko left
moritz_ masak: sprinkle it with (?{ print "$`|$&|$'\n" }) statements 16:20
which tell you how far the match proceeded at this part of the regex
masak in the end, I pasted the string on top of the regex, and then pretended to be a regex engine. it helped. 16:21
Juerd moritz_: Isn't it easier to just run perl -Mre=debug on it? :) 16:24
masak ooh, -Mre=debug
16:24 BaggioKwok left
masak I knew there would be a benefit to complaining loudly in here :) 16:25
Juerd++
Juerd I sometimes wonder how people cope without those tools :) 16:26
masak my original point! :)
moritz_ Juerd: I find -Mre=debug too verbose
Juerd Although you are probably all much better programmers than me, and don't run into the need to debug or profile code, look documentation up, etc :) 16:27
Or at least less often
moritz_: It wasn't very readable with my 64 kilobyte regex, indeed :) 16:28
moritz_ Juerd: I hope that was generated? 16:29
Juerd Certainly :)
16:36 patspam joined
TimToady new turtle spirals: rosettacode.org/wiki/Spiral_matrix#Perl_6 16:44
szbalint hehe, rosettacode is like pringles for you TimToady. :) 16:46
masak (lay-egg)++ 16:48
\xF0 what did the 64kb regex do? 16:56
16:59 Italian_Plumber joined
Juerd Why is dir declared as $.dir and then used as $!dir? 16:59
pmichaud $.dir creates $!dir and a public method accessor 17:00
moritz_ $.dir is short for $!dir + "give an accessor"
Juerd \xF0: Match all words that appear, bogglewise, in a 5x5 matrix of letters, between 3 and 7 characters in length
\xF0 haha
17:00 M_o_C joined
Juerd Oh, too bad. I think $.dir is much prettier. 17:01
pmichaud $.dir goes through the accessor interface. 17:02
Juerd Couldn't that be optimized?
pmichaud well, in this case the accessor is read-only
gfldex std: class A {}; A.new().?nosuchmethod();
p6eval std 32108: OUTPUT«ok 00:01 115m␤»
pmichaud it would need to be has $.dir is rw; to have a rw accessor
gfldex rakudo: class A {}; A.new().?nosuchmethod();
p6eval rakudo d9aa57: ( no output )
gfldex rakudo: class A {}; A.new().?nosuchmethod(); say 'flap' xx 3;
pmichaud (and yes, in that case it could be optimized... *if* you can be sure that it's not overridden in a subclass or something) 17:03
p6eval rakudo d9aa57: OUTPUT«flapflapflap␤»
17:05 kid51 left 17:10 amkrankruleuen joined 17:11 espadrine left 17:12 espadrine joined 17:18 Italian_Plumber1 joined 17:19 Italian_Plumber left 17:27 risou__ joined 17:28 risou_ left 17:44 stepnem left, lue joined
lue hello o/ 17:44
masak hi \㋡/
lue .u ㋡ 17:45
phenny U+32E1 CIRCLED KATAKANA TU (㋡)
17:46 stepnem joined, espadrine left, Italian_Plumber1 left
lue so it's supposed to be this, right? -> (ツ) :) 17:46
17:46 Italian_Plumber joined
masak aye :) 17:46
17:50 masak left
TimToady and rosettacode.org/wiki/Zig-zag_matrix#Perl_6 17:52
moritz_ TimToady: did you test that code with rakudo? 17:54
17:55 espadrine` joined 18:11 plluksie left 18:15 stepnem left 18:18 stepnem joined 18:19 lamstyle left 18:22 lamstyle joined
lue would token TOP { [<a>|<b>]+} in a grammar match the entire text to a mix of lines that are either <a> or <b>? 18:24
arnsholt If <a> and <b> match newline at the end, I think so 18:27
18:29 charlyp joined 18:30 M_o_C left 18:36 hans__ joined
lue This is my first time trying to use grammars, and I don't know what I'm getting wrong: gist.github.com/556545 18:37
18:37 envi^home left 18:40 molaf left
lue Could someone take a look at it and see what I'm getting wrong [if I'm getting anything wrong in the first place :)] ? 18:42
18:43 zulon left
Tene I will look 18:43
did you try it with the parsetrace option on? 18:44
18:44 risou__ left
lue eh, no. 18:44
18:45 risou_ joined
Tene lue: you say \S+, but you have items with spaces 18:45
arnsholt Yeah, that's probably it
"the shop" won't match \S+
lue Aah. Putting \N+ there would end up matching the rest of the line, wouldn't it? 18:47
moritz_ lue: it'll be much easier for you if you test the lines individually
right
[<!before '->' > .]+
18:49 risou__ joined
lue looks like I need to read up a lot on regexes :) . Just out of curiousity, what does the ! before `before' mean? 18:49
moritz_ it's a negated assertion
"not before ->"
18:50 risou_ left
moritz_ like (?! ... ) in Perl 5 18:50
lue so, would replacing the [S+] with what you typed be enough? 18:51
Tene not quite. There's a <ws> there too. 18:52
moritz_ right, my regex eats up whitespace too 18:53
Tene maybe [<!before <ws> '->'> .]+
or there's always .+?
18:54 risou__ left 18:55 M_o_C joined, stepnem left 18:56 stepnem joined
lue Testing the two tokens separately, it's the <command> token that's the problem. 18:57
there's something about it that causes it to gobble the entire text. [maybe forcing quotation marks to be around the item and its replacement would help?] 18:59
moritz_ lue: maybe it's easier to just split up the lines, and then split the non-comment lines on '->' with a limit of 2? 19:00
I mean split up into lines 19:01
19:06 hans__ left 19:11 Mowah joined
lue It seems to be working, I just have no way of telling if it is. 19:12
moritz_ why ever not? 19:13
19:17 espadrine` left 19:18 espadrine joined
lue well, in the .perl output, every single orig => line contains the entire text, yet the from => and to => lines have numbers that seem to be indicating the position of whatever's matched. 19:18
And I don't know how to make sure this is the case.
19:19 Snowclone left
moritz_ you can always ask for .Str of a particular submatch to see what it matched 19:19
lue c<say>ing $match<TOP><command><item>.Str results in Any()<0x6811460> 19:20
moritz_ then it didn't match the way you thought 19:21
note that a quantifier always introduces an array
and there's no TOP level 19:22
so likely something like $match<command>[0]<item>.Str
TimToady moritz_: yes, I tested it
moritz_ good 19:23
I noticed that one solution seemed to use NYI-features in rakudo
but I could have been wrong, of course
TimToady they all worked 19:24
moritz_ \o/
TimToady any idea which feature?
moritz_ no 19:25
yay, the code from perlgeek.de/blog-en/perl-6/huffman-....writeback still works 19:30
TimToady lunch & 19:32
lue $<item>=[<!before <ws> '->' > \N]+ <ws> '->' … works just like I want it to :) 19:34
sorear good * #perl6 19:46
19:48 M_o_C left
lue good DateTime.now, sorear o/ 19:48
19:48 M_o_C joined 19:49 stepnem left 19:50 timbunce left, stepnem joined 19:51 nimiezko joined 19:55 timbunce joined
moritz_ rakudo: say Mu.can('Str') 20:03
p6eval rakudo d9aa57: OUTPUT«Method 'can' not found for invocant of class ''␤ in main program body at line 22:/tmp/W9lGj0wBzl␤»
moritz_ rakudo: say Mu.^can('Str')
p6eval rakudo d9aa57: OUTPUT«␤»
moritz_ rakudo: say Any.^can('Str')
p6eval rakudo d9aa57: OUTPUT«Str␤»
charlyp Question: want to dump all var/array/hashes to a file using "print FILEHANDLE $dumper->dumpvars(\*::)" but doesn't work. Whats wrong? 20:06
20:06 whiteknight joined
sorear charlyp: 1. that's Perl 5 code, this is #perl6 2. you should use \%:: 20:09
20:14 M_o_C left, tadzik joined
tadzik oh hai 20:14
charlyp sorear: ok I tried with \%:: and have same result. My problem, if i just use '$dumper->dumpvars(\*::) i got all the stuff on the STDOUT - on the terminal, but i want to put it i a file 20:18
moritz_ charlyp: try a Perl 5 help channel, like #perl 20:19
20:19 slavik left
moritz_ or was it #perlhelp? not sure... 20:19
charlyp ok, will try.with #perl 20:20
sbp it's #perl apparently
lue How do I use a variable in a regex? I'd like to do something like s/@a[0]/'a'/ 20:21
tadzik block should work, no? 20:23
20:24 TiMBuS left
tadzik rakudo: my $a = "foobar"; my $b = "foo"; say $a ~~ s/{$b}/boo/; 20:24
p6eval rakudo d9aa57: OUTPUT«1␤»
tadzik oh noes
rakudo: my $a = "foobar"; my $b = "foo"; $a ~~ s/{$b}/boo/; say $a
p6eval rakudo d9aa57: OUTPUT«boofoobar␤»
tadzik well, I have no clue now
lue rakudo: my $a = "foobar"; my $b = "foo"; $a ~~ s/{make $b}/boo/; say $a 20:25
p6eval rakudo d9aa57: OUTPUT«boofoobar␤»
20:28 TiMBuS joined
lue rakudo: my $a = "foobar"; my @b = <foo bar>; $a ~~ s/@b/boo/; say $a 20:29
p6eval rakudo d9aa57: OUTPUT«foobar␤»
lue rakudo: my $a = "foobar"; my @b = <foo bar>; $a ~~ s/@b[0]/boo/; say $a
p6eval rakudo d9aa57: OUTPUT«foobar␤»
20:30 pugssvn left
lue
.oO(S05 is a big help here :/)
20:31
20:32 pugssvn joined, ChanServ sets mode: +v pugssvn, jaldhar joined 20:33 tri1 joined 20:40 masak joined
masak ahoy \o/ 20:40
szbalint hello there, mariner :)
tadzik oh hai masak 20:41
20:41 amiri left
masak must one really write MAIN($n as Int) rather than MAIN(Int $n)? does the spec weigh in on this? 20:41
masak checks
tadzik I don't think so
there is a difference, isn't it? 20:42
20:42 pugssvn left
tadzik the first is 'casting' to Int, the second expects an Int, no? 20:42
masak yes.
if all we ever got from the command line was Str, when would the latter ever be used? 20:43
tadzik no eye deer
20:44 Ross joined
lue does anyone know how to interpolate variables in regexes, i.e. s/@a[0]/'a'/ 20:45
20:45 pugssvn joined, ChanServ sets mode: +v pugssvn
masak lue: that should work. see S05 for the details. 20:45
20:46 Ross left
lue I did, and it was no help. 20:46
rakudo: my @a = <a b c>; my $b = "hallo"; $b ~~ s/@a[0]/'e'/; say $b; 20:47
p6eval rakudo d9aa57: OUTPUT«hallo␤»
masak rakudo: my @a = <a b c>; my $b = "hallo"; say ?($b ~~ /@a[0]/) 20:48
p6eval rakudo d9aa57: OUTPUT«0␤»
masak rakudo: my @a = <a b c>; my $b = "hallo"; say ?($b ~~ /@a/)
p6eval rakudo d9aa57: OUTPUT«0␤»
masak rakudo: my $a = 'a'; my $b = "hallo"; say ?($b ~~ /$a/)
p6eval rakudo d9aa57: OUTPUT«1␤»
lue hmm. Bug, perhaps? 20:53
masak quite possibly.
rakudo: my @a = 'a'; my $b = "hallo"; say ?($b ~~ /@a/) 20:54
p6eval rakudo d9aa57: OUTPUT«1␤»
masak rakudo: my @a = 'a'; my $b = "a0"; say ?($b ~~ /@a[0]/)
p6eval rakudo d9aa57: OUTPUT«1␤»
masak there you go.
20:54 IcyBee joined
masak rakudo: my @a = 'a'; my $b = "a0"; say ?($b ~~ /^ @a[0] $/) 20:54
p6eval rakudo d9aa57: OUTPUT«1␤»
20:56 IcyBee left
lue rakudo: my @a = 'a','b'; my $b = "hallo"; say ($b ~~ s/@a[0]/'e'/) 20:57
p6eval rakudo d9aa57: OUTPUT«1␤»
lue rakudo: my @a = 'a','b'; my $b = "hallo"; $b ~~ s/@a[0]/'e'/; say $b
p6eval rakudo d9aa57: OUTPUT«hallo␤»
masak lue: my last evaluation shows that /@a[0]/ parses as /@a '0'/
20:58 tri1 left
tadzik rakudo: my @a = 'a','b'; my $b = "hallo"; $b ~~ s{/@a[0]/}'e'/; say $b 21:00
lue yea, I got that.
p6eval rakudo d9aa57: OUTPUT«===SORRY!===␤Confused at line 22, near "$b ~~ s{/@"␤»
tadzik whoops
rakudo: my @a = 'a','b'; my $b = "hallo"; $b ~~ s/{@a[0]}/'e'/; say $b 21:01
p6eval rakudo d9aa57: OUTPUT«'e'hallo␤»
tadzik duh, I get it all wrong with blocks as far as I can see
masak tadzik: how's the studying going? 21:02
tadzik masak: not bad, there was some R³ geometry today
that's in our linear algebra program too 21:03
planning either Jordan's matrix, or Complex numbers and ortoghonalization tomorrow
(I'm trying to translate the terms I know, let me know if I get it wrong)
lue masak: would that parsing be considered a bug? 21:04
masak lue: I'm pretty sure it would.
but most likely, it's a TODO.
lue If I remember right, a similar problem occurs in string interpolation. 21:07
rakudo: my @a = <a b c>; say "I know the letter @a[0]."
p6eval rakudo d9aa57: OUTPUT«I know the letter a.␤» 21:08
masak seems fine to me.
lue Hm, guess not.
masak that used to not work, but jnthn++ implemented it a few months ago.
lue rakudo: my @a = <a b c>; my $b = "hallo"; $b ~~ s/"@a[0]"/e/; say $b; # please work 21:09
p6eval rakudo d9aa57: OUTPUT«hallo␤»
masak lue: do 'my $x = @a[0]' and then use $x in your regex. 21:10
tadzik g'night #6 21:13
21:13 tadzik left
masak sleep sweetly, tadzik. dream of non-zero determinants. 21:13
21:16 Guest23195 left
sorear does anyone use "std", the script? 21:16
lue I do every once in a while, when I'm not sure if the code I have should even parse. 21:18
masak: I know, I guess I'll have to do that.
21:19 pugssvn left
lue afk 21:19
21:20 charlyp left
sorear I'm about to delete std 21:20
replaced with 5 lines of code in viv --compile-setting 21:21
everything else std does, tryfile does better
21:21 pugssvn joined, ChanServ sets mode: +v pugssvn
masak +1 21:21
TimToady tryfile is a stupid name for a compiler
oh, that's not what you said... :) 21:22
sorear the real reason I'm doing this is to deduplicate the 20 lines of entry point code
which is about to get much bigger as I make viv installable 21:23
masak TimToady: are all things coming in as MAIN parameters typed Str? 21:24
21:24 Eevee left
TimToady I suppose, but maybe we can come up with something a bit dwimmier. 21:26
masak I"m currently of two minds about it myself.
TimToady yeah... 21:27
masak I think just to see what happens, I'd like Str which look like Int to typematch as Int, and ditto Num. but they should still typematch as Str even if they look like numbers. 21:31
21:31 lichtkind joined
TimToady just like the currently specced semantics of <...> 21:31
masak maybe there's a common denominator there somewhere.
sorear perl 5 and Tcl beleive that 3 === "3"
TimToady yes, things we are forced to write as text
sorear perl 6 and python believe the opposite 21:32
TimToady perl 6 believes lotsa things :)
I think minimally if you do string operators on the value, it should use the original string value, whether or not it thinks it is a string 21:33
masak not sure I see where that would make a difference, but it sounds sane-ish.
TimToady well, the question arises when you do multi type matching, will it match Str stronger than, say, Int 21:34
Int should be stronger, but Str somehow available
masak oh, didn't think of multi.
the question is really what mechanism does the type fudging, and how it meshes with multi. 21:35
TimToady otoh, if you're writing such a MAIN sig, you should probably just leave the type off if that's what you mean
I suspect the fudging is predispatch, much as with <1 2.3>
similar considerations for "SOME TEXT" to be born as ascii that knows how to Buf and Str 21:36
masak well, my initial reaction was that it was a waste of semantic space never to be able to use 'sub MAIN(Int $x)'
ASCII literals, yes.
"use-based polymorphism" :) 21:37
TimToady possibly even latin-1 buf8 literals
pugssvn r32110 | sorear++ | [std] Fold setting-compiler functionality into viv; remove in favor of tryfile 21:41
TimToady by which I mean a latin1 buffer type like we have utf8 buffer type
so the type is not ambiguous
if we did that, we wouldn't need an ascii buf type probably
bbl &
perigrin ponders how a fuzzy type inference engine would work
arnsholt perigrin: Weirdly? =) 21:43
masak we want to find a balance between least-surprise and weird here. :) 21:44
perigrin arnsholt: there are a lot of things in this world that work Weirdley that I think may just be a kind of awesome I can't comprehend yet. 21:46
Haskell for example.
masak that's how most of us feel about Haskell. :)
pmichaud I wonder if trying to use "Int" to match a Str holding an integer goes a bit too far. Seem like maybe we want another (subset) type, like StrInt 21:47
masak pmichaud: I'm not suggesting it as a general thing.
pmichaud ah
masak pmichaud: only things coming in through MAIN
pmichaud: since right now there's no way to pass in an Int.
pmichaud well, there are lots of other places that this occurs... like prompts 21:49
my $age = prompt "Enter your age: "; calculate-benefit($age)
21:49 timbunce left
perigrin is that a problem in practice? Can perl6 coerce 6 from "6"? (and the next question is can it coerce 6 from "six" and "VI"...) 21:49
masak for some reason, prompts feel naturally Str-y.
pmichaud masak: sure, but plenty of people will likely want to say ...and only accept Int-valued Strs. 21:50
masak perigrin: I don't think that's the next question. :)
perigrin masak: hmm depends on which of us is asking it :)
pmichaud It happens in the same way that <1 2 3> surprises people by being Str and not Int (before the spec changes that made them be "both")
sorear perigrin: "6" is not an Int 21:51
masak oh dear. I had repressed the memory of that change. :/
perigrin sorear: I didn't say it was ... in fact I know it's not.
pmichaud I keep hoping it'll change again :)
sorear perigrin: this is the single biggest difference between Perl 6 and Perl 5, imo
pmichaud in some ways, what someone really wants to say is MAIN(Cool $value as Int)
perigrin sorear: I specifically asked if it could be *coerced* from "6"
pmichaud but that's not really it either 21:52
sorear perigrin: perl 6 doesn't have a single concept of coercion yet
perigrin :(
pmichaud one can certainly do "6".Numeric
or even +"6"
but what we're looking for here is something like Str where $_.Numeric ~~ Int 21:53
perigrin pmichaud: as I (slowly) learn about Type systems one of the things that I'm discovering is totally under valued in the Moose type system are the coercions 21:54
21:54 timbunce joined
masak perigrin: please do share. 21:54
ash_ is there a .Numeric and a .Num? 21:55
phenny ash_: 28 Aug 10:22Z <moritz_> tell ash_ that I made FORBID_PIR persist between REPL lines
pmichaud ash_: yes
(maybe NYI in rakudo) 21:56
rakudo: say "6".Numeric
p6eval rakudo d9aa57: OUTPUT«6␤»
ash_ i guess Numeric is all of the num-ish types?
pmichaud rakudo: say "6".Numeric.What
p6eval rakudo d9aa57: OUTPUT«Method 'What' not found for invocant of class 'Num'␤ in main program body at line 22:/tmp/hbJO_bra0k␤»
pmichaud rakudo: say "6".Numeric.WHAT
p6eval rakudo d9aa57: OUTPUT«Num()␤»
pmichaud that's likely wrong there.
colomon that's a bug, probably
pmichaud Should be Int().
masak ash_: Numeric is "anything that's a scalar number". Num is a floating-point value.
masak submits rakudobug 21:57
ash_ masak: by num-ish i meant number like, not specifically Num
sorear I thought that was Real
masak ash_: that's Numeric.
sorear Numeric includes vector numbers
masak pmichaud: oh wait. that's a really old, known one.
pmichaud masak: yes, it's in my list of "things I'd really like to clean up soon"
along with Stringy
masak sorear: I'm quoting S32/Numeric:57. 21:58
perigrin masak: you'll have to forgive my psudeo code but the idea that one can provide an explicit hint on how to convert a Str to an Int: coerce Int from Str via { $_.Numeric.floor }
pmichaud since I just finished my last summer conference yesterday, I'm hoping to do less traveling and more hacking (as in bug fixing) soon.
perigrin for example
21:58 nimiezko left
pmichaud perigrin: in p6, I belive that's the .Int method of Str 21:58
*believe 21:59
perigrin p6's typesystem is much more integrated than Moose's
colomon star: say "6".Int
pmichaud (or perhaps I'm misunderstanding what you're suggesting/asking)
p6eval star 2010.07: OUTPUT«6␤»
colomon star: say "6".Int.WHAT
p6eval star 2010.07: OUTPUT«Int()␤»
colomon star: say "6.32".Int.WHAT
p6eval star 2010.07: OUTPUT«Int()␤»
sorear perigrin: coercions in Perl 6 are what we call slushy
ash_ rakudo: say "123.456" + "1"
p6eval rakudo d9aa57: OUTPUT«124.456␤»
sorear perigrin: that means that anybody with initiative can claim them
perigrin: do you want absolute power over designing the coercion system? 22:00
pmichaud "absolute power" is a myth :-)
perigrin the last time I took intiative I started my own business ... I'm still recovering from this :)
sorear I was planning to lure stevan in here and give it to him, but ...
colomon pmichaud: did you run out of conferences, or run out of summer? ;)
masak rakudo: say "foo".Int
p6eval rakudo d9aa57: OUTPUT«0␤»
ash_ rakudo: say "foo" + 'bar' + 123 + True 22:01
p6eval rakudo d9aa57: OUTPUT«124␤»
ash_ i can reason why True = 1, but i always find it funny when I do: True + True = 2
it makes sense, just funny
rakudo: say True + True 22:02
p6eval rakudo d9aa57: OUTPUT«2␤»
sorear perl 6 totally ought to define +True = -1 a la Pascal
perigrin ash_: 2 is *very* double true.
22:02 Mowah left
colomon hmmm. why do Str.Int and Str.Num exist? 22:03
pmichaud colomon: out of conferences. Summer still has three weeks left. :)
perigrin didn't I read somewhere in a synopsis that if you try assinging an Int to a Str for example it will try calling .Int and assinging the result? 22:05
pmichaud it'll type fail.
rakudo: my Str $x = 5;
p6eval rakudo d9aa57: OUTPUT«Type check failed for assignment␤ in '&infix:<=>' at line 1␤ in main program body at line 22:/tmp/LkRpK2iUzB␤»
perigrin rakudo: say 5.Str
p6eval rakudo d9aa57: OUTPUT«5␤» 22:06
perigrin rakudo: my Str $x = 5.Str
p6eval rakudo d9aa57: ( no output )
perigrin rakudo: my Str $x = 5.Str; say $x;
colomon (just to make it clear -- I don't have anything against Str.Int, I'm just wondering why it's not Cool.Int instead. And the answer may be as simple as "colomon overlooked it".)
p6eval rakudo d9aa57: OUTPUT«5␤»
perigrin pmichaud: perhaps a trait is coercable would make that not type fail but instead try ? 22:07
possibly one with y'know a better spelling
pmichaud perigrin: yes, we've been exploring something like that -- haven't come up with anything concrete yet (thus sorear++ is absolutely correct when he says it's slushy :-) 22:08
in signatures, one can do "as Type" to do a coercsion
*coercion
thus sub abc($x as Int) { ... }
perigrin Int $x is Coercible would be the same thing I suspect 22:09
but generic :)
pmichaud there was discussion about this starting near irclog.perlgeek.de/perl6/2010-08-09#i_2679700 22:11
my coerced Num $x and my Num $x is coerced 22:12
or something like that
It's one of those ongoing questions that the language implementors get to torment the language designer with :-) 22:13
22:14 jhuni joined
perigrin :) 22:16
honestly I quite like $value.Type it seems to fit in with how lots of other things work in perl6 22:18
the only prior art I've personally worked with is Moose 22:21
which keeps the Type Constraint and the coercion orthogonal in that unless you explicitly enable coercion you don't get it
(we have an attribute trait: coerce => 1 to enable it)
22:22 christine left
masak well, in Perl 6 you also have to explicitly enable coercion with 'as SomeOtherType'. 22:23
perigrin er and in MooseX::Declare you can say is coerce in a method signature
masak: I'm kinda responding to the stuff pmichaud commented on in the irclog ... it seemd 'as Type' was part of the slushy-ness 22:24
masak as far as I'm aware, any type constraint must still match just as strictly. if it does, *then* the coercion is done.
perigrin which side? with a coercion there is always two ... master and app...er from and to 22:25
masak the type constraint is still on the incoming, pre-coercion value. 22:26
perigrin in Moose yes ... if you convert from Foo to Bar ... you must match Foo ... there isn't a concept of non-strict matching of Foo
when you're done you either get a type failure
or something that matches Bar
type constraint matching in Perl is boolean ... 22:27
s/Perl/Moose/ 22:28
bah sorry
22:29 yrgd left
ash_ MooseX::Declare won't install cleanly on OS X with 5.12 22:31
anyone, thats kinda off topic
anyway*
perigrin I have it on mine I think.
yeah
and I'm on 5.12.1
ash_ i always get test failures, so cpan doesn't want to install it, its not needed by anything i am using, just a nice to have, but i can live without it 22:32
sorear -f 22:34
perigrin ash_: yeah I never use it directly myself except for testing and for writing code examples because the syntax is much nicer.
22:35 pmurias left 22:39 Chillance joined 22:46 rgrau__ left
masak rakudo: say ~<teeka tok teek>.pick(8, :replace) 22:48
p6eval rakudo d9aa57: OUTPUT«teeka teeka tok teeka tok teek teeka tok␤»
masak :D
masak pipes that script into his speech synthesizer
pugssvn r32111 | sorear++ | [STDeco] add a concept of standard syml files for viv, found in the installed data dir; several small refactors 22:52
22:53 rgrau_ joined 22:56 yrgd joined 22:58 timbunce left
pugssvn r32112 | sorear++ | [CursorBase] If a module is found in a readonly syml dir, don't look for the .pm 23:05
arnsholt Is it only infix operators that support :nextterm in nqp-rx? 23:08
pugssvn r32113 | sorear++ | [viv] add a --check/-c mode so viv can subsume tryfile, too
r32114 | sorear++ | [viv] Improve documentation a bit 23:25
masak rakudo: "" ~~ /x/; make []; ~$/.ast<c> 23:26
p6eval rakudo d9aa57: OUTPUT«postcircumfix:<Nil()> not defined for type Array()␤ in main program body at line 1␤»
masak hah! got you, bug!
yeah!
masak slams it into RT!
rakudo: my @a; @a<foo> = "bar" 23:27
p6eval rakudo d9aa57: OUTPUT«Cannot modify readonly value␤ in '&infix:<=>' at line 1␤ in main program body at line 22:/tmp/cAkoixwzac␤» 23:28
masak hm. also a bit LTA.
rakudo: my @a; say @a<foo>.WHAT
p6eval rakudo d9aa57: OUTPUT«Failure()␤»
masak yeah, that'd be readonly.
masak doesn't report that one
23:29 _jaldhar joined 23:33 jaldhar left
masak rakudo: ~[]<c> 23:33
p6eval rakudo d9aa57: OUTPUT«postcircumfix:<Nil()> not defined for type Array()␤ in main program body at line 1␤»
masak ooh, much shorter.
rakudo: ~[]<>
p6eval rakudo d9aa57: ( no output )
masak rakudo: ~5<c> 23:39
p6eval rakudo d9aa57: OUTPUT«postcircumfix:<Nil()> not defined for type Int()␤ in main program body at line 1␤»
masak rakudo: ~5{'c'}
p6eval rakudo d9aa57: OUTPUT«postcircumfix:<Nil()> not defined for type Int()␤ in main program body at line 1␤»
pugssvn r32115 | sorear++ | [STD-dist] Install standard syml files; install viv as an executable 23:41
sorear STD 32115 pushed to CPAN 23:42
masak \o/ 23:44
sorear++
sorear If a Perl script is installed executable on Win32, how can I run it? 23:45
Will the toolchain somehow make "viv" work?
23:46 meppl left