»ö« | perl6.org/ | nopaste: paste.lisp.org/new/perl6 | evalbot usage: 'perl6: say 3;' or rakudo: / pugs: / std: , or /msg p6eval perl6: ... | irclog: irc.pugscode.org/ | UTF-8 is our friend!
Set by wolfe.freenode.net on 30 October 2009.
zaslon lolperl6adventhazblogged! perl6advent++ 'Day 24: The Perl 6 standard grammar': perl6advent.wordpress.com/2009/12/2...d-grammar/ 00:03
Wolfman2000 ...to whoever keeps up with standards: are emails supposed to be case insensitive? 00:10
Juerd pmichaud++ # great advent finale :) 00:11
arnsholt Wolfman2000: Email addresses are case-insensitive IIRC 00:15
Er, actually, I'm not sure. Check Wikipedia. E-mail is a mess =)
Wolfman2000 according to wikipedia, the local part should be case sensitive. doesn't say about the domain part
diakopter phenny: tell mberends and miguel adds multiple return to mono/C#: tirania.org/blog/archive/2009/Dec-23.html 00:16
phenny diakopter: I'll pass that on when mberends is around.
arnsholt The domain parts are resolved by DNS, which is insensitive as well 00:18
diakopter Wolfman2000: the domain part is historically not case-sensitive; see en.wikipedia.org/wiki/Domain_Name_System and its link to RFC 4343
diakopter Wolfman2000: the local part should be case-sensitive, but many smtp servers treat it as case-insensitive 00:21
Wolfman2000 ...I'm starting to not like redesigning my website proper now. :(
diakopter change how you're doing it so that you enjoy it? 00:22
Wolfman2000 diakopter: Get me more contributers so I'm not the only one doing it.
...on second thought, don't worry about it.
diakopter I wasn't going to worry about it anyway 00:23
diakopter phenny: tell mberends named capturing groups working, in addition to lookahead (pos and neg) 01:56
phenny diakopter: I'll pass that on when mberends is around.
colomon \o/ Advent calendar is done! 02:12
Juerd :( 02:13
diakopter colomon: but wait, there's 366 days until the following Christmas 02:26
so, at least 366 more Advent Calendar posts to go!
colomon diakopter: I wouldn't mind restarting it in the January. But I'm very happy to celebrate a job well done now. :) 02:27
diakopter I'm tickled that Synopsis 5 on feather is the 2nd result on google for "S05" 06:29
std: $///$////$$/ 06:32
p6eval std 29391: ok 00:01 106m␤
youwin does any other language have a .comb method or is it completely a new idea for perl6? 06:36
diakopter it's kindof a global (but non-overlapping) match aggregator 06:42
diakopter youwin: I don't know whether there is a precedent; likely someone somewhere wrote up a routine to do that sort of thing. 06:43
youwin well its not exactly brand new thing, i could do a while (/../g), but this is the first ive heard it called that and made into a method of a string
Tene considers, after doing it YET AGAIN, echo "alias :w='git commit -a'" >> ~/.aliases
Probably not the best idea, but it's at least debatable.
youwin its a great idea
i like it
if you provide split, you might as well have comb 06:44
Tene Yes, I agree. :)
diakopter youwin: well, there's the task of getting only the non-overlapping matches 06:44
youwin theres no way to make it get overlapping matches? 06:45
not sure how useful that would be though 06:46
diakopter that's what you get by iterating a "normal" global match
std: token space_cadet { BEGIN { <.space_cadet> } } 06:54
p6eval std 29391: ok 00:01 105m␤
diakopter std: token token { <token> } 06:55
p6eval std 29391: ok 00:01 104m␤
diakopter std: token foo { ^^ . ^^ } 06:57
p6eval std 29391: ok 00:01 104m␤
diakopter mberends: hi 07:05
mberends hi diakopter, 7 hours was needed apparently. backlogging...
phenny mberends: 00:16Z <diakopter> tell mberends and miguel adds multiple return to mono/C#: tirania.org/blog/archive/2009/Dec-23.html
mberends: 01:56Z <diakopter> tell mberends named capturing groups working, in addition to lookahead (pos and neg)
mberends w00t!
"Sprixel Reloaded" is going to be awesome 07:06
diakopter we'll see 07:08
I'm sticking with the "there's that crazy diakopter" routine so as to keep expectations low, hopefully.
oh wait, did I say that out loud? :/ 07:09
oh, and, it'll do 1e44 regex executions per second. ;)
mberends yeah, we all know how it goes 07:10
diakopter :) 07:12
there's something different about working on code alone and "dark"
much more freedom to fail, but also much more freedom to tinker and try newish things that are easy to label "throwaway" in hindsight 07:13
mberends ...that you like?
diakopter yeah.. but of course there are detriments 07:15
mberends I was itching to publish vill asap, but wanted a minimum proof of viability, and did not end up with what I had was aiming for
diakopter imho, the bar (for "viability") will continually rise 07:16
(as the costs go from opportunity to sunk)
(and the pressure to justify previous decisions/activity rises) 07:17
mberends "fail publicly" is ok, there are usually takeaway lessons. yes, justifying decisions publicly is harder, but then the extra brains are mostly helpful. pmurias++ also encourages me at multiple levels. 07:18
diakopter watched "Armored" (a movie) in a theater tonight. An ok movie, as Matt Dillon/Laurence Fishburne heist movies go. 07:20
, but visions of ILGenerators danced in my head
mberends had an xkcd # 224 type dream, except it was Perl 6 07:21
that C# Tuple reference doesn't impress. Break platform independence to achieve little more than syntactic sugar for a Collection-y thing. 07:24
diakopter www.modernperlbooks.com/mt/2009/12/...-perl.html slashdotted 07:25
mberends we could put the book on our Christmas lists, no, wait, oh... 07:26
diakopter mberends: yeah, and I don't see how he'd distinguish an actual comma operator 07:27
mberends C# is stealing ideas from Perl! Again! 07:27
eiro good thing! 07:28
no ?
mberends good thing, if it were to be true, which I don't seriously believe 07:29
diakopter o wait. no comma operator in C#. /me feels silly 07:31
eiro :) 07:35
mberends under the C# Tuple article, 7 hours ago Robert Friberg commented "I have had classes Tuple<T,U> and Tuple<T,U,V> in my utilities library since 2.0...." 07:37
diakopter yeah; shows that Robert Friberg didn't read the article 07:39
mberends so the Tuple Patch is purely the assignment to a list of scalars, like Perl 5 does. 07:41
diakopter and also the final slurpy slot
basically, list context for assignment 07:42
mberends ah, found the slurpy concept, missed it earlier
diakopter I find it interesting that a MIPS jump address table header field is part of the CIL specification 07:50
mberends chromatic is so good at thinking through improvements, also for Perl 5 packagers. Hopefully this time the suggestions don't get blocked by the keep-off-my-lawn brigade.
diakopter: you're not serious, are you?
diakopter yes
mberends spec url? 07:51
diakopter well, more precisely, it's part of the PE spec 07:52
mberends MIPS not found in www.ecma-international.org/publicat...ma-335.htm 07:55
diakopter: but I believe you
diakopter the portable executable spec 07:56
mberends found lots of Microsoft pages 07:57
diakopter download.microsoft.com/download/9/c...ff_v8.docx 07:58
mberends and this one: ntcore.com/files/inject2exe.htm
JimmyZ Welcome to the website of Perl 9! 08:03
Perl 9 is the next major release after Perl 6. Perl 8 has been left out because Perl 9 provides too much new features which would not fit into one major version number. Perl 9 combines all features of Perl 5 and Perl 6. This site only demonstrates some additional features over Perl 5 and Perl 6.
mberends fair enough, MIPS alongside x86, PPC, ARM, Itanic etc
diakopter JimmyZ: eh? 08:04
JimmyZ perl9.org ;) 08:04
diakopter oh; heh
JimmyZ somebody's site.
hejki :D 08:05
mberends a little innocent spoof
hejki www.perl9.org/?site=New-Features/Random-Operator 08:06
:DD
diakopter I was just about to paste that; my fav so far 08:09
mberends nonsense, but fun. Hypergoto, Infinite-Loops and Megahyper-Operators are my faves
no mention of implementation - will require an Albatross VM 08:13
carlin std: $foo (}}}}@.@{{{{) $bar; 08:16
p6eval std 29391: ===SORRY!===␤Confused at /tmp/clTrqfilmi line 1:␤------> $foo ⏏(}}}}@.@{{{{) $bar;␤ expecting any of:␤ infix or meta-infix␤ infix stopper␤ standard stopper␤ statement modifier loop␤ terminator␤Other potential difficulties:␤ Variable
..$foo is not pre…
carlin I'm wondering what happened to Perl 7 08:17
Tene That's left open for the other next version of Perl 6. 08:18
mberends for Boxing Day 08:19
masak the Perl 9 site is the best parody of Perl 6 I've ever seen. 09:39
oh, and g'morning on Christmas Eve, peeps.
in Sweden, the 24th is the big day (with opening presents and celebrating in other ways), not the 25th as in the English-speaking world. 09:40
masak anyway: most things on the Perl 9 site are wrong, but they are wrong in interesting ways -- it would almost be worth it to go through spoof and reality in parallel in a blog post, and compare them. 09:42
like this:
different grammars. spoof: an AI thingy senses whether you want to code Lisp or Python. reality: just predeclare on top to modify your grammar as you want. 09:43
masak infinite loops: spoof: an infinite loop runs really fast. reality: no, but we have this nice keyword 'loop' which ends the C hegemony or three arbitrary and silly ;-separated arguments, leading to insecure and hard-to-debug loop constructs. 09:44
megamegahyper operators. spoof: just add on layers of >><< to go more mega and more hyper. reality: you don't need that; you get it for free in the first layer. neat, huh? 09:45
mix up "contexes". spoof: some far-fetched idea where a variable behaves differently when used in scalar context or in list context. reality: some more mundane idea where a variable behaves differently when used in different contexts. 09:46
reverse method syntax. spoof: you can do both $obj->method and method<-$obj. reality: you can't but if that floats your boat, just make a grammar-changing module, and predeclare it on top. 09:48
...so you see, if you remove the parodying grime from the lens, Perl 6 *is* Perl 9 already. :) 09:49
mberends masak: there will be modules... # afk again 09:50
masak there will indeed.
carlin the random operator could be declared as an infix 09:53
masak for great justice. 09:54
rakudo: sub infix:<(}}}}@.@{{{{)>($a, $b) { 'something random!' }; say 2 (}}}}@.@{{{{) 5 09:55
p6eval rakudo 8dc189: something random!␤
masak \o/ 09:56
Tene masak: Making a lot of progress on quoting and macros in my scheme compiler. Lots of fun. I'm excited about implementing it in Rakudo, so a little sad that it looks like it won't be feasible in Rakudo until after ng replaces trunk. 10:03
I'm still hopeful about getting it in before *, though.
masak Tene: woot! 10:04
Tene I'm probably going to be playing with generating a parameterizable AST tomorrow.
masak nice.
I don't have wireless access to the 'Net where I am, so I'm slightly restriced in my movements. 10:05
I hope to get a fair amount of GGE work and 7-wonders writing and Web.pm finalization done, though.
Tene I should have a lot of free time this weekend, hopefully, so I really need to remember to go through all of the HLLs and make sure they work on latest Parrot, migrate them to NQP-rx, update them to the latest HLL interop spec, etc.
That's the actually-valuable grunt-work task I need to work through. 10:06
Tene If I talk about it in public, greater chance I'll get it done. 10:06
shame-driven-development++
moritz_ wanted to work on the book a bit more, but hasn't really got around to it yet 10:07
JimmyZ_ masak: www.perl9.org/?site=Extended-Featur...-Operators
moritz_ having two families to celebrated christmas with is rather distracting :-)
Tene JimmyZ_: 02:45 < masak> megamegahyper operators. spoof: just add on layers of >><< to go more mega and more hyper. reality: you don't need that; you get it for free in the first layer. neat, huh?
JimmyZ_ oh
masak by the way: sometimes I wonder what the difference is between a module that does language tweaks for itself and one that does language tweaks for its importing module/script. does anyone know? 10:15
JimmyZ_ rakudo: sub infix:<(}}}}@.@{{{{)>($a, $b) { return ($a*$b,$a+$b).pick(1, :replace)}; say 2 (}}}}@.@{{{{) 5 10:16
p6eval rakudo 8dc189: 7␤
JimmyZ_ rakudo: sub infix:<(}}}}@.@{{{{)>($a, $b) { return ($a*$b,$a+$b).pick(1, :replace)}; say 2 (}}}}@.@{{{{) 5
p6eval rakudo 8dc189: 10␤
JimmyZ_ oh, perl 9 10:17
Tene masak: I conjecture that the macro is exported.
that is, the importing module fetches language modifications from the used module and installs them into its local grammar.
I don't recall if an API for that is defined or not. 10:18
moritz_ so can you write grammar modifications without applying them locally?
Tene If not, that's a problem.
I don't see why you wouldn't be able to, though.
mberends yes, the importing scope receives the language mods, provided the imported module does not encapsulate them in an inner scope.
masak JimmyZ: why :replace if you only .pick once? 10:19
mberends oh no, the module *is* a scope, which you need to puncture with 'is export' 10:20
JimmyZ_ masak: that's a mistake.
can remove it.
masak JimmyZ_: no problem, just wondering.
JimmyZ_ masak: ;)
rakudo: sub infix:<(}}}}@.@{{{{)>($a, $b) { return ($a*$b,$a+$b,$a-$b,$a/$b).pick(1)}; say 2 (}}}}@.@{{{{) 5 10:21
p6eval rakudo 8dc189: 7␤
JimmyZ_ rakudo: sub infix:<(}}}}@.@{{{{)>($a, $b) { return ($a*$b,$a+$b,$a-$b,$a/$b).pick(1)}; say 2 (}}}}@.@{{{{) 5
p6eval rakudo 8dc189: 0.4␤
masak actually, even the '1' is redundant :)
JimmyZ_ yes
masak ...but not wrong, of course. 10:23
JimmyZ_ rakudo: sub infix:<(+-*/ :random)>($a, $b) { return ($a*$b,$a+$b,$a-$b,$a/$b).pick(1)}; say 2 (+-*/ :random) 5 10:24
p6eval rakudo 8dc189: Syntax error at line 2, near ") 5"␤in Main (file <unknown>, line <unknown>)␤
masak I'd venture that the space confuses the optable parser. 10:25
try without it.
JimmyZ_ rakudo: sub infix:<(+-*/:random)>($a, $b) { return ($a*$b,$a+$b,$a-$b,$a/$b).pick(1)}; say 2 (+-*/:random) 5
p6eval rakudo 8dc189: 0.4␤
JimmyZ_ rakudo: sub infix:<(+-*/:random)>($a, $b) { return ($a*$b,$a+$b,$a-$b,$a/$b).pick(1)}; say 2 (+-*/:random) 5
moritz_ right, whitespaces are not allowed in operators
p6eval rakudo 8dc189: 10␤
masak moritz_: but there should probably be a warning or something. 10:26
moritz_ agreed
masak submits rakudobug 10:27
moritz_ submit a specbug first :-)
JimmyZ_ I like the space there 10:28
masak moritz_: you mean whitespace aren't explicitly disallowed in the spec?
JimmyZ_ ng has been stopped for a month?
moritz_ masak: they are, but it's not specced that it should warn 10:29
std: multi infix:<a b>($a, $b) { }
p6eval std 29391: ok 00:01 108m␤
JimmyZ_ rakudo: sub infix:<>>($a, $b) { return ($a*$b,$a+$b,$a-$b,$a/$b).pick(1)}; say 2 > 5 10:30
p6eval rakudo 8dc189: Malformed routine definition at line 2, near "infix:<>>("␤in Main (file <unknown>, line <unknown>)␤
JimmyZ_ rakudo: sub infix:< > >($a, $b) { return ($a*$b,$a+$b,$a-$b,$a/$b).pick(1)}; say 2 > 5
p6eval rakudo 8dc189: Malformed routine definition at line 2, near "infix:< > "␤in Main (file <unknown>, line <unknown>)␤
JimmyZ_ rakudo: sub infix:<< > >>($a, $b) { return ($a*$b,$a+$b,$a-$b,$a/$b).pick(1)}; say 2 > 5 10:31
p6eval rakudo 8dc189: maximum recursion depth exceeded␤in Main (file <unknown>, line <unknown>)␤
moritz_ hands JimmyZ_ a pair of « »
JimmyZ_ rakudo: sub infix:<<>>>($a, $b) { return ($a*$b,$a+$b,$a-$b,$a/$b).pick(1)}; say 2 > 5
p6eval rakudo 8dc189: Malformed routine definition at line 2, near "infix:<<>>"␤in Main (file <unknown>, line <unknown>)␤
JimmyZ_ can't use << >> ?
moritz_ NYI
JimmyZ_ rakudo: sub infix:< +-*/ >($a, $b) { return ($a*$b,$a+$b,$a-$b,$a/$b).pick(1)}; say 2 +-*/ 5 10:32
p6eval rakudo 8dc189: 10␤
Su-Shee good morning. 10:38
sushant hi 10:41
moritz_ \o 10:42
merry christmas to all who celebrate it today!
carlin It's now the 25th here :-) 11:00
Merry Christmas everyone
mberends merry xmas carlin # .nz win 11:01
Juerd Merry Christmas where applicable 11:09
Merry *.
wayland76 Btw, do you all know what Father Christmas' wife's name is? 11:34
masak wayland76: Mary, I'd venture. 11:40
wayland76 Yes, Mary Christmas :)
masak :) 11:41
On a gamesite where I play interesting connection games, there's a forum featuring players of varying degrees of language mastery. a year or so ago someone started a thread called "Marry Christmas!". it spawned an interesting discussion, with jokes intermixed with language discussion. 11:42
rodi masak: thanks for the nice mention in your P6Advent post. Sorry I didn't see your tweet, but of course you can use it :) 12:05
masak rodi: I'm relieved, and happy my hunch was correct. :) 12:09
rodi: it's also wonderful to see someone else make one-line Perl 6 scripts that output something neat.
kudos. 12:10
rodi I had a snow day on Monday, needed to celebrate :-P
masak (people who celebrate by writing Perl 6)++ 12:14
pmurias celebrates by writing some Perl 5 12:16
pmurias mberends: hi 12:42
pugs_svn r29392 | pmurias++ | [mildew] make -Cdesugar output slightly prettier 12:43
pugs_svn r29393 | pmurias++ | [mildew] one more fix to -Cdesugar 12:50
masak std: gather take $_ for 1, 2, 3; 12:56
p6eval std 29393: ok 00:01 108m␤
masak does that parse as (gather take $_) for 1, 2, 3 or as gather (take $_ for 1, 2, 3) ?
pmurias isn't for a statement_modifier? 13:01
masak: it seems that it parses as gather (take $_ for 1,2,3)) 13:03
pugs_svn r29394 | pmurias++ | [mildew] remove useless files 13:15
masak pmurias: good. that's the most useful parsing, in my view. 13:19
IllvilJa Merry Christmas greetings from Sweden to everyone at #perl6! www.youtube.com/watch?v=2A3kMTZwSQ8 14:31
colomon Any ng experts out there? I was wondering what it would take to make ~~ accept Code or Callable or whatever it is called. 14:56
colomon Seems like a simple ACCEPTS would do it, but I'm not quite sure where.... 14:56
Looks like Block already does this? 14:57
colomon rakudo: my $a = { $^num > 0; }; say 10 ~~ $a; 15:05
p6eval rakudo 8dc189: 1␤
colomon ng: my $a = { $^num > 0; }; say 10 ~~ $a;
p6eval ng 9d5018: 1␤
colomon oh, so that works fine. The broken thing is a block with $_ in it. 15:13
I think.
ng: my $a = { $_ > 0; }; say 10 ~~ $a; 15:14
p6eval ng 9d5018: 0␤
colomon ng: my $a = { $_ > 0; }; say $a.arity
p6eval ng 9d5018: 0␤
colomon ng: my $a = { $^num > 0; }; say $a.arity;
p6eval ng 9d5018: 1␤
colomon ng: say (1...11).list 15:15
p6eval ng 9d5018: sh: ./perl6: No such file or directory␤
JimmyZ o'hai 15:30
rakudo: sub infix:< +-*/ >($a, $b) { return ($a*$b,$a+$b,$a-$b,$a/$b).pick(1)}; say 2 +-*/ 5 #Will it be lazy? 15:31
p6eval rakudo 8dc189: 0.4␤
colomon how would it be lazy? 15:32
JimmyZ first pick, then eval the expr
not eval all expr, then pick 15:33
colomon Ah.
My impression is the answer is no.
JimmyZ I wish It'd be lazy 15:34
colomon At least, not in rakudo master or ng.
Yeah, I can see where that might be handy in general.
JimmyZ oh at least, Is there a lazy way?
s/oh/or 15:35
colomon I'm sure it could be conjured up, but it would be a lot more work.
JimmyZ or Will it be lazy?
I wish it will ;) 15:36
colomon I've been making the solution too complicated. What you really want is something like 15:37
JimmyZ Any way that lazy is ok 15:38
JimmyZ rakudo: sub infix:< +-*/ >($a, $b) { return (->{$a*$b},->{$a+$b}).pick()}; say 2 +-*/ 5 15:39
p6eval rakudo 8dc189: _block83␤
JimmyZ rakudo: sub infix:< +-*/ >($a, $b) { return (->{$a*$b},->{$a+$b}).pick()}; say 2 +-*/() 5 15:39
p6eval rakudo 8dc189: Confused at line 2, near "5"␤in Main (file <unknown>, line <unknown>)␤
colomon rakudo: sub infix:< +-*/ >($a, $b) { (({ $^x * $^y }, { $^x + $^y }, { $^x - $^y }, { $^x / $^y }).pick(1))($a, $b); }; say 2 +-*/ 5; 15:40
p6eval rakudo 8dc189: 0.4␤
JimmyZ rakudo: sub infix:< +-*/ >($a, $b) { return ((->{$a*$b},->{$a+$b}).pick())()}; say 2 +-*/ 5
p6eval rakudo 8dc189: 10␤
JimmyZ rakudo: sub infix:< +-*/ >($a, $b) { return ((->{$a*$b},->{$a+$b}).pick())()}; say 2 +-*/ 5
p6eval rakudo 8dc189: 10␤
JimmyZ rakudo: sub infix:< +-*/ >($a, $b) { return ((->{$a*$b},->{$a+$b}).pick())()}; say 2 +-*/ 5 # I think it's a lazy way.
p6eval rakudo 8dc189: 7␤
colomon JimmyZ: look at my paste up there. It is lazy in the sense you want. 15:41
s/paste/rakudo line/
JimmyZ rakudo: sub infix:< +-*/ >($a, $b) { return ((->{$a*$b},->{$a+$b}).pick())()}; say 2 +-*/ 5 # I think it's lazy to
p6eval rakudo 8dc189: 10␤
colomon Hmmm... yours might be too, though, now that I see what you're trying to do. 15:42
I believe -> is unnecessary. 15:43
dalek kudo/ng: 0977b1e | (Solomon Foster)++ | src/core/Any-list.pm:
Lightly tested ng versions of the Rakudo Any.first and Any.grep methods.
15:44
JimmyZ colonmon: we are the same, using block makes it's lazy
rakudo: sub infix:< +-*/ >($a, $b) { return (({$a*$b},{$a+$b}).pick())()}; say 2 +-*/ 5 # I think it's lazy to
p6eval rakudo 8dc189: 10␤
JimmyZ rakudo: sub infix:< +-*/ >($a, $b) { return (({$a*$b},{$a+$b}).pick())()}; say 2 +-*/ 5
p6eval rakudo 8dc189: 7␤
JimmyZ rakudo: sub infix:< +-*/ >($a, $b) { return ({$a*$b},{$a+$b}).pick()}; say 2 +-*/ 5 15:45
p6eval rakudo 8dc189: _block72␤
colomon JimmyZ: we're using a slightly different approach -- my pick returns a Block with arity 2 and no fixed variables, yours returns one with arity 0 and $a and $b baked in.
I don't have any feel yet for which approach is preferable. :)
JimmyZ rakudo: sub infix:< +-*/ >($a, $b) { return ({$a*$b},{$a+$b}).pick()>>.()}; say 2 +-*/ 5 15:46
rakudo: sub infix:< +-*/ >($a, $b) { return ({$a*$b},{$a+$b})>>.()}; say 2 +-*/ 5
p6eval rakudo 8dc189: Can only transform an Object to p6opaque␤in Main (file src/gen_setting.pm, line 324)␤
JimmyZ yep, they are all closure 15:49
colomon pmichaud, jnthn: I believe first and grep are basically right now, but unfortunately their tests depend heavily on $_ giving the correct arity in code blocks. I guess I could rewrite all the tests to use $^a instead, but that seems wrong... 15:52
JimmyZ rakudo: sub infix:< +-*/ >($a, $b) { (({$a*$b},{$a+$b}).pick())()}; say 2 +-*/ 5
p6eval rakudo 8dc189: 7␤
dalek kudo/ng: 78e4226 | (Solomon Foster)++ | src/core/Any-list.pm:
Add protos for first and grep.
15:55
JimmyZ rakudo: sub infix:< +||-||*||/ >($a, $b) { (({$a*$b},{$a+$b}, {$a-$b}, {$a/$b}).pick())()}; say 2 +||-||*||/ 5 15:56
p6eval rakudo 8dc189: 10␤
^aristotle is there a way to declare a hash as taking a pair of strings as keys? 15:58
colomon ^aristotle: Yes in theory, I don't think it's implemented in Rakudo yet. (And I don't know the syntax to do it.) 15:59
^aristotle colomon: ok 16:00
are multidimensional hashes implemented, at least?
JimmyZ like?
colomon you mean like $a{"b"}{"d"} ?
hashes of hashes?
^aristotle well the problem I have is that something like ++$hash{$key1}{$key2} will autovivify the second-level key 16:01
but apparently won't autovivify the top-level hash access 16:02
so I need to sprinkle $hash{$key1} //= {} around the place
that's not very nice 16:03
colomon I'm pretty sure that's just Rakudo limitation, but I don't know any clever way around it.
^aristotle well then I thought
colomon But I'm hardly a hash expert.
There may be a way around it I don't know.
^aristotle what I really want to do is use a pair of strings as the key
I don't really want a hash of hashes there 16:04
diakopter ^aristotle: so just concat them
colomon If you could come up with a short string you knew wouldn't appear in the others, you could do something like $hash{$key1 ~ "safe string" ~ $key2}
diakopter o yeah; you'd need a delimiter 16:05
<-- not yet awake
^aristotle colomon: wait, I have 1991 on the phone, they want perl4 back
colomon ^aristotle: if it's a big problem for you, no one will complain if you implement it in Rakudo. 16:06
^aristotle (perl4 didn't have references so the way you did multidimensional structures was by concating indices with some delimiter) 16:07
colomon: I'm just saying I'd rather do it the perl5 way than the perl4 way if rakudo doesn't yet let me do it the perl6 way
^aristotle another question 16:14
I have two hashes 16:15
^aristotle I want to perform an operation on the combination of each pair from one hash with each pair from the other hash 16:15
in other languages one would write a nested loop 16:16
in p6 I can do for $h1.pairs X $h2.pairs -> $h1p, $h2p { ... }
but can I make that a destructuring bind somehow? 16:17
colomon "destructuring bind"?
^aristotle I tried this, on a lark:
for $h1.pairs X $h2.pairs -> ( $h1key, $h2val ), ( $h2key, $h2val ) { ... }
colomon ah. 16:17
^aristotle that doesn't work... is that rakudo or my p6?
sjohnson 3merry xmas eve to all 16:18
^aristotle is there some way to write this so that I have a single loop and still all 4 values in one variable each?
diakopter maybe not without breaking out each pair into its parts at the beginning of the loop 16:22
diakopter doesn't know 16:23
sjohnson honestkopter ^_^ 16:24
diakopter mberends: I made a mono 2.6.1 .deb for lenny i386 (using alien); seems no problems. 16:52
working on amd64 16:53
mberends: I just had to apt-get install libglib2.0-0 16:55
^aristotle how do I get from [[1],[2,3],[4]] to [1,2,3,4] ? 16:56
has to be some way to do this with some reduction operation? 16:57
sjohnson rakudo: my @a = <<1> <2 3> <4>>; my @b; for (@a) { @b.push(@a.keys)); }; say @b.perl; 17:00
p6eval rakudo 8dc189: Unable to parse block; couldn't find final '}' at line 2, near "); }; say "␤in Main (file <unknown>, line <unknown>)␤
sjohnson rakudo: my @a = <<1> <2 3> <4>>; my @b; for (@a) { @b.push(&$_.keys)); }; say @b.perl;
p6eval rakudo 8dc189: Unable to parse block; couldn't find final '}' at line 2, near "); }; say "␤in Main (file <unknown>, line <unknown>)␤
diakopter extra )
sjohnson rakudo: my @a = <<1> <2 3> <4>>; my @b; for (@a) { @b.push(&$_.keys); }; say @b.perl; 17:01
p6eval rakudo 8dc189: [0, 0, 0, 0]␤
sjohnson rakudo: my @a = <<1> <2 3> <4>>; my @b; for (@a) { @b.push(@$_.keys); }; say @b.perl;
p6eval rakudo 8dc189: Symbol '@$_' not predeclared in <anonymous> (/tmp/YbwDLbKB3u:2)␤in Main (file <unknown>, line <unknown>)␤
sjohnson rakudo: my @a = <<1> <2 3> <4>>; my @b; for (@a) { @b.push(@_.keys); }; say @b.perl; 17:01
p6eval rakudo 8dc189: []␤
sjohnson ahh who knows
sjohnson rakudo: my @a = <<1> <2 3> <4>>; my @b; for (@a) { print @a.WHAT~" "; } 17:02
p6eval rakudo 8dc189: Array() Array() Array() Array()
sjohnson rakudo: my @a = <<1> <2 3> <4>>; my @b; for (@a) { @b.push(@_.values); }; say @b.perl; 17:03
p6eval rakudo 8dc189: []␤
sjohnson rakudo: my @a = <<1> <2 3> <4>>; my @b; for (@a) { @b.push(@_); }; say @b.perl;
p6eval rakudo 8dc189: []␤
sjohnson rakudo: my @a = <<1> <2 3> <4>>; my @b; for (@a) { @b.push($_); }; say @b.perl;
p6eval rakudo 8dc189: ["1>", "<2", "3>", "<4"]␤ 17:04
sjohnson ???
too advanced for my dinosaur-sized brain
oh 17:06
i c
hmm maybe not
can @_ be the array in a for loop like this? 17:07
diakopter rakudo: my @a = [[1], [2,3], [4]]; my @b; multi flatten(@d, @c) { for @c { flatten(@d, $_) } }; multi flatten(@d, $c) { @d.push($c) }; flatten(@b, @a); say @b.perl; 17:10
p6eval rakudo 8dc189: [1, 2, 3, 4]␤
diakopter rakudo: my @a = [[1], [2,[3,4,5]], [4]]; my @b; multi flatten(@d, @c) { for @c { flatten(@d, $_) } }; multi flatten(@d, $c) { @d.push($c) }; flatten(@b, @a); say @a.perl; say @b.perl; # sjohnson 17:12
p6eval rakudo 8dc189: [[[1], [2, [3, 4, 5]], [4]]]␤[1, 2, 3, 4, 5, 4]␤
diakopter ^aristotle: see ^^ 17:13
sjohnson oh, is it because i need to use [] ref context? 17:15
or is that not even the case in p6 diakopter
rakudo: my @a = [[1], [2,[3,4,5]], [4]]; my @b; multi flatten(@d, @c) { for @c { flatten(@d, $_) } }; multi flatten(@d, $c) { @d.push($c) }; flatten(@b, @a); @b.=sort; say @a.perl; say @b.perl; # diakopter 17:16
p6eval rakudo 8dc189: [[[1], [2, [3, 4, 5]], [4]]]␤[1, 2, 3, 4, 4, 5]␤
diakopter sjohnson: your example was:
sjohnson rakudo: my @a = [[1], [2,[3,4,5]], [4]]; my @b; multi flatten(@d, @c) { for @c { flatten(@d, $_) } }; multi flatten(@d, $c) { @d.push($c) }; flatten(@b, @a); @b.=uniq; say @a.perl; say @b.perl; # diakopter
p6eval rakudo 8dc189: [[[1], [2, [3, 4, 5]], [4]]]␤[1, 2, 3, 4, 5]␤
sjohnson ( `ー´)
diakopter rakudo: my @a = <<1> <2 3> <4>>; say @a.perl; # sjohnson: your example 17:18
^aristotle diakopter: euhm
p6eval rakudo 8dc189: ["1>", "<2", "3>", "<4"]␤
^aristotle I don't want to flatten recursively
just append a bunch of arrays together
diakopter oh :) 17:19
^aristotle basically what is the equivalent to p5 @a = map { @$_ } @b
sjohnson diakopter: is [] array ref context in p6?
diakopter [] makes an array 17:20
^aristotle anyway, I'm giving up on the whole thing for now and writing what it should look like in a full p6... rather than how it can be done in rakudo:
blogs.perl.org/users/ovid/2009/12/i...omment-197
in the rakudo of today, this is 17:21
I found that destructuring one array in a signature is supported in rakudo
but destructuring two does not work
sjohnson diakopter: i thought <> makes an array as well, but using the qw() p5 type notation 17:22
^aristotle ie for @aoa, @aoa -> $pair, [ $k, $v ] { ... } will work
and for @aoa, @aoa -> [ $k, $v ], $pair { ... } will also work
but for @aoa, @aoa -> [ $k1, $v1 ], [ $k2, $v2 ] { ... } won't work 17:23
and destructuring pairs appears not implemented (and possibly not specced, I didn't read enough of the specs) 17:24
diakopter sjohnson: an array of strings, yeah 17:25
^aristotle: what about for @aoa, @aoa -> [ [ $k1, $v1 ], [ $k2, $v2 ] ] { ... } 17:26
sjohnson oh
i doth seen what i done did wrong
thanks diakopter++
i guess you can't nest that shizzle
is that TimToady-approved behaviour? 17:27
diakopter ^aristotle: (did you try it with adding brackets around the others?)
^aristotle diakopter: Symbol '$k1' not predeclared in <anonymous> 17:28
I get that for any remotely tricky signature 17:29
diakopter ^aristotle: oh 17:29
^aristotle rakudo: for %h.pairs X %h.pairs -> ($k1,$v1),($k2,$v2) { $k1.say } 17:31
p6eval rakudo 8dc189: Symbol '%h' not predeclared in <anonymous> (/tmp/ZUNnbSHbd7:2)␤in Main (file <unknown>, line <unknown>)␤
^aristotle doh
rakudo: my %h = a => 1, b => 2; for %h.pairs X %h.pairs -> ($k1,$v1),($k2,$v2) { $k1.say }
p6eval rakudo 8dc189: Symbol '$k1' not predeclared in <anonymous> (/tmp/Ux5J3eaevk:2)␤in Main (file <unknown>, line <unknown>)␤
^aristotle rakudo: my %h = a => 1, b => 2; my ($k1, $k2, $v1, $v2); for %h.pairs X %h.pairs -> ($k1,$v1),($k2,$v2) { $k1.say } 17:32
p6eval rakudo 8dc189: ( no output )
^aristotle well *I* get Not enough positional parameters passed; got 0 but expected 4
^aristotle anyway 17:33
I've already spent 2 hours fiddling with this...
diakopter ^aristotle: :) 17:34
masak ^aristotle: you might want to make a subroutine to abstract away the $hash{$key1} //= {} everywhere. that might make things a little bit nicer until Rakudo does autovivification and indexing of undefs right. 17:37
another thing that Rakudo doesn't do yet with hashes is index on non-strings. 17:39
my current workaround for that (if I want to hash on object identity and not just equivalence) is to hash on $obj.WHICH
because .WHICH is essentially a memory address, and that's unique per-object. 17:40
diakopter I can't get hashes to work at all in p6eval 17:44
ah well; gtg; bbl&
masak rakudo: my %h; %h<foo> = 'bar'; say %h.perl 17:48
p6eval rakudo 8dc189: {"foo" => "bar"}␤
masak I can get them to work. 17:49
^aristotle masak: $obj.WHICH won't help if it'll treat different pairs containing identical keys and values as distinct 18:00
cognominal how, in a derived grammar, operators can be redefined with a different precedence? 18:03
^aristotle the point is that in a hash keying on pairs, I would expect at least, ++$h{ $k1 => $k2 } would increment the same value each time $k1 and $k2 have values they had a previous time
even though ($k1 => $k2).WHICH differs each time 18:05
sjohnson i <3 perl 18:17
masak ^aristotle: what you might want to try is creating your own class, with an overloaded postcircumfix:<{ }> operator. 18:28
^aristotle: however, I must warn that -- even though the overloading itself works splendidly -- there are about four known bugs related to overloading of that operator. 18:29
let's see if I can recite them by heart: (1) blocks get misparsed sometimes, need silly line-ending semicolons. (2) you can't use .{} within the definition of postcircumfix:<{ }>, even when recursion isn't the problem. 18:30
^aristotle masak: that won't make my code shorter 18:31
masak (3) due to (2), you have to store the hash in a separate class. (4) some variables get reported as being declared doubly. 18:31
^aristotle: oh, ok. it sounded to me like it might help immensely to make your own hash access in this case. 18:32
but you know your problem domain better than I do.
^aristotle masak: did you see the link?
masak no, I must have missed that. 18:33
I have less focus on IRC than usual.
^aristotle blogs.perl.org/users/ovid/2009/12/i...omment-197
masak thanks.
^aristotle I suppose I could just fall back to a HoH 18:34
masak ^aristotle: or you find a function that returns the same value for equivalent pairs. 18:35
^aristotle it would be nice though if it's not already specced that way that pairs automatically hash based on the pair of values they represent such that that code would do what a reader would expect
masak ^aristotle: something like $key.WHICH +^ $value.WHICH, but perhaps there's something even better out there, something which guarantees that there won't be any collisions. 18:36
&
^aristotle hrm
I suppose if it's a hash indexing on Any it should use $pair.WHICH 18:37
but a hash indexing on Pair would use the value of the pair 18:38
I mean
it would equally work if I could just say (and I think this is actually specced?) $hash{Str;Str} 18:39
the way I think it's specced for multidimensional arrays
pmurias how can i create a new repo at github? 18:53
pmurias found out using google 18:55
diakopter: github.com/pmurias/javascript-v8 # i started rewriting V8.pm 18:59
diakopter pmurias: cool :) 19:10
s1n masak: didn't you work on Druid? is that still active? 19:15
mberends diakopter++: a Debian package of mono 2.6.1 will be very useful to many people. Could it be published by a willing Debian developer? 19:32
diakopter no; there's a whole debian mono group
they're way behind, tho
hm, maybe not... there's mono 2.4.3 for lenny in backports 19:33
their webpage is out of date, then (debian mono's) 19:34
masak s1n: in some sense, Druid is feature-complete. it has a complete CLI interface, and implements all the rules. I've been starting in on computer play, SVG rendering, and a Web.pm client. none of them are anywhere near completion. 19:50
rjbs Druid?
hejki github.com/masak/druid/
rjbs Cool. 19:52
masak rjbs: what hejki++ said. in November 2008 I (re-)discovered this game, and realized that I simply had to do a Perl 6 implementation.
rjbs Was it fun?
(to implement)
masak oh yes.
rjbs awesome 19:53
hejki i bet :)
masak and some lessons from that, I still haven't blogged about.
hejki at least based on my skimmings on the strat guide
masak I really should.
rjbs Is really basic stdio working on Rakudo?
masak yes,
rjbs Could I write an inetd-based service with it?
Excellent.
masak hm. dunno what exactly that takes.
but probably.
rjbs stdio :)
masak we have sockets.
rjbs Oh really?
I was unaware of that.
masak ya really. 19:54
Tene no select(), though. 19:55
hejki oh and about Druid.. 19:56
masak++
:)
rjbs select() does too much for me to understand how I would be affected by lacking it.
I guess it would affect my ability to poll properly.
I hate select. 19:57
mberends pmurias: thanks for the smop setup URL, I shall use it to try to document a full mildew build procedure on a standard Ubuntu 9.10 system 20:27
hejki is there any CGI-implementation done? 20:30
Tene There's been SDL bindings, but I don't think they work ATM. 20:31
hejki also is there something equiv to {open,read,close}dir()? 20:32
mberends hejki: yes, there is a subset in github.com/viklund/november (in lib/November dir)
hejki mberends: oh nice.. ty :) 20:33
mberends hejki: not yet, for dir we have to workaround with qqx{ ls -l }
hejki :<
s1n masak: i'm mostly interested in the guts, board display, general player handling, but i want to make something new from it 20:34
mberends hejki: there is an example of dir scanning in line 91 of github.com/masak/proto/blob/install...osystem.pm 20:44
mberends another example in line 61 of gitorious.org/http-daemon/mainline/.../bin/httpd 20:55
pmurias mberends: if you encounter any problems mention them and i'll try to help 21:02
mberends :-) thanks, I'll try most of it tomorrow (between long distractions) 21:03
sjohnson rakudo: my @a = [[1 2] [3] [4]]; my @b; for (@a) { @b.push(@_.values); }; say @b.perl; 21:13
p6eval rakudo 8dc189: Confused at line 2, near "2] [3] [4]"␤in Main (file <unknown>, line <unknown>)␤
pmurias mberends: in JavaScripdt::V8 where should the info on how to install libv8 be? 21:13
README or POD? 21:14
sjohnson pugs: my @a = [[1 2] [3] [4]]; my @b; for (@a) { @b.push(@_.values); }; say @b.perl;
p6eval pugs: *** ␤ Unexpected "@a"␤ expecting "=", context, ":" or "("␤ at /tmp/Kn84fF6be6 line 1, column 4␤
mberends pmurias: thinking... I'll get an idea from the old Sprixel setup 21:15
sjohnson std: my @a = [[1 2] [3] [4]]; my @b; for (@a) { @b.push(@_.values); }; say @b.perl;
p6eval std 29394: ===SORRY!===␤Two terms in a row at /tmp/OIaIWMljJg line 1:␤------> my @a = [[1 ⏏2] [3] [4]]; my @b; for (@a) { @b.push(@␤ expecting any of:␤ infix or meta-infix␤ infix stopper␤ standard stopper␤ statement modifier loop␤ terminator␤FAILED
..00:01 108m␤
diakopter pmurias: I suggest README 21:17
or INSTALL
mberends stick to README unless is becomes unmanageably big. Extra files == directory pollution 21:20
*it
pmurias does anyone read the README of CPAN modules? 21:23
arnsholt Occasionally
Patterner Sometimes
arnsholt But mostly I just use CPAN.pm 21:24
mberends pmurias: sure, and github treats README specially too
sjohnson pmurias: not me 21:30
sjohnson@web1:/usr/local/lib/site_perl/Sjohnson$ cpan Thing::ToInstall
well, i use sudo
pmurias sjohnson: i use the same invocation, that's why i doubt the usefullness of README 21:32
sjohnson i learned that trick from Alias of Strawberry Perl fame 21:35
pmurias sjohnson: you mean the one of PPI fame? ;) 21:39
sjohnson hmm, what is PPI? 21:46
ahh i am googling 21:47
Alias wrote this whole thing? 21:48
pmurias sjohnson: he might have had some help but he is the main author 21:49
sjohnson interesting
eternaleye phenny: tell ^aristotle one way to do the destructuring bind might be like this: for (%a.pairs X %b.pairs)>>.kv -> $akey, $aval, $bkey, $bval { ... }
phenny eternaleye: I'll pass that on when ^aristotle is around.
pugs_svn r29395 | pmurias++ | [mildew-js] use JavaScripdt::V8 instead of V8 22:56
pmurias diakopter: mildew switched from V8 to JavaScripdt::V8 :) 22:59
vamped hey, can anyone explain the subtle difference between @a=1,2,3 and $a=1,2,3 ? (or tell me where to look) 23:12
arnsholt IIRC, my @foo is the same as my Type $foo
Where Type is Positional I think
huf @ is an interpolating array 23:13
the $ one's not
for @a { } and for $a.list { }
vamped ok. so why would one want to do $a=1,2,3 ? or is $a a reference to an array? 23:14
huf no, if i understand right, it's just a plain old array
you can write it as you want
vamped hmm. lol. i thought perl 6 was supposed to be less confusing (oops - not trying to throw flaim bait). I suppose sooner or later it will click in my hed. 23:15
s/hed/head/
huf i think the value is an array, and you bind it to a variable
and if you bind it to a @variable, it interpolates in lists
if you bind it to a $var, it dont
pmurias vamped: S02:1608
huf but i'm not sure that's correct. anyone?
pmurias rakudo: my @foo=1,2,3;my @bar = 1,2,@foo;say @bar.perl 23:16
p6eval rakudo 8dc189: [1, 2, 1, 2, 3]␤
pmurias pug: my @foo=1,2,3;my @bar = 1,2,@foo;say @bar.perl 23:17
pugs: my @foo=1,2,3;my @bar = 1,2,@foo;say @bar.perl
p6eval pugs: [1, 2, 1, 2, 3]␤
vamped pmurias: is that line 1608? 23:18
pmurias yes 23:19
pmurias rakudo: my $foo=1,2,3;my @bar = 1,2,$foo;say @bar.perl 23:20
p6eval rakudo 8dc189: [1, 2, [1, 2, 3]]␤
vamped pmurias: ooh! 23:20
vamped rakudo: my $y = "bar baz"; «foo $y».perl.say; 23:27
p6eval rakudo 8dc189: ["foo", "bar baz"]␤
pmurias vamped: if you prefer to read the html version of the spec, irc.pugscode.org has turns S\d+:\d+ into links 23:29
vamped I've just always used feather.perl6.nl/syn/ 23:30
still, i'm trying to figure out how to arrive at the same line number. i can use perldoc S02...pod 23:31
perldoc and typing 1608 doesn't seem to bring me to anyplace relevant 23:33
arnsholt I always assumed the line numbers referred to the line count in the POD file?
eternaleye arnsholt: They do 23:36
eternaleye vamped: perlcabal.org/syn/S02.html#line_1608 23:38
'Sigils indicate overall interface'...
vamped eternaleye: ok, so *that's* how it's done. thanks. I'll read it. 23:39
looks like what I wanted. thanks all. 23:40