»ö« 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.
TimToady sorear: perhaps Mu and other "immutable" stuff can start out in PROCESS but we make mutable copies (at compile time) into GLOBAL of any interp if/when we notice MONKEY_TYPING. 00:43
alternately, the immutable copies just live in the setting, not PROCESS 00:44
sorear TimToady: how many copies of the setting exist per PROCESS? 01:01
TimToady to the extent that the setting is immutable, it doesn't matter 01:07
and possibly monkey patching relocates to UNIT, not GLOBAL 01:08
hmm, except that doesn't do the monkey patching, nevermind :)
uvtc From S01, what does "Everyone wants the colon" mean? 01:36
uvtc Ah. Should've searched more first. Found the rest of the expression in a transcript of an older talk: "Everyone wants the colon for their particular syntax". 01:42
dukeleto tadzik++ # getting your gsoc proposal accepted 02:37
TiMBuS im wondering what uvtc was interpreting that as.. 03:36
probably not a good idea to name anatomy after character symbols 03:37
i got a caret stuck in my colon
03:38
sorear syntactic sugar causes cancer of the semi-colon --Perlis(?); the pun has not been lost on others 03:39
TiMBuS hehe
why was i here again? oh. does anyone know if i need to add my module to perl6/ecosystem again? or does someone else do that now or is there some automated way of doing it 03:41
moritz TiMBuS: you need to add it to github.com/perl6/ecosystem/blob/ma.../META.list 06:13
TiMBuS moritz, thanks
ill do that
moritz jnthn++ # blog post 06:26
jnthn++ # awesome nqp work
dalek osystem: 53bb38d | Jarrod++ | META.list:
Added Net::IRC to META.list
06:32
TiMBuS who th heck is jarrod :v 06:33
mathw o/ 07:21
tadzik o/
donri o\
TMTWTDI 07:22
tadzik TiMBuS: we've been secretly calling you Jarrod when you weren't looking
donri Anything interesting happening in Parrot/Rakudoland lately? 07:23
mathw jnthn blogged about some interesting things in NQP 07:25
Su-Shee good morning everyone. 07:25
tadzik donri: I got into GSoC :)
Su-Shee: hello!
donri \o/ What's the project?
mathw tadzik: grats!
hi Su-Shee 07:26
tadzik donri: Pod Parser for Rakudo
donri Pod6?
tadzik www.google-melange.com/gsoc/proposa...1/tadzik/1
yep, Pod6
donri Nice
donri Now if we could get that .WHY thing working and get some nice API docs eh? 07:27
Where, as always, by 'we' I mean 'other people' or 'not me'.
tadzik donri: the biggest work will be to poddocument Rakudo itself :) 07:29
donri yea
tadzik social-life &
donri OTOH it doesn't require deep technical knowledge about parrot or rakudo 07:30
donri might include himself in 'we' afterall?
introspectable 'docstrings' are a nice feature of python and i understand .WHY is effectively the same thing 07:34
jnthn morning, #perl6 07:51
moritz \o
mathw o/ jnthn
exciting blog post
jnthn Yes, I made one at last. :) 07:53
jnthn looks forward to getting all the good stuffs into Rakudo.
donri is it about 6model? 07:54
moritz more or less 07:55
mathw It's exciting 07:56
It makes me want to write compilers
But I'd need another couple of days per week
donri linky?
mathw Can anybody arrange that?
moritz planetsix.perl.org
donri i should be subscribed to that, hm
moritz you should indeed
it has a surprisingly high signal/noise ratio for an aggregator 07:57
donri ah there we go
wasn't updated
mathw Argh, programmers! 08:01
Other programmers, that is, not you lovely people :)
donri I'm lovely. *me gusta* 08:27
mathw yup you're lovely :) 08:28
moritz hugme: hug mathw
hugme hugs mathw
moritz hugme: hug donri
hugme hugs donri
mathw hugs moritz 08:29
It's really weird here today 08:30
Virtually nobody is actually in the office
moritz is alone here too
mathw We just had a four-day weekend due to easter, and now we're about to have another one due to a royal wedding and the may day bank holiday 08:31
moritz yesterday I had some fun working on my private db project
mathw so lots of people wanted to have three days off and get a ridiculous amount of time to laze about at home and drink beer
moritz imported some data from a ~5MB dump, lots of cleanups, wiki scraping to complete the information... all in all a single run takes about an hour 08:32
s/5/50/
then dumped the db, gzip'ed it... and only 1MB was left :-)
mathw nice
moritz it felt very unimpressive :-) 08:33
mathw well that kind of thing has a habit of compressing well 08:39
moritz <rant>the original database is a bit weird... a db with foreign keys that are not enforced by the DB engine 08:41
and with no unique contraints except for primary keys 08:42
so they have a many-to-many table for mapping authors and books
and some books have the same author twice
moritz shakes head
</rant>
mathw oh I used to do things like that a lot 08:43
when MySQL didn't support such things
moritz thing is, it supports it now, but not in the default engine
mathw yeah
been ages since I wrote a database app
can't say I miss it
moritz so you have to actively chose a different engine to enfcorce referential integrity
that's like having to say 'use strict;' at the start of every program to get sanity 08:44
mathw Worse
it's very easy to get people to 'use strict' 08:45
and it's very easy to change to it if you started off without it
you just get them to write in Perl 6 :P
mathw Unfortunately I'm the only person on my team in the office today and someone just sent me a production bug report 08:46
donri www.reddit.com/r/programming/commen...df_slides/ totally karmastealing from jnthn
mathw Even more unfortunately, it actually looks like somebody's been randomly unplugging network cables, so I just have to convince them of that now... shouldn't take more than a month or two 08:46
moritz donri: should the comma after "intriguing" really be there? 08:47
donri: my grammar knowledge sucks, but it feels wrong :-)
donri moritz: edited
moritz seems the comments page is cached - the comma is still there on the link you posted, but is gone when I go to the permalink of the comment 08:48
donri toying with your own language, i think, is a fantasy of many programmers, so i think those slides can gain interest 08:51
regardless of existing interest in parrot or perl 6 08:52
SHODAN hm 09:04
moritz www.reddit.com/r/programming/new/ why don't I see donri's submission there? 09:07
mux this is most likely a very stupid question, but if I'm computing a checksum on hexadecimal data of the form "A000F342...", using Digest.pm, is it ok to split(/(..)/) the data to get individual bytes and then call $ctx->add(chr(hex($byte)) for each one? 09:19
mux I don't get the expected results so I assume I confused myself somehow and am doing something stupid 09:20
moritz mux: that' doesn't really look like Perl 6 code
mux guilty, that's perl5 code 09:21
moritz might work that way. Might want unpack 'H'
mux mmm, I'll check if I get the same results with unpack(), thanks 09:22
I wasn't sure whether I actually need to call chr() or not, it's not clear to me what format the add() method expects data to passed in 09:23
moritz we can't know that either, since you didn't tell us where $ctx comes from :-) 09:26
mux from Digest.pm, I mentioned that
$ctx being as usual a Digest object, to be perfectly precise, it's the result of Digest->new('SHA-1'); 09:27
pmurias mux: nopaste the code
moritz "The string value of the $data provided as argument is appended to the message we calculate the digest for.
mux sure thing, just a second
moritz "
seems pretty clear to me (from perldoc Digest)
mux moritz: yeah, that 'string value' thing strikes me as vague, but that may be just me
moritz mux: before the chr() you don't have a string value, but a byte number 09:28
mux pastebin.com/Ka6k1TjL here's the code 09:29
moritz oh
mux moritz: I've always been unclear as to what is a number in Perl, and it seems the very notion is vague/weird/surprising in the language (is "1234" a number? sometimes it is) 09:29
moritz split /(..)/ will return empty strings inbetween 09:30
mux I'm entirely ready to blame that on my ignorance :-P
mathw it is if it's treated as a number
mux moritz: oh shi-
moritz so you get lots of 0s
mux slaps self hard
let's try this again - thanks
moritz mux: it's simple: if you use it as a number, it's a number. If you use it as a string, it's a string
"1234" + 5 -> used as a number
print "1234" -> used as a string
mux moritz: I don't find this simple; you cannot easily know how a function is going to "use" your number if the docs aren't clear about it 09:31
it's confusion-prone is what I mean
anyways, brb
moritz that's why I find "string value" so very not-confusing.
it tells you exactly that the valuei s used as a string
mux in that case yeah, I have to admit, but since I wasn't getting correct results, I started being suspicious 09:32
mux yay, good result! thanks again moritz 09:33
donri moritz: did i get stuck in the nasty spam filter? 09:37
moritz donri: no idea 09:38
rhebus hello 11:34
colomon \o
rhebus i'm looking at make spectest_smolder for rakudo and i get dubious results locally which don't show up in the uploaded version
smolder.parrot.org/app/projects/rep...ails/15546 <-- my report
smolder.parrot.org/app/projects/tap.../15546/454 <-- dubious result (no plan at the top, strange error message) 11:35
and looking at the test, it seems like it died before finishing 11:36
colomon ICU is an optional library, which it looks like you do not have.
rhebus ok 11:38
colomon looks like indent.t is newish (or at least has a lot of new tests) and isn't properly marked as needing ICU.
rhebus I'd like to improve the error message and fix the output here
and perhaps add a plan to indent.t 11:39
colomon Improving the error message is probably a pain, alas. At least, I'm guessing it's coming from Parrot. 11:40
How about you add a plan to indent.t, and I'll get it flagged as needing ICU?
rhebus i'll look into it
sure thing
colomon did any other files have similar problems? 11:41
rhebus no other file reported "Dubious, test returned 1" 11:42
colomon rhebus++
rhebus it worries me that this info isn't captured in the online smolder page
but I'll start with the test plan, since that's something i can do 11:43
colomon hmmm.... I wonder if the problem is that it doesn't capture that sort of info, or if the problem is that everyone else has ICU?
what's the URL of the smolder page?
oh, smolder.parrot.org 11:44
rhebus pasted above already
also, there's an escaping issue in the TAP output
pastebin.com/eFbwRDyT <-- mine vs smolder --> smolder.parrot.org/app/projects/tap.../15546/454 11:45
its losing the <anon>s
or rather, it's serving it as html in <pre> tags rather than just as text/plain 11:46
dalek kudo: 8533c3c | colomon++ | t/spectest.data:
Flag S32-str/indent.t as needing ICU.
moritz rhebus++ colomon++ 11:47
colomon rhebus: just so I'm clear -- that 15546/454 is the indent.t error in the smolder results, and smolder is completely missing it, yes? 11:48
rhebus that 15546/454 is the TAP output of indent.t from my smolder test, and smolder is presenting it as HTML rather than plain text (do view source and you see <anon> "tags")
colomon rhebus: gotcha 11:50
moritz: who's in charge of smolder?
flussence dukeleto, iirc
moritz asked in parrot, but the parrots seem to be sleepign 11:51
colomon moritz++ 11:53
btw, moritz, whatever happened to your underscore? ;)
rhebus bbiab lunch
moritz colomon: the previous registration of nick 'moritz' expired, so I acquired it 11:54
takadonet morning all 12:10
Moukeddar good morning Sir
colomon huh 12:25
colomon rakudo: class A { has $.a, $.b; }; A.new(a => 1, b => 10); 12:27
p6eval rakudo 8533c3: OUTPUT«Null PMC access in find_method('b')␤ in main program body at line 2:/tmp/omKsZib4Dk␤»
colomon known?
moritz rakudo: class A { has ($.a, $.b); }; A.new(a => 1, b => 10);
p6eval rakudo 8533c3: ( no output )
moritz colomon: it tries to call self.b at compile time, because the 'has' scope doesn't extend to second thing 12:28
moritz btw search.cpan.org/~wonko/Smolder-1.51/ 12:28
std: class A { has $.a, $.b }
p6eval std 3468e14: OUTPUT«ok 00:01 121m␤»
colomon ooooooo
moritz std: my $x, $y 12:29
p6eval std 3468e14: OUTPUT«===SORRY!===␤Variable $y is not predeclared (declarators are tighter than comma, so maybe your 'my' signature needs parens?) at /tmp/n6hLzKwChs line 1:␤------> my $x, $y⏏<EOL>␤Check failed␤FAILED 00:01 121m␤»
colomon moritz: even if my code is wrong, it still shouldn't be Null PMC....
moritz the error is LTA, yes
colomon reported 12:33
moritz rakudo: class A { self.b }
p6eval rakudo 8533c3: OUTPUT«===SORRY!===␤Symbol 'self' not predeclared in <anonymous> (/tmp/9ZnwDJfSgF:22)␤»
moritz rakudo: class A { $.b }
p6eval rakudo 8533c3: OUTPUT«Null PMC access in find_method('b')␤ in main program body at line 2:/tmp/xVZ8XV4BDS␤» 12:34
pmichaud good morning, #perl6
colomon o/
moritz good am, pm
takadonet pmichaud: morning sir 12:37
Layla_91 hola hola! 13:19
Moukeddar hello hello
colomon o/ 13:20
pmichaud o/ 13:23
Moukeddar Layla_91, arabic name :) 13:23
Layla_91 how are you all doing? working hard for p6? :D am just passing by ^_^ 13:23
Layla_91 Moukeddar: that is correct 13:25
Moukeddar pretty good name 13:26
Moukeddar Qays & Layla :) the arabic love story 13:27
Layla_91 Moukeddar: well i do not really know arabic but will look for a translation :)
colomon One of my good friends in college was named Qais. :) 13:31
Moukeddar really ? 13:32
it's a beautiful name
colomon really. :)
Moukeddar Qais means : Strong , Arrogant 13:33
:p
colomon heh, we'd have given him a good bit of ribbing if we'd known that.
Moukeddar should ask about it earlier :) 13:34
Moukeddar Layla_91, where you from ? 13:37
Layla_91 Moukeddar: am Russian 13:41
Moukeddar Oh , nice :)
Layla_91 Moukeddar: yeah, and you? 13:43
Moukeddar Morocco 13:44
Layla_91 Moukeddar: oh that is were we originally are from :D 13:45
should visit it someday..
Moukeddar sweet :)
you're welcome
how's Russia?
Layla_91 great :D 13:46
jnthn back from $meeting 15:11
sjn welcome back! ^^
oh, that reminds me... 15:12
sjn prods jnthn and masak about you-know-what
moritz don't talk about You Know Who, he might track and kill you! 15:13
TimToady wakes up
jnthn sjn: Sent a mail to the you-know-where asking for the you-know-what to be put live last night.
sjn ah, cool :) 15:14
sjn found the mail 15:17
jnthn beer shop & 15:20
.oO( it closes way too öl-y... )
15:21
bbkr_ tadzik: another weird bug happened when bootstrapping Pies - bbkr.org/pies_bootstrap.png , any ideas? 15:56
on "TAP::Harness v3.12 and Perl v5.10.0"
TimToady colomon: you have an X/Y problem; instead of insisting on using the Pair type you can just use [$u,$v] which unpacks in sigs just like in Haskell 16:03
TimToady (though you raise the issue of whether a Pair should have an easy way to unpack as a subsig) 16:04
colomon what's the syntax for array unpacking in sigs?
TimToady [$u,$y] 16:04
er, [$u,$v]
pmichaud sub foo([$u, $v]) { ... } 16:05
TimToady -> [$u,$v], $y { $y == floor(($u + 1) * $v * $n); },
and such
colomon TimToady++
that's much easier than I thought
TimToady but an argument can be made for allowing a pair to bind to something like that too 16:06
biab &
jnthn rakudo: my @foo := :a(1), :b(2); for @foo -> ($key, $value) { say "$key = $value" } 16:10
p6eval rakudo 8533c3: OUTPUT«Not enough positional parameters passed; got 0 but expected 2 in sub-signature␤ in <anon> at line 2:/tmp/uyeUkPVRRt␤ in main program body at line 1␤»
jnthn rakudo: my @foo := :a(1), :b(2); for @foo -> (:$key, :$value) { say "$key = $value" } 16:11
p6eval rakudo 8533c3: OUTPUT«Mu() = Mu()␤Mu() = Mu()␤»
jnthn hm
rakudo: say Pair.^attributes(:local)>>.name
p6eval rakudo 8533c3: OUTPUT«␤»
jnthn Oh.
Fix that and both of the above will work :) 16:12
TimToady but only works for specific argument names, which makes it hard to give short names to the kv 16:31
not sure if [$k,$v] can be made to work though 16:32
possibly we could allow [$k => $v]
jnthn Well, if Pair.Capture produces something with k and v in it... :) 16:33
But that'd be a hack... ;)
jnthn We could say that .Capture on Pair actually populates the list part, not the hash part. 16:33
Then they'd bind to positional args with whatever name.
TimToady not sure whether that undoes something nice on the other side 16:34
the underlying problem seems to be not distinguishing the Pair type from a Name type
*Named
jnthn std: sub foo($k => $v) { } 16:35
p6eval std 3468e14: OUTPUT«===SORRY!===␤Preceding context expects a term, but found infix > instead at /tmp/fjNnztsYoU line 1:␤------> sub foo($k =⏏> $v) { }␤Parse failed␤FAILED 00:01 122m␤»
jnthn Well, that doesn't mean anything yet. :)
It kinda breaks the unpack symmetry though 16:36
(e.g. of having some explicit bracketing thinguymmy)
std: my @x; for @x -> $k => $v { } 16:37
p6eval std 3468e14: OUTPUT«===SORRY!===␤Preceding context expects a term, but found infix > instead at /tmp/MczBBpWxLm line 1:␤------> my @x; for @x -> $k =⏏> $v { }␤Parse failed␤FAILED 00:01 123m␤»
jnthn Phew. :)
nqp: class Foo is LolWut { }
p6eval nqp: OUTPUT«Can only use get_how on a RakudoObject␤current instr.: 'nqp;NQPClassHOW;compute_c3_mro' pc 1498 (gen/nqp-how.pir:430)␤»
jnthn meh, not updating...
colomon TimToady++ # the function works beautifully using [$u, $v] instead of Pair. blog post will be updated soon. 17:11
dalek osystem: d4e2880 | dukeleto++ | spec.pod:
Fixify the spec POD
17:43
masak evenin', zebras. 17:55
moritz \o 17:56
pmichaud changes his stripes.
colomon o/
masak #phasers in 60? 18:02
Util Yes
(well, 57 now) 18:03
masak :)
moritz thanks for the reminder 18:05
masak I wonder if a library could be built to handle the recurring intricacies of lagging variables in loops, and table-join-like loops.
masak I dealt with both at $work today. 18:05
moritz you mean like an iterator that offers a .previous method, or something? 18:06
masak no, I mean this:
Util masak: Lagging variables? Do you mean like $value_from_the_last_loop_iteration? 18:07
masak Util: yes.
which means things always happen on the iteration after.
and after the last iteration.
and sometimes there are nested lagging variables, which would have been written as nested loops, were it not for the fact that they're lagging. 18:08
it's basically what appears to be an ordinary set of loops, but slightly skewed and thus rendered tricky. I'm wondering whether a library might be able to skew it back :)
masak Moukeddar: hey there :) 18:09
Moukeddar hello
i lost the Colon 18:10
:(
masak ^ there it is
Moukeddar is my ip v6 ?
Rotwang n0
masak nope. you're among the rest of us today.
Moukeddar heh 18:11
weird
masak but you can have Perl v6 ;)
TimToady state $x will leave { .= newvalue() } # or some such...
Moukeddar it is
Util For any list, you can use .kv instead of just the value. But then how to refer to a list element when the list is not an array?
Moukeddar i'm waiting for a friend to get me a book on Perl
masak TimToady: it's not the assignment that contains the complexity. it's the triggering of updates whenever newvalue() differs from oldvalue() (and with nesting between levels of these) 18:12
I'll draw up a mock example so y'all'll see.
TimToady ah, the when to print a subtotal problem--how RPGIIish
masak TimToady: oh, I had a feeling this was a known problem :P 18:13
got any literature on it?
TimToady I wrote one of those in BASIC/PLUS lo these many years ago
colomon masak: List::Utils sliding-window is designed exactly to handle the lagging variable issue. Probably not the most graceful solution possible, though... 18:13
Util Moukeddar: chromatic's new book, Modern Perl, is available as a free PDF download, or printed on paper: onyxneon.com/books/modern_perl/ 18:14
masak in my case, it's not subtotals, it's Moose instantiations and setter calls on these. but yeah.
colomon: oh, I'll check it out with that in mind. thanks.
TimToady it's the 1st derivative, basically :)
BinGOs is reading Modern Perl on his Kindle. 18:14
moritz for @a Z @a[1..*-1] -> $a, $b { say $a, $b }
masak TimToady: whoa. yes. it is. 18:15
Util TimToady: The lagging var is my 2nd favorite example when explaining that RPG does not *completely* suck (just *almost* completely)
TimToady I am occasionally the smartest person you'll ever meet. :)
masak moritz: right, that's your "sliding window" solution :)
TimToady but most of the time not...
masak hugs TimToady
I want to think bigger. can't I just, like, add a custom library-provided keyword 'lagging' before my 'for' loop, and just have a source filter^W^W grammar-modding module take care of all the complexity for me? 18:17
though that would preclude a solution that worked with -p and -n...
colomon masak: seems like doing for lagging @a -> $a, $b { say $a, $b }
would be trivial. 18:18
pmichaud RPGII -- that was my first college course :)
masak colomon: yes, but still hides only the variables part of the complexity, which is the small part.
Util pmichaud: ouch!
pmichaud maybe a function?
masak fancy, a whole programming language for role-playing games.
pmichaud lag $a, $b
colomon masak: btw, that article on abstraction you tweeted was Very Nice. 18:19
masak colomon: I like it too, but... I don't grok it :/
jnthn back from noms :)
o/ pmichaud
Util masak: Report Program Generator
colomon woah, full house!
masak Util: yes, I googled it before I made the n00b joke :P 18:20
Util Doh!
pmichaud RPG is a fill-in-the-blank language :)
masak here's the article that colomon liked: lukepalmer.wordpress.com/2010/11/23...d-harmful/
historical note: luqui used to be a regular here. his name is still in some synopses. 18:21
colomon and luqui is Luke Palmer?
masak yes. 18:22
ah; he's @luqui on Twitter, and he used to be luqui here ;)
colomon masak: what don't you grok about it? 18:24
pmichaud updates ohloh projects 18:25
masak colomon: it's like, I see that what he's saying makes sense, up to and including the duality between abstraction and encapsulation. it's a cool way to view it. 18:27
colomon: but what I *don't* see is how I would turn any class that I've ever written inside out they way he mentions.
colomon ah.
masak I'd like to understand it. but right now I don't. 18:28
the example with List doesn't illuminate much.
colomon agreed, it's a weak example.
not least because he didn't point out how horribly inefficient his example was. indexing into a List? shudder... 18:29
Su-Shee hm, I wonder if I can slip in the diagrams in this article as "OF COURSE IT'S UML!1!" into the next code review.. ;)
moritz this is all verify artifical 18:30
using a function instead of an operator
colomon masak: I didn't see it as a system for turning classes inside out, but rather an importantly different view on the importance of abstraction.
moritz just because you can't overload that operator in C
the "correct" abstraction is for List to offer a reduce() 18:31
colomon heh, I was just going to argue that the "correct" abstraction is for List to offer an iterator. :)
masak moritz: and luqui is one of those guys who probably knows that
s/knows/know/
colomon fundamentally, I'd argue the article is just "relearning" the insight behind C++'s Standard Template Library. 18:35
masak so did a commenter.
colomon it's an obvious insight. :) 18:37
(at least if you know STL.)
sorry, I mean, the comparison between this article and STL is an obvious insight.
I still think it's very worthwhile reminding the world of the power of abstraction, though. 18:38
Util What is the planned release date for next Rakudo Star? 18:57
pmichaud today 18:58
(I'm planning to put it together later tonight... may not actually release until tomorrow sometime)
Util Thanks! 18:59
pmichaud++
jnthn pmichaud wins the bet on when my 6model work will land (e.g. not April) :P 19:00
pmichaud I wonder how much of that is due to my own inactivity, though. :-P 19:01
I don't mind preparing an interim Star release if it's done before the next scheduled release
jnthn pmichaud: Part of it is because I distracted myself doing the packages refactor that I was trying to run away from. :)
pmichaud needed to be done, though
jnthn pmichaud: You...er...may not recognize NQP any more. But I hope mostly in a /good/ way. :)
pmichaud it's okay, I somewhat expect to not recognize it 19:02
I just fixed up the nqp and nqp-rx projects on ohloh: ohloh.net/p/nqp and ohloh.net/p/nqp-rx
colomon jnthn++
masak TimToady, pmichaud, colomon, moritz: here's my example: gist.github.com/942868 19:04
pmichaud seems like it should be doable with 'when'
pmichaud when changed $shop { ... } 19:05
masak I pondered whether to use 'when'.
pmichaud changed() could be a function that monitors state or something like that
when changed $shop | $person { ... }
when changed $person { ... }
masak hm, I don't seem to have captured the outer-inner relationship between $person and $shop in my fantasy code... 19:06
pmichaud tis okay; I know what you're aiming for. Standard control-break sort of stuff.
masak I'm aiming for less cruft. 19:07
pmichaud right
masak there's no actual loop control in the example. 19:07
pmichaud "elegant control breaks"
masak just a lot of change management.
masak and this isn't a piece of code that would be helped by something like 'next LABEL' or 'last LABEL'. 19:08
for once.
colomon masak: I just get an angry unicorn when I try to look at your example. :( 19:10
masak pmichaud: even as a function 'changed' would have to be deeply magical in order to conjure up the hidden $last-seen-* variables, and all the surrounding conditionals.
colomon: works here :/
pmichaud yes, it would be magic. but I think you're looking for magic.
masak I am. 19:11
pmichaud or, perhaps we want containers to have triggers
masak I guess what I mean is that it would be more disingenous to hide magic in a function than in a keyword.
pmichaud why?
masak just a subjective feeling.
pmichaud many of our keywords are just syntactic sugar for functional magic anyway 19:12
masak I guess 'lagging' and 'notice' feel more like control structures (like 'if' and 'while') to me.
yes, but there's a difference between a keyword being syntactic sugar for a (non-magic) function, and a function being syntactic sugar for a set of magic transformations.
pmichaud yeah, I can see that 19:13
fwiw, it might be helped by 'redo'
masak hm. 19:14
pmichaud not completely, but 'redo' might be a part of it
since it gives you the ability to re-enter the block from the top without iterating
masak you keep suggesting alterations of control flow :)
the original code doesn't contain any such.
pmichaud well, other than 'if' 19:15
masak right.
pmichaud I could also see: if changed $person { ... }
masak hm.
it does read quite well... :) 19:16
pmichaud but the whole notion of "control-break" to me implies exceptions, which implies control flow
masak "control-break"?
jnthn "I'm a changed person" :)
pmichaud control-break --- do something different when a particular variable changes value (e.g., in an iteration)
en.wikipedia.org/wiki/Control_break 19:17
or is that not what this is intended to be doing?
masak oh!
pmichaud++
colomon masak: seems to me the lagging concept is kind of wrong for this example?
masak colomon: why?
pmichaud: I just didn't know it was called that. thanks for putting a name to the concept :) 19:18
pmichaud sure
it's a long-standing pattern :)
colomon masak: at least as I normally think of examples, the lagging is because it's interesting to compare the previous entry with the current. In this case, it's more of "the previous N with N changing repeatedly".
masak "Quite often there is a hierarchy of nested control breaks in a program" -- yes, exactly.
colomon masak: wouldn't this be more easily done with a hash?
pmichaud so, maybe do more research on "control break" and perhaps find something that already solves the problem 19:19
masak colomon: I didn't specify the requirements so clearly.
pmichaud also, wikipedia says that SQL and 4GLs handle this sort of stuff, so perhaps look to them for examples
masak colomon: the shops have to be added in order. and the person objects shouldn't be keps in memory (because there are, say, a billion of them)
oh right. SQL has to handle it, since that's how GROUP BY works. 19:20
pmichaud so, maybe what you want is an iterator that understands a "group by" equivalent :-)
masak that's not a half-bad idea. 19:21
pmichaud I mean, they're called *cursors* :-)
maybe some group-by options to map()
pmichaud i.e., a way to specify blocks that fire when certain conditions are met 19:21
PerlJam greetings! 19:22
masak PerlJam: \o
PerlJam is sitting in IAH waiting for a flight to Orlando FL
pmichaud ...orlando?
fun or business or both?
PerlJam I wish it was fun.
pmichaud no time for WDW? 19:23
:(
masak by the way, hakank suggested a really nice syntax for 'for' loops with inter-dependent loop variables: 'for 1..10 -> $i, 1..$i -> $j { ... }'
would have to be a grammar extension, of course.
PerlJam Gary and I submitted a paper to a conference there and since CBI has to host the new TGLO person this week, I get to present the paper tomorrow and fly home Thu
masak but it's relatively intuitive.
pmichaud pj: ever been to wdw? 19:24
PerlJam pm: long time ago.
pmichaud masak: seems like there ought to be a metaoperator that could produce $i,$j w/o the syntax
some sort of triangle cross or something like that
masak well, a triangular pattern was just a simple example. 19:25
pmichaud ah.
masak could have more involved dependencies of later variables on earlier. 19:25
pmichaud is frightened that the series operator might be able to do it. 19:26
masak :P
...the operator formerly known as the series operator...
colomon seems like the sequence op should be able to do it easily? 19:27
PerlJam seems like this sort of "counting" is a common pattern. I mean, it's very similar to string increment but you've restricted the "alphabet"
masak colomon: IIRC, the real code on which my example was based started out with hashes. but then we realized that with the "control-break" pattern, we could ease the memory footprint quite a lot.
masak PerlJam: TimToady once wanted to overload infix:<X> to handle this... 19:28
PerlJam oh ... now the triangle comment makes more sense. 19:29
jnthn pmichaud: Little NQP thought. At the moment we always treat Foo::Bar::Baz as a type, never as possibly a call if that isn't a known type. Nowadays, it's trivial to know that (it woulda been a pain once).
Not sure that we should change anything, mind... 19:30
colomon rakduo: my @a := [0], -> @x is copy { @x.push(@x[*-1]++); @x; } ... *; say @a[0].perl; say @a[1].perl; say @a[2].perl; say @a[3].perl
rakudo: my @a := [0], -> @x is copy { @x.push(@x[*-1]++); @x; } ... *; say @a[0].perl; say @a[1].perl; say @a[2].perl; say @a[3].perla
p6eval rakudo 8533c3: OUTPUT«[0]␤[1, 0]␤[1, 1, 0]␤Method 'perla' not found for invocant of class 'Array'␤ in main program body at line 22:/tmp/nzjsH4crpb␤»
colomon rakudo: my @a := [0], -> @x is copy { @x.push(@x[*-1]++); @x; } ... *; say @a[0].perl; say @a[1].perl; say @a[2].perl; say @a[3].perl
p6eval rakudo 8533c3: OUTPUT«[0]␤[1, 0]␤[1, 1, 0]␤[1, 1, 1, 0]␤»
colomon declares himself king of typos 19:31
pmichaud jnthn: yeah, I'm not sure what I want to do there.
it'll be trivial now, yes.
colomon rakudo: my @a := [0], -> @x is copy { @x.push(@x[*-1] + 1); @x; } ... *; say @a[0].perl; say @a[1].perl; say @a[2].perl; say @a[3].perl
p6eval rakudo 8533c3: OUTPUT«[0]␤[0, 1]␤[0, 1, 2]␤[0, 1, 2, 3]␤»
jnthn pmichaud: Anyway, good news is that overall, I'm relatively free of blockers at the moment. So I expect to be able to keep things moving along. :) 19:33
pmichaud good deal.
my main blocker now is that I'm doing a limited search for $newjob
jnthn Sounds somewhat time-consuming. 19:34
masak colomon: yes, but can you have it loop with [0, 0], [1, 0], [1, 1], [2, 0], [2, 1], [2, 2], [3, 0] ... [10, 10]? :) 19:37
masak guesses that's quite easy with an implementation of 'state'
jnthn pmichaud: There's also a couple of places where I'd quite like PAST::Compiler to be aware of 6model (like, when handling natively typed attributes). PAST is still the PIR implementation at the moment, but I can monkey-patch it to have something like attribute_6model for the time being. Does that sound sane-ish? 19:39
colomon rakudo: my @a := [0], -> @x is copy { @x.push(@x[*-1] + 1); @x; } ... *; my @b := @a.map(-> @x { @x[*-1] X @x }); say @b[10].perl 19:40
PerlJam masak: $j = lag $i :by(1); # something like that could encapsulate the "lag state"
p6eval rakudo 8533c3: OUTPUT«((10, 0), (10, 1), (10, 2), (10, 3), (10, 4), (10, 5), (10, 6), (10, 7), (10, 8), (10, 9), (10, 10))␤» 19:40
masak PerlJam: ooh
colomon ouch.
masak decides he would prefer 'if $person.CHANGED { ... }'
PerlJam: yours is better if I would ever want a lag larger than 1.
PerlJam: I've never had a need for that, I think. 19:41
PerlJam masak: yours reminds me of Rails and ActiveModel :)
colomon rakudo: my @a := [0], -> @x is copy { @x.push(@x[*-1] + 1); @x; } ... *; my @b := @a.map(-> @x { @x[*-1] X @x }); say @b[^4].perl
p6eval rakudo 8533c3: OUTPUT«(((0, 0)), ((1, 0), (1, 1)), ((2, 0), (2, 1), (2, 2)), ((3, 0), (3, 1), (3, 2), (3, 3)))␤»
colomon ah! correct modulo flattening. :)
masak PerlJam: right, but it doesn't hook into a DB. :)
PerlJam: just jiggles the AST a little.
PerlJam masak: mine could also end up like this: for 0..10 -> $i { my $j = lag $i; my $k = lag $j; ... } 19:43
That's usually the case where you want a lag larger than 1 IME
(I've never wanted lag :by(2) without also having a lag :by(1) ) 19:44
at least that I can recall
masak hm, true.
I like that latter syntax better.
but it still makes me have to manage the change comparisons explicitly.
PerlJam yes.
masak at least for the control-break scenario, I don't want that. 19:45
but now that pmichaud mentioned SQL and cursors, I think I'd prefer some idea that played off that.
maybe a parameterized phaser inside the loop that responded to 'callsame'? 19:46
PerlJam Hmm.
masak that would make it possible to do things both before and after chunks of similar iterations. 19:47
also, it might help localize variables even better.
PerlJam for the simple case of iterating a range of integers, you could use smart match for the lag 19:51
you can also transmogrify any iteration into something that involves an integer count.
masak could you give an example?
PerlJam (not sure if this is helpful, just thinking out loud)
I think y'all mentioned it earlier ... didn't someone say something about using when ? 19:52
Tene In a previous project, I had a function 'sliding-window-map' that accepted a window size, block, and list.
pmichaud jnthn: yes, I think PAST::Compiler needs to be aware of 6model (and should likely be built as 6model)
I was thinking of working on a nqp-implementation of PAST::Compiler
Tene In Perl 6, a nicer option would be infer the window size from the arity of the block. 19:53
moritz pmichaud: just rewriting the PIR in NQP, or also a redesign?
colomon Tene: ooooo. Don't think it's really applicable to what masak is talking about, but that's an interesting idea. :)
pmichaud mainly converting to NQP and 6model
I wasn't planning on a significant redesign
Tene so, possibly a :sliding or whatever modifier to map
right now, given 1,2,3,4 and an arity-2 block, map will run on 1,2 and 3,4 19:54
PerlJam Tene: and a :step modifier as well to jump more than 1 item at a time?
Tene would be nice for there to be a convenient way to run on 1,2 2,3 3,4
PerlJam: Maybe.
moritz pmichaud: since PAST nodes are really just captures, 6model basis shouldn't change too much, should it?
masak Tene: @list Z @list.rotate 19:55
jnthn fwiw, I'd rather they stopped being captures.
masak too
jnthn Otherwise we can't take advantage of a bunch of stuff 6model offers.
PerlJam my @ffts = map { fft(@_) } :window(32) :step(16) @stuff; # assuming @_ holds the window into @stuff. 19:56
Tene masak: 1) that's not quite the same at the ends, 2) that gets awkward with sindow size > 2, and 3) that's generally awkward to type out, compared to putting it in a function.
masak them being captures reeks a bit of bounded contexts leaking together.
jnthn blocktype could just point straight off to a Parrot-level string, for example. Block arity can just be an int.
The memory use when compiling is kinda high.
masak Tene: aye, agreed on all counts. 19:57
pmichaud jnthn convinced me that PAST notes should be attribute-based instead of hash-based
Tene masak: given the nested nature of your data, there's an elegant solution that I don't quite have the time to work out right now.
jnthn pmichaud: fwiw, somebody is doing a GSoC project on converting PAST::Compiler to NQP.
pmichaud: But they also plan to do (new)POST straight to PBC. No PIR intermediate step.
Tene masak: basically, apply a sliding window over individual lines, and then you know at what minimum depth your new line varies from the previous. 19:58
masak Tene: hm.
newbee what's the use of binding a variable to a constant?
pmichaud jnthn: yes, I'm thinking I shouldn't halt what I think needs to be done just because there's a GSoC project
also, is the GSoC for nqp or for nqp-rx?
masak newbee: you mean like 'my $a := 5'? 19:59
jnthn pmichaud: nqp-rx
pmichaud right
newbee yes, masak
jnthn pmichaud: Feel free to go ahead if you wish to work on that.
masak newbee: it's one way among at least two to set a variable to be a certain value. 20:00
jnthn pmichaud: It's certainly needed for the clr/jvm/worreva backend compilers to run on new nqp.
pmichaud jnthn: exactly
masak newbee: basically, it's binding a value to a variable without going through the intermediate container.
pmichaud and it helps us get nqp much closer to bootstrap
jnthn pmichaud: *nod* 20:00
masak newbee: from the perspective of nqp, it's actually a more basic mechanism than assignment. 20:01
tadzik hello zebras
masak tadzik! \o/
Tene masak: your function takes a list of lists, and on each block invocation, give it the current item, and the minimum-depth item that varies from the previous run, which you can dispatch on with 'when'
jnthn pmichaud: Note that I didn't put the MMD cache into nqp yet so multi-dispatch will be slow as hell :)
pmichaud no problem
tadzik seen bbkr
aloha bbkr was last seen in #perl6 38 days 21 hours ago joining the channel.
pmichaud past::compiler isn't that slow to begin with
masak Tene: oh. interesting.
tadzik seen bbkr_
aloha bbkr_ was last seen in #perl6 4 hours 5 mins ago saying "on "TAP::Harness v3.12 and Perl v5.10.0"".
jnthn It's not a lack of having a new MMD cache design. I implemented in on the clr already.
Just didn't port it yet. 20:02
It's allocation free on lookups that get a hit, unlike the one in Parrot.
newbee so $a := 5 is faster than $a = 5 ?
Tene magic-lolducks(@list-of-lists, -> $_, $person, $shop, $item { when 0 { person changed }; when 1 { $shop changed }; when 2 { item changed } }) 20:03
jnthn newbee: In Rakudo today? Probably not. In the future? Very possibly.
In NQP it's certainly cheap. But it's also the only choice. :)
Tene masak: it's your choice whether you pass an index, a pair of index -> prev value, pass names into the function so it can generate string indexes instead of numbes, etc. 20:04
masak nod.
masak I'd probably define a bunch of integer constants and when on those. 20:04
Tene masak: I don't know whether -> $_, $a { ... } works for setting the topic like that; I haven't tried it.
masak should. 20:05
masak rakudo: for 1..6 -> $_, $a { .say } 20:05
jnthn rakudo: for 1,2,3,4 -> $_, $a { .say; }
p6eval rakudo 8533c3: OUTPUT«1␤3␤5␤»
rakudo 8533c3: OUTPUT«1␤3␤»
masak jnthn: uncanny :P
Tene Hahaha, that's cute.
jnthn Curiosities. We share them. :P
masak jnthn: clearly we should spend less time together :P 20:06
Tene That's a cute little idiom; I kind of like it.
jnthn :P 20:06
masak rakudo: for 1..6 -> $_, $ { .say }
p6eval rakudo 8533c3: OUTPUT«1␤3␤5␤»
Tene Also, I'm pretty sure I haven't seen this algorithm used anywhere before, but it rather jumped out at me. I haven't reasoned about it in any detail, so I'm very curious to hear if this works well for you or not.
masak will report back. 20:07
Tene++
tadzik phenny: tell bbkr_ what os is that? Is that possible that 0 is not a success on it? 20:08
phenny tadzik: I'll pass that on when bbkr_ is around.
tadzik phenny: thank you darling
Tene That's always an interesting experience for me, when an algorithm leaps out from behind a dark corner and steals all the loose minutes out of my wallet. 20:09
masak by the way, both jnthn and I were surprised at least once each last Friday by the (re-)realization that in Perl 5, you have to precede your closure blocks with 'sub' :) 20:10
Tene haha, nice. 20:12
jnthn I also kept trying to write signatures on my subs... :) 20:14
TimToady I keep trying to use the method forms of various listops... 20:16
Tene Hmm, I bet jnthn would like my Devel::Declare::Declarative syntax for defining Perl 5 macros. I should actually finish that someday.
My prototype sketch was fairly promising.
masak hey, look what jnthn++ and I made: conferences.yapceurope.org/npw2011/ 20:21
jnthn Scary, my first time co-organizing a conference, rather than just showing up and nattering about stuff. :) 20:24
tadzik oh, That's the viking-helmeted-polar-bear!
jnthn masak++ for drawing it
moritz \o/
tadzik it resembles masak a bit, if I can say that :>
jnthn *lol*!!
masak :D
tadzik ...but my sight may be a bit confused :) 20:25
jnthn Just how hard did you celebrate? ;)
moritz don't belittle your cognitive abilities :-)
tadzik oh, notmuch
jnthn :) 20:26
tadzik jnthn: two words: Zlaty Bażant :)
masak map { $tadzik.have(Beer.new) }, ^Inf # :)
moritz I'd love to attend, but this year it's not possible :/
jnthn tadzik: Slovenske pivo! Strasne dobre! \o/
moritz wonders if masak has sink context implemented :-)
tadzik also, board games and a PM meeting. That was a good day :)
masak moritz: the runtime in my head has lots of bells and whistles. 20:27
jnthn Happily, that beer is also available in Sweden. But the price is...different. :)
sjn jnthn++ masak++ # For organizing conferences.yapceurope.org/npw2011/ 20:30
moritz indeed 20:32
jnthn++
masak++
moritz hopes it's not a too short notice
pmichaud mmmm, NPW 20:33
jnthn pmichaud: ;)
tadzik oh, I regret that I can't come :| 20:34
pmichaud looks like airfare is currently US$1100 20:35
a bit pricey for me at the moment :( 20:37
I like the logo :-)
tadzik say, doesn't it look even a little bit like masak++ himself? :P 20:38
masak I guess we tend to make things in our own image... :) 20:38
but I don't usually wear helmets. I prefer towels.
pmichaud ...you mean that's not a towel? 20:39
I figured it was an exceptionally round one.
moritz horned towel
colomon loliupdatedmyblogpostwiththewisdomofTimToady: justrakudoit.wordpress.com/2011/04/26/more-pi/ 21:11
masak can't spot the difference 21:13
mds_ Perl 6: sub abc { return 47; } $a = 'abc'; how can I call using $a Thanks 21:42
mds_ and what to do if there are arguments 21:46
masak rakudo: sub abc { return 47 }; my $a = 'abc'; my $sub = eval( '&' ~ $a ); say $sub() 21:47
p6eval rakudo 8533c3: OUTPUT«47␤»
TimToady rakudo: sub abc { return @_ }; my $a = 'abc'; my $sub = &::($a); say $sub(47); 21:51
p6eval rakudo 8533c3: OUTPUT«===SORRY!===␤Indirect name lookups not yet implemented at line 22, near "; say $sub"␤»
masak great. Rakudo is sorry. :P
TimToady alpha: sub abc { return @_ }; my $a = 'abc'; my $sub = &::($a); say $sub(47); 21:51
p6eval alpha : OUTPUT«Confused at line 10, near "= &::($a);"␤in Main (file <unknown>, line <unknown>)␤»
masak better than... that, I guess. :)
TimToady niecza: sub abc { return @_ }; my $a = 'abc'; my $sub = &::($a); say $sub(47); 21:52
p6eval niecza v4-76-g7bf5ef9: OUTPUT«===SORRY!===␤␤Non-simple variables NYI at /tmp/VdTzU2pgaW line 1:␤------> n @_ }; my $a = 'abc'; my $sub = &::($a)⏏; say $sub(47);␤␤Unhandled exception: Check failed␤␤ at /home/p6eval/niecza/boot/lib/CORE.setting line 388 (CORE die
..@ 2)␤ at /h…
masak everyone has an excuse.
jnthn At least I know how to implement that now :)
Mostly because I spent my Easter re-doing packages from the ground up. :)
TimToady
.oO(I notice he didn't say, "implement correctly"...)
Util *startle* I just read the error as "simple variables NYI" 21:53
jnthn TimToady: What would be the obvious incorrect way? :)
.oO(Better to be subtley incorrect, if I'm gonna be...)
21:55
masak actually, I'd prefer it if you were blatantly incorrect. :P 21:56
TimToady prefers subtly correct
masak again, under the assumption that you have to be incorrect in some way... :)
jnthn masak: Yeah but you just want your 2000 :P
masak g'ah, found out! :) 21:57
colomon masak: new stuff is in the section at the end marked "Update" in bold. :) 21:58
TimToady moritz: well, I thought it was a hoot, even if no one else did... 22:01
masak colomon: oh :)
I think I must have had an old cached version... 22:02
masak 'night, #perl6 22:07
dalek p/ctmo: 98eb233 | jonathan++ | src/ (2 files):
Add attribute meta-objects to the HOW exports.
22:49
p/ctmo: 591efd8 | jonathan++ | src/Regex/Cursor-builtins.pir:
Fix FAILGOAL.
p/ctmo: 4b81716 | jonathan++ | src/stage0/ (7 files):
Update bootstrap to get FAILGOAL fix.
p/ctmo: 0c07f7d | jonathan++ | src/ (3 files):
Add attributes to compile time meta-object for all packages except knowhow (got a circularity issue to resolve there).
dalek p/ctmo: cdae853 | jonathan++ | src/NQP/Actions.pm:
Oops, fix that type lookup.
23:40
p/ctmo: 509ee04 | jonathan++ | src/HLL/SerializationContextBuilder.pm:
Fix an attribute access that was wrong, caught by the in-progress undeclared attribute detection.
p/ctmo: 1a79be7 | jonathan++ | / (4 files):
Add .type to PAST::Var nodes. Also twiddle the build a bit to make sure we build changes to the PAST extensions.
p/ctmo: eafc258 | jonathan++ | src/NQP/ (2 files):
Detect undeclared attributes at compile time and complain about them. Possible now that we register them with the compile timemeta-object. Also, pass any declared type along to the PAST::Var node, though it's not used yet.
p/ctmo: cf88f9e | jonathan++ | src/how/NQP (2 files):
Standardize introspection interface implemented in the role meta-objects. Unregresses the roles.t breakage in the last commit.
jnthn Few steps further. :) 23:42
sleep &