»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'perl6: say 3;' or rakudo:, niecza:, std:, or /msg p6eval perl6: ... | irclog: irc.perl6.org/ | UTF-8 is our friend!
Set by sorear on 4 February 2011.
japhb std: :16<> 02:16
p6eval std be1f10e: OUTPUT«===SORRY!===␤Malformed radix number at /tmp/4Lh9hezrLS line 1:␤------> :16<⏏>␤ expecting any of:␤ number in radix notation␤ statement end␤ statement list␤Parse failed␤FAILED 00:01 118m␤»
japhb std: :16[]
p6eval std be1f10e: OUTPUT«ok 00:01 119m␤»
japhb Any reason that the first shouldn't DWIM like the second does?
patch nom: say [+] 1..^10 02:57
p6eval nom 198513: OUTPUT«45␤» 02:58
patch nom: say [+] (1..^10).grep(* %% (3|5)) 02:59
p6eval nom 198513: OUTPUT«23␤»
patch nom: say [+] (1, 2, * + * ... * < 100).grep(* %% 2) 03:02
p6eval nom 198513: OUTPUT«0␤»
patch nom: say join ',', (1, 2, * + * ... * < 100) 03:04
p6eval nom 198513: OUTPUT«1␤»
TimToady ... is an "until", not a "while" 03:10
patch nom: say [+] (1, 2, * + * ... * > 100).grep(* %% 2) 03:18
p6eval nom 198513: OUTPUT«188␤»
patch TimToady: thanks!
TimToady no, thank you! :) 03:19
patch nom: say (1..*).first( * %% all(1..4) ); 03:24
p6eval nom 198513: OUTPUT«12␤»
dalek odel: d1240fb | diakopter++ | lua/compiler/LST2Lua.pm:
typo
03:28
patch nom: say (2,3,5,7,11 ... 29).perl 05:11
p6eval nom 198513: OUTPUT«(2, 3, 5, 7, 11, Failure.new()).list␤»
patch nom: say join ',', (2,3,5,7,11 ... 29) 05:12
p6eval nom 198513: OUTPUT«unable to deduce sequence␤ in sub <anon> at src/gen/CORE.setting:7812␤ in sub coro at src/gen/CORE.setting:4154␤ in method reify at src/gen/CORE.setting:4128␤ in method reify at src/gen/CORE.setting:3913␤ in method reify at src/gen/CORE.setting:3913␤ in method r…
moritz patch: only arithmetic and geometric sequences are regocnized 05:54
sorear (by spec)
o/ worr 05:55
dalek p/bigint: 8534217 | moritz++ | src/ (2 files):
add nqp::radix_I alias, fix op name
06:30
moritz perl6: say +^0xdead 06:40
p6eval pugs b927740, rakudo 198513, niecza v11-22-gbebf7a0: OUTPUT«-57006␤»
Tene jnthn: friend of mine found a bug: gist.github.com/1354278 06:44
patch moritz: has perl6-examples been abandoned? 06:48
moritz patch: mostly, yes 06:49
patch so, no use for new euler solutions or corrections to old examples? 06:50
moritz well, you can revive it 06:54
moritz I mostly meant that currently nobody maintains it 06:55
patch i'd like to help with that 06:56
moritz patch: do you have commit access already?
patch moritz: no, i'm patch on github. 06:57
moritz patch: now you have. Have fun! 06:58
patch moritz: thanks! 06:58
sorear wonders if patch is named after TimToady's program 07:00
sorear -> sleep
patch wonders if TimToady's program is named after himself 07:03
Woodi maybe not totally of topic: www.garfield.com/comics/todayscomic.html 07:40
masak morning, #perl6 07:48
Tene midnight, masak :) 07:48
masak :) 07:49
masak .oO( Phase Off )
moritz: #103258 looks a bit familiar. I wonder if that isn't a dupe. 08:12
[Coke]: have you seen it before?
masak I'm still thinking about lichtkind's Documentation-Driven Development idea. 08:38
it seems a good idea to divert at least some of the initial energy of a project into writing user docs. at least as long as that itself doesn't kill the project. 08:39
after that, it seems that the challenge is to have the documentation stay in sync with user-visible redesigns.
moritz well, it seems to be prone to the same problems as waterfall development 08:40
masak I don't know about that. there's a difference between laying out the whole user experience up front and laying out the whole design up front. 08:41
the former seems to me like a net good and that it's often done too seldom -- to the detriment of UIs. 08:42
moritz well, design first suffers from the problem that you often have an imprecise idea of what the program should do in the end 08:46
and if you don't know that (or aren't deep enough into the problem domain), how can you spec the UI with more confidence than the other parts of the software design? 08:47
masak no, one probably can't. 08:49
moritz nom: say '(a' ~~ /'(' ~ ')' <alpha> /
p6eval nom 198513: OUTPUT«=> <(>␤␤»
masak which is why I like spike solutions and prototypes as a first step.
moritz it seems ~ is just NYI in qregex 08:49
I can't find its action method
masak oh!
but the above match is strange.
moritz it's what I'd expect when the action method is missing 08:50
it just ignores the ~, goal and expression
hm
nom: say '(a)' ~~ /'(' ~ ')' <alpha> /
p6eval nom 198513: OUTPUT«=> <(>␤␤»
moritz right 08:51
masak I'm not so sure I like Match.gist doing something other than Match.Str 08:52
I found the former behaviour more useful.
the above => <(>␤ is just confusing to look at. 08:53
moritz masak: wait until you're developing grammars
masak well.
I tend to use regexes outside of grammars, so that argument doesn't really convince me. :/ 08:54
moritz currently it's a tradoff of which you see only the one half
masak right.
I'm saying I don't like that half.
specifically, I don't like a '=>' without an LHS.
that looks wrong and lazy.
moritz if you find a way to make it nice of regexes, and still as informative for deeper match trees, please do so 08:55
masak feels like that ought to be possible.
moritz maybe rename the current method gist to 'pretty', and then add a .gist which does some magic check, and either delegates to .Str or to .pretty 08:59
masak right.
moritz fwiw the rationale for the => without the LHS is that we don't know (or don't have) the name of the current regex, which would be on the left of the =>
masak yes, I see that.
moritz nom: 'abc' ~~ /<alpha>+/; say $/
p6eval nom 198513: OUTPUT«=> <abc>␤ alpha => <a>␤ alpha => <b>␤ alpha => <c>␤␤»
masak er. 09:00
good example of why it doesn't work ;)
moritz huh?
please try it on a console, with proper indenting
masak should be 'alpha => [<a>, <b>, <c>]', no?
moritz should it? maybe :-) 09:01
masak or maybe you consider the present layout a feature...
masak wishes he had more time to be involved when these changes happen :/
moritz it's not like it's set in store or so 09:02
improvements are always possible
should probablye be alpha => 0 => <a> 1 => <b> 2 => <c> 09:03
masak that looks wrong, too :/
moritz why? 09:04
masak specifically, not enough grouping.
moritz I've left out the grouping by indenting here
masak the problem with having those on the same line is if they contain further subrules.
moritz yes, should have newlines
masak generally, I have the feeling we're inventing Data::Dumper, and not making an excellent job at it. 09:06
moritz Data::Dumper is more about round-tripping than about presentation 09:07
masak hm.
I must confess I do not often use it for its round-tripping capabilities. 09:08
I use it quite often to look into nested data structures.
moritz the leading $VAR1 = would be quite unnecessary for the presentation aspect 09:13
nom: my Int $x = 3; my num $y = $x; say $y 09:21
p6eval nom 198513: OUTPUT«3␤»
masak moritz: let's try to clear up the solution space by dividing the possible solutions into Bracket Stringifications and Indented Stringifications. I agree that an indented stringification is a good thing to have. I'm not so sure I'd like it to be in .gist 09:45
moritz masak: I find bracket-only stringifications (no indention) unreadable for larger match trees 09:48
there's .perl for that already
masak good point.
mls morning! 09:49
masak morning, mls!
moritz o/
dalek p/bigint: 98cf1db | moritz++ | src/ops/nqp_bigint.ops:
correct docs for nqp_bigint_radix
masak moritz: I don't know if I'm just used to stringification of Match giving the matched substring, or if it's a genuinely useful, defendable behaviour. I do know I'll miss it. 09:50
moritz stringification of Match still gives you the matched substring.
mls (Data::Dumper uses the $VAR1 to show cyclic references)
moritz ... even if there are no cyclic references 09:51
masak moritz: right, but now we have two stringifications: .Str and .gist
dalek kudo/bigint: ffa2fe7 | moritz++ | src/core/Rat.pm:
[Rat] avoid going through Num for .Int
09:52
kudo/bigint: 17b3fc8 | moritz++ | / (2 files):
use nqp::radix_I in Str.Numeric

Fixes S32-str/numeric.t again
moritz $ ./perl6 -e 'say ":16<FFFFFFFFFFFFFFFFFF>".Numeric'
4722366482869645213695
moritz rakudo: say ":16<FFFFFFFFFFFFFFFFFF>".Numeric 09:56
p6eval rakudo 198513: OUTPUT«4.72236648286965e+21␤»
moritz masak: right, and .gist is supposed to provide more interesting information besides the raw stringification
which is why .gist on a type object doesn't return the empty string 09:57
but rather Int() or so
masak sure, but something like 'MATCH:[foo]' would also be more interesting information. and less verbose. 09:59
there's nothing a priori that says .gist needs to output an indented match tree.
moritz right, but people in here expressed their desire for better inspection of match trees, so it seems like a natural fit 10:00
masak it might be a good/popular idea. we'll see. 10:08
it would be nice if it didn't make non-grammar regex .gist-ification noisy, though. 10:09
masak egonw, jonalv: this might interest you: www.youtube.com/watch?v=vcXUrNSvjhU 10:43
a few years old, but I remember it as good.
masak er. sorry, ww. 10:56
moritz still looks interesting :-)
masak irssi advantage -- can handle many conversations simultaneously. disadvantage -- sometimes things end up in the wrong window... 10:57
moritz jnthn: I see some difficulties with parsing Int literals. We need to have a bigint type available in Actions.pm to create the Int constants from literals 11:05
jnthn: but of course we don't have them yet, and I guess we want to parse numbers before we set up Int. Should we create some NQPBigInt type for bootstrapping, and define some conversion to Int? 11:06
masak xkcd tackles YAGNI: xkcd.com/974/ 12:17
masak I find the title attribute especially insightful. getting things right should always be done in the past, preferably :) 12:18
moritz time machines will make it possible 12:21
OTOH the fact that we don't have time machines yet means that nobody from the future invented one, and brought them to us 12:22
so it's unlikely we'll ever get them :/
japhb: at your convenience, please review github.com/rakudo/rakudo/commit/17...73c2a3716a 12:23
moritz the 'Perl 6' page on wikipedia does not mention Niecza. I'd like to call the lurkers in here to action to change that :-) 13:01
masak ++lurkers 13:02
moritz perl6.wikia.com/wiki/Constructor could also use some love :-) 13:04
could link to perlgeek.de/blog-en/perl-6/object-c...ation.html for example 13:06
masak ooh - so *that's* where the idea of "a routine should only have one exit point" comes from! programmers.stackexchange.com/quest...717#118717 13:08
(I thought it was the Structured Programming movement)
moritz curious 13:10
masak yes. beware of memes that outlive their usefulness. 13:12
moritz I had my "single point of exit" epiphany with Eiffel 13:13
moritz I wrote a small game, and that needed a routine to verify if a move was correct 13:14
moritz and that's a classical case where early exit is useful 13:14
you can do thing like return False if $x1 != $x2 || $y1 != $y2;
subsequent validation might require that previous checks succeeded 13:15
but Eiffel enforces single point of exit
moritz so I had to do something really ugly 13:15
a variable that remembered the check state, and doing an 'if' around each check except the first
and then I knew that it wasn't any easier to read or reason about that way 13:16
Juerd I love having multiple returns
And often I write it with "or" and "and" 13:17
sub { condition or return; condition or return; condition or return; return 1; }
masak I love multiple returns too. I'd probably lean towards statement-ending unless in that case, though. 13:18
not religious about it; just a habit.
arnsholt I'd probably go for statement-ending if with negated condition, I think 13:19
flussence I only use the "or return" thing in languages that don't have postfix conditionals :)
Juerd IIRC PBP wants you to use statement modifiers, because program flow is important and should stand out when skimming the beginnings of lines.
masak right.
that's probably where I got it from.
and it's not just routines which return booleans -- this pattern works for all kinds of case-based processing.
Juerd But to me, the condition seems more important. I've never written return unless open my $fh, "foo"; It's always open my $fh, "foo" or return; 13:20
masak for example, deciding where to line-break a long string.
masak Juerd: I'd 'die' or 'fail' there, not 'return'. 13:20
flussence (having said that, I prefer use autodie; over both...)
moritz Juerd: that's because open() is not executed primary for its return value in p5
arnsholt Juerd: I feel it's more important to highlight the fact that we can return at this point 13:21
moritz that's why it feels so weird in conditions
moritz I might do 13:21
my $success = open my $fh, '<', $filename; 13:22
return unless $success;
rest of the thing here
Juerd masak: In Perl 5 I can never decide between throwing exceptions and returning undef...
masak heh :) 13:23
[Coke] point to java, then. ;) 13:24
Juerd arnsholt: Hm, maybe it's because I tend to keep subs short, that it's always really obvious that there are multiple return points.
masak niecza: grammar G { token TOP { <var> | <var> \+ \d+ }; token var { \% $<name>=[\w+] \% { say 42 } } }; say ?G.parse("%foo%+1") # matches, fine 13:28
p6eval niecza v11-22-gbebf7a0: OUTPUT«42␤42␤Bool::True␤»
masak niecza: grammar G { token TOP { <subrule> }; token subrule { <var> | <var> \+ \d+ }; token var { \% $<name>=[\w+] \% { say 42 } } }; say ?G.parse("%foo%+1") # doesn't match, and I think it's a bug
p6eval niecza v11-22-gbebf7a0: OUTPUT«42␤Bool::False␤»
masak all I've done is move the alternation down into a subrule. 13:29
that shouldn't make a difference, should it?
niecza: grammar G { token TOP { <subrule> }; token subrule { <var> \+ \d+ | <var> }; token var { \% $<name>=[\w+] \% { say 42 } } }; say ?G.parse("%foo%+1") # matches again
p6eval niecza v11-22-gbebf7a0: OUTPUT«42␤Bool::True␤»
moritz wants a word diff for IRC 13:30
masak I have no intuition for when order matters with infix:<|> in grammars.
this seems (rightly or wrongly) to be one such case.
masak sorear: ^^ 13:31
masak re-reads the relevant part of S05 13:32
benabik I think | is supposed to do LTM and || is supposed to try in order.
masak right. I'm with you that far.
arnsholt masak: I think the inlined code makes both branches have the same declarative prefix 13:33
masak oh!
benabik So order shouldn't matter with |, right?
masak yes.
arnsholt++ # that's it, of course
so I have to think about this from the viewpoint of the declarative prefixes of the transitive alternations.
so, no bug. 13:34
niecza: grammar G { token TOP { <subrule> }; token subrule { <var> | <var> \+ \d+ }; token var { \% $<name>=[\w+] \% } }; say ?G.parse("%foo%+1") 13:35
arnsholt Yeah, LTM is all about the prefixes (as far as I can make out)
p6eval niecza v11-22-gbebf7a0: OUTPUT«Bool::True␤»
masak right; without the code block it goes down the right branch.
question is more: why does it discard the right branch when the code block is there? 13:36
hm... maybe 'cus of the ratcheting implied by 'token'? 13:38
niecza: grammar G { regex TOP { <subrule> }; regex subrule { <var> | <var> \+ \d+ }; regex var { \% $<name>=[\w+] \% { say 42 } } }; say ?G.parse("%foo%+1") # doesn't match, and I think it's a bug
p6eval niecza v11-22-gbebf7a0: OUTPUT«42␤42␤Bool::True␤»
masak seems so.
yeah; no bugs anywhere. keep up the good work, sorear++ :) 13:39
moritz perl6: say 123 ** 42 13:55
p6eval rakudo 198513: OUTPUT«-9223372036854775808␤»
..pugs b927740, niecza v11-22-gbebf7a0: OUTPUT«5970554685064519004265641008828923248442340700473500698131071806779372733915289638628729␤»
moritz has a test case for pow_I 13:56
masak someone could make a good blog post just by translating these Perl 5 one-liners to Perl 6: www.catonmat.net/blog/perl-one-line...-part-six/ 14:13
as a bonus, explaining on the way why certain special variables are dead and gone, and what we use instead, and why it's better. :) 14:14
dalek p/bigint: cf9144d | moritz++ | src/ops/nqp_bigint.ops:
fix spelling of base_core, though it does not seem to make a difference
14:18
p/bigint: caacd56 | moritz++ | / (3 files):
First shot at a "smart" nqp::pow_I opcode

The idea is to return either a bigint or a float (for the +-Inf case, and when the exponent is negative).
The float part isn't tested yet, so likely wrong. The part that returns bigints has sparse test coverage, so it might be not too far off.
moritz www.perlmonks.org/?node_id=937320 might be fun to come up with a Perl 6 solution 14:22
masak feels like a bitmask problem. 14:27
oh, but maybe you're not interested in the ways in which bases are ambiguous? 14:28
what happens in the problem if two sequences have an ambiguous base at the same locus? 14:30
moritz unspecified 14:31
erm, I meant to say: Mu
PerlJam clearly you get a junction :)
masak demons out my nose. 14:32
reason I said "bitmask problem" was that my first view of the ambiguous base specifiers was that they represented bitmasks of ACGT possibles. 14:33
and merging would then simply be some kind of joining (probably using infix:<+|>) of these.
if I were to write a solution, I'd probably write one that did that. 14:34
moritz nom: print for <A C G T> X~| <A C G T>
p6eval nom 198513: ( no output )
moritz nom: .print for <A C G T> X~| <A C G T>
p6eval nom 198513: OUTPUT«ACGUCCGWGGGWUWWT»
masak you may or may not have taken me too literally there :P
moritz nom: my %seen; %seen{$_} = 1 for (<A C G T> X~| <A C G T>); say %seen.keys.sort 14:35
p6eval nom 198513: OUTPUT«A C G T U W␤»
masak nom: say .ord.fmt("%b") for <A C G T>
p6eval nom 198513: OUTPUT«1000001␤1000011␤1000111␤1010100␤»
masak nom: say .ord.fmt("%b") for <U W> 14:36
p6eval nom 198513: OUTPUT«1010101␤1010111␤»
masak liked avdi.org/talks/confident-code-rubymidwest-2011/ 14:57
it expresses something that I've wanted to be able to express for some time now. 14:58
HN thread with link to video: news.ycombinator.com/item?id=3218882
clsn Has this problem in rakudo been noted yet? gist.github.com/1354278 14:59
moritz oh noes, not another "for loops, recursion and lexicals mix badly" bug :( 15:00
masak I thought we decided not to have any more of those 15:01
moritz clsn: please submit that as a bug report to [email@hidden.address]
clsn Maybe we just shouldn't write so much with for loops and recursion. Looping structures are for doing the same things over and over again anyway. You should just do something right once and be done. :) 15:02
moritz: Thanks for letting me know it's worth reporting.
masak waitwait.
I agree with the lower output. 15:03
moritz why? $h is declared inside sub recur
masak yeah.
on second thought, I don't.
moritz $counter is shared, $h is private
masak rakudo: my $c = 0; sub r($n) { return if !$n; $h = $c; r($n-1); say $h }; r 3 15:04
p6eval rakudo 198513: OUTPUT«===SORRY!===␤Variable $h is not predeclared at line 1, near " = $c; r($"␤»
masak rakudo: my $c = 0; sub r($n) { return if !$n; my $h = $c; r($n-1); say $h }; r 3
p6eval rakudo 198513: OUTPUT«0␤0␤0␤»
masak er :)
rakudo: my $c = 0; sub r($n) { return if !$n; my $h = ++$c; r($n-1); say $h }; r 3 15:05
p6eval rakudo 198513: OUTPUT«3␤2␤1␤»
masak rakudo: my $c = 0; sub r($n) { return if !$n; my $h = 'h' ~ $c; $c++; r($n-1); say $h }; r 3
moritz wonders if a bisect could help
p6eval rakudo 198513: OUTPUT«h2␤h1␤h0␤»
masak hm
rakudo: my $c = 0; sub r($n) { return if !$n; my $h = 'h' ~ $c; $c++; my @k = 1, 6; r($n-1); for @k { say $h } }; r 3 15:06
p6eval rakudo 198513: OUTPUT«Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤»
masak o.O
PerlJam perhaps I've seen too many commercials for Subway because all those Any() make me expect a subsequent "5 dollar foot long"
masak rakudo: my $c = 0; sub r($n) { return if !$n; my $h = 'h' ~ $c; $c++; my @k = 1, 6; r($n-1); for @k { say "$_ and h is $h" } }; r 3 15:07
p6eval rakudo 198513: OUTPUT«Use of uninitialized value in string context␤1 and h is ␤Use of uninitialized value in string context␤6 and h is ␤Use of uninitialized value in string context␤1 and h is ␤Use of uninitialized value in string context␤6 and h is ␤Use of uninitialized value in string …
clsn I have written exactly one program more than a line or two long in perl6. Every so often rakudo changes enough to break it (or sometimes fix it), and I have to see where I went wrong.
clsn sent the email.
masak clsn: I used to feel that way about Rakudo two-three years ago. 15:08
clsn: this bug of yours is quite unusual nowadays, and I'm surprised we don't have tests catching it.
clsn Yeah, this one seemed awfully straightforward.
There's something else broken between those two rakudos; another thing making my program run wrong, but I haven't isolated the issue yet. 15:09
masak rakudo: sub r { my $h = 'h'; my @k = 1, 6; for @k { say $h } }; r
p6eval rakudo 198513: OUTPUT«h␤h␤»
clsn It's probably something exasperating with pattern-matching.
masak rakudo: my $c = 0; sub r { my $h = 'h' ~ $c; my @k = 1, 6; for @k { say $h } }; r
p6eval rakudo 198513: OUTPUT«h0␤h0␤»
moritz clsn: lots of regex things are broken in nom :(
masak is now terribly confused and needs to think before discussing further with p6eval 15:10
clsn moritz: that's almost reassuring. If people know they're broken, sooner or later they'll fix them (and my program might still be right.)
masak I've seen three behaviors in a short time: clsn's h3-h3-h3 behavior, the correct behavior, and my Any-Any-Any behavior.
I can't reproduce any of them reliably :/
clsn Otherwise, I had it coded to the wrong understanding of the language before, and I have to figure out the new specs all over again.
PerlJam Is it just me or is nqp broken on the latest parrot? 15:14
moritz in what way does it seem to be broken?
PerlJam when compiling nqp I get: gist.github.com/1355083 15:15
moritz is that nqp's master branch? 15:16
PerlJam yes.
PerlJam needs an ever faster computer. 15:18
I no longer have the patience to wait for compiles
masak clearly you need to become a Google Go programmer. 15:19
or an assembler programmer, I guess. 15:20
moritz finds parrot and nqp compilation times acceptable 15:23
especially with ccache and parallelized make
b: gist.github.com/1354278 15:26
p6eval b 1b7dd1: OUTPUT«1 and h is h3␤6 and h is h3␤h is h3␤1 and h is h2␤6 and h is h2␤h is h2␤1 and h is h1␤6 and h is h1␤h is h1␤1 and h is h0␤6 and h is h0␤h is h0␤»
fsergot hi perl6! :) o/ 15:32
slavik1 does the Mark L guy hang around here?
PerlJam slavik1: Lehmann ? 15:39
daxim schmorp thinks perl6 is the devil 15:40
[Coke] schmorp?
masak clsn: I just managed to reproduce your bug in nom HEAD. 15:41
slavik1 PerlJam: no, Mark Lentczner, the dude who made the periodic table of operators
masak clsn: to me it looks like a stray OUTER pointer.
PerlJam oh
clsn I was reporting it in approximately nom head; whatever the most recent I happened to have on my latest pull. 15:42
So yeah, makes sense.
slavik1 PerlJam: www.ozonehouse.com/mark/periodic/ 15:43
I am wondering if it's still accurate 15:44
moritz it's two years old? probably not accurate anymore 15:46
for example it misses the Z meta operator
and the sequence operator, if present at all, will be outdated 15:48
lcm and gcd are missing
masak nom: my $c; sub r($x) { my $h="h" ~ $c++; r $x-1 if $x; for 1 { say $h }; say "h is $h" }; r 3
p6eval nom 198513: OUTPUT«h3␤h is h3␤h3␤h is h2␤h3␤h is h1␤h3␤h is h0␤»
masak b: my $c; sub r($x) { my $h="h" ~ $c++; r $x-1 if $x; for 1 { say $h }; say "h is $h" }; r 3
p6eval b 1b7dd1: OUTPUT«h3␤h is h3␤h2␤h is h2␤h1␤h is h1␤hAny()␤h is hAny()␤»
masak golf'd!
nom: my $c; sub r($x) { my $h="h" ~ $c++; r $x-1 if $x; say $h for 1; say "h is $h" }; r 3
p6eval nom 198513: OUTPUT«h3␤h is h3␤h3␤h is h2␤h3␤h is h1␤h3␤h is h0␤»
masak nom: my $c; sub r($x) { my $h = $c++; r $x-1 if $x; say $h for 1; say "h is $h" }; r 3 15:49
p6eval nom 198513: OUTPUT«3␤h is 3␤3␤h is 2␤3␤h is 1␤3␤h is 0␤»
moritz nom: my $c; sub r($x) { my $h = $c++; r $x-1 if $x; 1 for 1; say "h is $h" }; r 3
p6eval nom 198513: OUTPUT«h is 3␤h is 2␤h is 1␤h is 0␤»
moritz nom: my $c; sub r($x) { my $h = $c++; r $x-1 if $x; $h for 1; say "h is $h" }; r 3 15:50
p6eval nom 198513: OUTPUT«h is 3␤h is 2␤h is 1␤h is 0␤»
masak print $h in a for loop, and it comes out as 3 15:50
moritz nom: my $c; sub r($x) { my $h = $c++; r $x-1 if $x; say $h for 1; }; r 3
p6eval nom 198513: OUTPUT«3␤3␤3␤3␤»
sorear good * #perl6
moritz niecza: my $c; sub r($x) { my $h = $c++; r $x-1 if $x; say $h for 1; }; r 3 15:51
p6eval niecza v11-22-gbebf7a0: OUTPUT«3␤2␤1␤Any()␤»
moritz \o sorear
nom: my $t = ''; my $c; sub r($x) { my $h = $c++; r $x-1 if $x; $t ~= $h for 1; }; r 3; say $t 15:52
p6eval nom 198513: OUTPUT«3333␤»
moritz at least it's easy to turn into a test ;-)
niecza: my $t = ''; my $c = 0; sub r($x) { my $h = $c++; r $x-1 if $x; $t ~= $h for 1; }; r 3; say $t 15:53
p6eval niecza v11-22-gbebf7a0: OUTPUT«3210␤»
moritz masak: do you still remember the number of that infamous ticket?
masak 58392_ 15:54
?
moritz nom: my $t = ''; my $c; sub r($x) { my $h = $c++; r $x-1 if $x; for 1 { $t ~= $h }; }; r 3; say $t
p6eval nom 198513: OUTPUT«3333␤»
moritz masak: indeed 15:55
masak: thanks
benabik PerlJam: I was able to replicate your build failure. 15:57
masak moritz: but this one is not identical, I think. 15:57
this one is more benign and limited.
moritz masak: but it's a good inspiration for where to put the test :-) 15:58
moritz nom: my $t = ''; my $c; sub r($x) { my $h = $c++; r $x-1 if $x; do { $t ~= $h }; }; r 3; say $t 15:59
p6eval nom 198513: OUTPUT«3333␤»
moritz nom: my $t = ''; my $c; sub r($x) { my $h = $c++; r $x-1 if $x; $t ~= $h }; r 3; say $t 15:59
p6eval nom 198513: OUTPUT«3210␤»
benabik PerlJam: My backtrace had function names inside nqp_ops though. Added it as a comment: gist.github.com/1355083#comments 16:00
moritz so it needs to be just a block, not necessarily a loop
dalek ast: fe4c35b | moritz++ | S04-statements/for.t:
RT #103332, for loops, lexicals and recursion
16:00
masak moritz: right. it's a block, and the block gets the OUTER wrong. 16:02
cognominal what is the Perl 6 equivalent of the PIR setprop? 16:08
moritz that is an odd question 16:08
cognominal: what do you want to accomplish?
sorear pir::setprop(...)
cognominal sorear: I forgot about pir:: :) 16:09
moritz my first reaction was "traits", because it allows you to attach additional data to objects
cognominal I don't care to expose it as an interface. 16:10
TimToady thinks complicated Match objects should probably gistify to yaml
masak sounds reasonable. 16:11
TimToady or yaml2 :) 16:12
moritz thinks complicated Match objects should .yaml to yaml
PerlJam TimToady: did you just add yaml to the perl 6 spec? :)
TimToady no, I said "probably" :P
masak if the goal is to have a readable indented structure serialization, YAML is as good as any, IMO. 16:13
no need to reinvent that wheel.
PerlJam Sure, but I'm not aware of the probability distribution that you use for "probably"
moritz somehow never found yaml very readable
TimToady it's better than the alternatives, is all 16:14
PerlJam moritz: in what context have you seen yaml? rails test fixtures? There is some fairly complicated yaml out there that tries to scuttle the readability aspect. 16:16
moritz PerlJam: catalyst config files
TBH I never read an explanation for what it does, but I didn't need that for JSON 16:17
flussence (there's a yaml2?) 16:17
PerlJam flussence: yeah, ingy is making yaml better
moritz hopes it reduces the spec size 16:18
TimToady hopes .perl gets prettier too 16:20
moritz in the long run it won't 16:23
for example if .perl is supposed to reproduce the difference between EnumMap and Hash, it will stay ugly, because we only have literals for one of them 16:24
TimToady thinks about making .perl return eval :lang(yaml) q:to /END/ ... :) 16:24
TimToady I'm not really saying that matches have to gistify to yaml in a completist sense like .perl must do, but that we can gistify matches in a much more readable format than we currently do, even while throwing some info away that .perl might keep 16:30
TimToady that's what .gist means, after all 16:31
moritz wonders if $a.gist eq $b.gist becomes the new "loose eqv" 16:32
moritz fwiw I could build both nqp and rakudo on newest parrot 16:32
masak TimToady: speaking of throwing info away -- how are these two things reconciled: (1) a Perl 5 to Perl 6 parser promises to retain as much information as possible, including, I suppose, comments. (2) we encourage people to do <.ws> in their grammars.
TimToady well, might be the only way to compare two infinite sequences :)
mls moritz: I wonder if Block.clone() should also clone the captured outer 16:33
TimToady masak: poorly :)
but there are some things worth doing poorly
masak I'm still at the "at all" stage with this one, though. 16:34
they seem directly at odds with one another, not just a little.
moritz ah, that's why ops2c throws away comment from my .ops files :/
TimToady are you asking about the places where the p5 programmer should have used /x but didn't?
masak no, not at all. 16:35
TimToady then I don't follow your question at all
masak I'm saying how can a p52p6 translator translate whitespace correctly if it doesn't capture it?
PerlJam moritz: I guess I'm going to with "it's just me" then. I haven't built parrot/nqp/rakudo on this machine in a while and it was recently upgraded to ubuntu 11.10 so no telling what's going on.
TimToady masak: STD can easily reproduce this info from the memos 16:36
moritz PerlJam: but benabik reproduced it...
PerlJam oh? I didn't see.
TimToady masak: and even in the absense of that, everything is marked with its .from and .to, so all you need do is substr the original string between tokens to get the whitespace, if you're interested in it 16:38
masak TimToady: hm, ok.
mls moritz: ok, now I'm confused. clone of a sub should clone the outer. I wonder why it fails here. 16:39
TimToady whether a translator should reformat whitespace/comments is, of course, a decision that has to be made differently in different situations
especially as you introducing refactoring options into your translator 16:40
and a good translator is likely to introduce comments in various spots as well, saying "# I'm not 100% sure this is what you want here" 16:41
mls moritz: ah, it doesn't work because the sub's outer is set at sub entry, but not restored at sub exit
TimToady is confused; surely an outer is set at compile tie, not run time
*time
mls yes, I meant "outer_ctx", not "outer_sub" 16:42
TimToady is this parrotese for "dynamic context"? 16:43
mls parrot implements a capture by cloning the sub and setting an "outer_ctx" attribute in the cloned sub. 16:44
mls when the cloned sub is called, the "outer_ctx" will be made the "outer" of the current context 16:44
mls for some reason rakudo adds code to the beginning of every sub that calls capture_lex for every sub the code calls 16:48
(I'm not sure why it is needed, the sub's outer() parameter should normally make sure that the context gets set correctly) 16:49
moritz mls: might well be from a time when parrot's outer() handling was too buggy
mls commenting out the capture_lex breaks the code, so they seem to be needed for something 16:50
moritz mls: but I don't really grok the lexicals system, and codegen neither. So take my information with a rock of salt :-)
TimToady might relate to S04:1746 16:51
mls could be, yes. jnthn++ will know 16:52
so I can explain what's going on, but I don't know the correct fix ;( 16:53
TimToady moritz: re irclog.perlgeek.de/perl6/2011-11-10#i_4685509 this might be helped with a Go-like strategy of keeping literals as their string repr until you know what context they're actually used in 16:55
of course, that only helps if you don't actually use the literals before the type is available :) 16:57
moritz ... and that kinda is the problem :-)
Int literals are pretty much everywhere 16:58
TimToady heh, I'm definitely "a perfectionist with no ability to prioritize" :) 16:59
masak decommutes 17:01
[Coke] wonders if TimToady is committed to yaml over, say, JSON. 17:02
TimToady they both have their ups and downs
TimToady has no ability to prioritize, remember :P 17:03
[Coke] tends to prefer JSON, but Coke is ostensibly a web developer.
japhb moritz: have not backlogged, but noticed your code review request. Will look at it now.
benabik JSON is good for simple structures. YAML has nice things like types and loops.
[Coke] TimToady: Oh, I'd tend to agree. ;)
PerlJam I've found being able to refer to parts of the yaml doc in other parts of the yaml doc is quite nice 17:04
PerlJam [Coke]: and since ingy isn't here ... JSON *is* YAML ;) 17:05
benabik I seem to recall somebody mentioning a new version of the YAML spec. Or was I hallucinating? 17:06
[Coke] Does he mean that in a literal sense or a "everything you can do, I can do better^Wtoo." ?
PerlJam benabik: github.com/yaml/YAML2
TimToady ingy-san announced the yaml2 effort a mere 2ish weeks ago
benabik PerlJam++
TimToady and I was the first to hear it, on the train to SFPM, where it was officially announced 17:08
or maybe I was second, if rafl knew it already 17:09
cognominal TimToady, not all projecta take a decade to accomplish :)
TimToady we still don't know if Perl 6 takes a decade to accomplish :)
might take two... 17:10
or ten :)
in fact, that's kinda the plan 17:11
TimToady c.f. "100-year language" 17:12
cognominal agreed, but I am hoping that by this christmas we will have a useful rakudo. What was perl 1 for the previous generation. 17:13
PerlJam rakudo isn't useful now? 17:14
TimToady um, it's already that useful
cognominal …for a larger population
beyond the current happy few.
TimToady well, you have to convert the sysadmins before you convert the webdevs, and that'll take a Perl 4 equivalent at least :) 17:15
PerlJam I never used perl 1, but I remember when perl 5 was released. It seemed like it was in flux for a year or two before it became "useful for the general population"
abercrombie When will be the next version released? Ever since 2011.07 17:16
PerlJam abercrombie: you mean Rakudo Star? 17:16
abercrombie No, just a release version
TimToady abercrombie: try niecza if you can't wait for nom to stabiliz; it's officially released once a month 17:17
and it's pretty zippy
PerlJam abercrombie: I did the Oct release of Rakudo just a few weeks ago. 17:18
abercrombie Oh, I didn't see it on rakudo.org 17:18
PerlJam probably because I forgot to update it.
TimToady abercrombie: also, you should not complain about the delay of a new Rakudo Star much, because it depends on health issues in pmichaud++'s family that he has no control over 17:19
and we have told him in no uncertain terms that is priority is his family, not getting the next Rakudo Star out
*his
cognominal pmichaud++
abercrombie I never complain about it. As pmichaud posted on rakudo.org, "rather than rush out a buggy release we’ve decided to spend a few more days cleaning things up a bit"
TimToady abercrombie: "Ever since 2011.07" sounds like a complaint to me :) 17:20
abercrombie Oh, I didn't mean that.
Sorry. 17:21
TimToady ah, well, human languages are always a bit lossy... 17:22
abercrombie definitely. 17:23
So now rakudo: in p6eval is 2011.10 ? 17:24
japhb moritz: In bigint's Str.Numeric(), why on lines 257-258 do you say '$base.Int'? It's already an Int, right? 17:25
And FWIW, jnthn's nqp::radix_I looked sane, though I'm not really qualified WRT tommath bits.
er, nqp_bigint_radix() 17:26
mls hah! that test case is also nice to demonstrate that parrot's auto-clone is wrong. It has exactly the same bug as in rakudo 17:33
(it stores the "latest" context in the sub and uses it for auto-close. I suspeced that this was wrong some weeks ago, but couldn't find a counter example. now I have one ;) ) 17:34
mls (which also means that simply removing the "capture_lex" statements doesn't work. Also, because rakudo clones the sub before storing it in the lex, so the auto-close does not find the correct context) 17:36
mls (which also means that parrot's auto close is very broken as it can't deal with cloned subs ;( ) 17:38
TimToady masak: maybe you should translate avdi.org/talks/confident-code-rubymidwest-2011/ to Perl 6 and see how it fares :) 17:47
PerlJam TimToady: including or excluding the monkey patching? :-) 17:51
TimToady -Ojoy 17:51
cognominal without a bill 17:54
TimToady usually there's one bill too many... 17:55
PerlJam that whole section on null and nil reminds me of Rich Hickey's Simple Made Easy 18:03
lichtkind moritz: ping 18:09
lichtkind masak: cheers all changes done 18:15
mls moritz: I created two PIR test cases that show both problems (the recursion problem, and the "why capture_lex is needed" problem) 18:27
mls I'll try to find a solution tomorrow 18:27
-> home
ingy perl6 + yaml == ♥ :) 18:41
ingy gets to work on it...
fyi, this is a nice little tool that some hackers who just ported YAML to JS whipped up: nodeca.github.com/js-yaml/ 18:43
the port was pyyaml to node.js originally, but now works in browser js-s 18:44
lichtkind cheers ingy 18:45
masak evening, #perl6. 20:03
diakopter o/
masak lichtkind: I've forgotten what changes you mean, but I'm glad they're all done ;) 20:04
moritz japhb: ah, the .Int is a fossil 20:10
japhb gotcha 20:14
lichtkind masak: i fixed my slides and uploaded as well as added % ans %% to the tablets
masak: and fixed ** in index A and B 20:16
masak lichtkind: nice! cool! 20:18
lichtkind++
perl6: say Nil.Array
p6eval niecza v11-22-gbebf7a0: OUTPUT«Unhandled exception: Unable to resolve method Array in class Nil␤ at /tmp/hlshtujl0z line 1 (mainline @ 1) ␤ at /home/p6eval/niecza/lib/CORE.setting line 2224 (ANON @ 2) ␤ at /home/p6eval/niecza/lib/CORE.setting line 2225 (module-CORE @ 58) ␤ at /home/…
..pugs b927740: OUTPUT«*** No such subroutine: "&Nil"␤ at /tmp/18XdXUl_4K line 1, column 5 - line 2, column 1␤»
..rakudo 198513: OUTPUT«␤»
lichtkind masak: thanks but thats was the least, have to do much more
masak rakudo: say Nil.Array.perl
p6eval rakudo 198513: OUTPUT«Array.new()␤»
masak rakudo++
perl6: say Array(Nil).perl 20:19
p6eval rakudo 198513: OUTPUT«===SORRY!===␤CHECK FAILED:␤Undefined routine '&Array' called (line 1)␤»
..niecza v11-22-gbebf7a0: OUTPUT«Unhandled exception: Unable to resolve method postcircumfix:<( )> in class Array␤ at /tmp/DKGliZuEi2 line 1 (mainline @ 1) ␤ at /home/p6eval/niecza/lib/CORE.setting line 2224 (ANON @ 2) ␤ at /home/p6eval/niecza/lib/CORE.setting line 2225 (module-CORE @ …
..pugs b927740: OUTPUT«*** No such subroutine: "&Array"␤ at /tmp/8aaJfwcijs line 1, column 5 - line 2, column 1␤»
dalek kudo/bigint: eab4d7a | moritz++ | src/core/Str.pm:
remove fossil noticed by japhb++
masak triple FAIL.
lichtkind: it's funny how information gets propagated. my talk wasn't even really about % and %%, I just mentioned them in passing ;) 20:21
true or false: ceteris paribus, a routine that doesn't use self shouldn't be a method. discuss. :) 20:23
moritz not true in general, because of interface consistency
ie it's an implementation detail if a method uses self or not 20:24
masak that's a fine argument in the abstract. I can't think of a concrete example, though. can you?
diakopter false, because of the convenience in accessing so-called static methods with the .methodname suffix instead of typing the class name. also, for inherited "static" methods.
masak diakopter: interesting. so -- using classes but not for their objects? 20:25
I don't think I've seen that style of coding in Perl 6.
lichtkind masak: even more funny it just started as impulse by me to talk about **, if there is any other thing happened in last 6 months?
diakopter masak: yeah, using classes for interacting with their private static data 20:26
lichtkind % is even from logic good because in math its also whats left from division
masak lichtkind: check the git log of the 'specs' repo :)
diakopter locals declared in the class body
masak diakopter: right.
perl6: class A { my $a = 42; method foo { say $a } }; class B is A {}; A.foo 20:27
er.
perl6: class A { my $a = 42; method foo { say $a } }; class B is A {}; B.foo
diakopter o_O 20:28
abercrombie niecza: say "a"
diakopter p6eval decided to take a nap. a dirt nap.
diakopter masak: maybe a better example would be what you wrote above but calling B.foo from a method in B that does use self 20:29
diakopter er, calling self.foo 20:30
if p6eval ever wakes up
masak diakopter: right. 20:31
I do see the use for it. 20:32
tadzik 'evening!
masak tadzik! \o/ 20:33
tadzik lol! masak! 20:34
masak lol!
perl6: class A { my $a = 42; method foo { say $a } }; class B is A { method bar { self.foo } }; B.bar
p6eval rakudo 198513, niecza v11-22-gbebf7a0: OUTPUT«42␤»
..pugs b927740: OUTPUT«␤»
masak pugs--
cognominal masak, you should respect the elders 20:37
masak indeed. slightly unfair of me. 20:40
I do plan to fix it at some point, though ;)
nom: .say for "aarrff!", { my @a = .comb; @a[(^@a).pick].=uc until @a.join ne $_; @a.join } ... { $_ eq .uc }
p6eval nom 198513: OUTPUT«aarrff!␤aarrFf!␤aaRrFf!␤aaRRFf!␤aaRRFF!␤AaRRFF!␤AARRFF!␤»
masak I'm sure there are more elegant ways to write that. 20:41
tadzik that's pretty cool
masak nom: say my $s = "aarrff!"; for (^6).pick(*) { say $s = ((my @a = $s.comb)[$_].=uc; @a.join) } 20:43
p6eval nom 198513: OUTPUT«aarrff!␤Aarrff!␤AarRff!␤AarRfF!␤AarRFF!␤AaRRFF!␤AARRFF!␤»
masak much better ;) 20:44
nom: say my $s = "aarrff!"; say $s = ((my @a = $s.comb)[$_].=uc; @a.join) for (^6).pick(*) 20:46
p6eval nom 198513: OUTPUT«aarrff!␤aarRff!␤AarRff!␤AarRfF!␤AarRFF!␤AArRFF!␤AARRFF!␤»
masak nom: say my $s = "aarrff!"; -> $i { say $s = (.[$i].=uc; .join) given $s.comb } for (^6).pick(*) 20:49
p6eval nom 198513: OUTPUT«aarrff!␤Cannot assign to a non-container␤ in method dispatch:<.=> at src/gen/CORE.setting:730␤ in block <anon> at /tmp/dhRpFnqygY:1␤ in block <anon> at /tmp/dhRpFnqygY:1␤ in method reify at src/gen/CORE.setting:4007␤ in method reify at src/gen/CORE.setting:3914␤ …
masak dang ;)
I suspected that might happen.
oh well, it wasn't really shorter anyway. 20:50
lichtkind masak: yes had to fic my git config but now I cat fetch specs again easily 21:02
fsergot masak, however, good job. :) 21:11
jnthn evenin', #perl6 21:30
tadzik hey, jnthn!
jnthn went to an event with free beer this evening :) 21:31
masak jnthn! \o/ 21:32
moritz \o 21:33
jnthn: irclog.perlgeek.de/perl6/2011-11-10#i_4685509 when your mind turns to p6 again :-) 21:35
jnthn moritz: Well, it's a little distracted on @other, but I'll take a look ;) 21:36
moritz: I saw your commits :)
jnthn "I see some difficulties with parsing Int literals. We need to have a bigint type available in Actions.pm to create the Int constants from literals" 21:37
The point is that we *do* have them! :)
$*ST.find_symbol(['Int']) # gets the Int type object
That's why Int is set up in BOOTSTRAP :)
PerlJam jnthn is going to invent a time machine? 21:38
jnthn PerlJam: No, I just worked out the bootstrap ;) 21:39
masak \o/ 21:43
the bootstrap worked out the bootstrap!
tadzik Bootstrap's bootstraps
masak tadzik: I'M TELLIN' THE STORY! 21:44
PerlJam All I know is that none of the boots I've ever owned or used or seen have straps of any kind.
tadzik masak: I'M PLAYING THE SOUNDTRACK!
masak "we're really bad eggs..."
masak plays the soundtrack, too 21:45
tadzik oh, it's hier: www.youtube.com/watch?v=AacMBXI2tw8
oh, "I'M TELLIN' THE STORY!" is a quote 21:46
masak tadzik: yes. sorry if that wasn't clear ;) 21:47
tadzik I fail at remembering those 21:48
especially if I watched it in Polish :P
masak oh!
dubbing--
tadzik recently I'm watching films with english subtitles. I still fail at hearing
masak it's a matter of practice. 21:49
tadzik probably. I should be watching more films
or going to more conferences
masak the subtitles can be distracting, because there's always something that the translation agency gets wrong :/
tadzik oh I know that 21:50
lichtkind o/ tadzik 21:58
tadzik hey lichtkind! 21:58
masak good night, #perl6 23:11
diakopter o/ 23:12
[Coke] -> (16:16) From Sue D. Nymme [meh], to perl: 23:49
- Crazy Perl Idea #433: if/unless/else/elsif blocks should allow redo/next/las
- t. <redo> would jump back to the top of the <if> condition to have it
- re-evaluated; <next> would jump forward to the <else> (or next <elsif>), and
- <last> would jump out of the construct entirely (to the point right after
- the last <else>/<elsif> block).
[Coke] here's his next crazy idea: 23:52
- YourLabel: while (condition) { say "iteration number ", YourLabel.count; if
- (foo) { YourLabel.next } etc }
flussence I've come across a few situations where being able to jump to the next of a chain of if/elsif/else would've made my code considerably less messy... 23:59