»ö« | 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 diakopter on 25 January 2010.
00:00 mj41_ joined 00:15 dduncan joined 00:17 mj41 left 00:19 baest_ joined 00:20 baest left 00:23 dduncan left 00:24 spinclad left, renormalist left, Tene left, teneighty left, nbrown left, gabiruh left, avar left, frew left, akl left, p6eval left, hatseflats left, pnu left, gabiruh_ joined, avarab joined, hatsefla1s joined, Tene joined, avarab is now known as avar 00:28 nbrown joined 00:29 meppel left 00:32 frew joined 00:39 mssm left 00:41 lumi left 00:50 patspam joined, am0c joined, Mantis joined 00:52 xinming_ joined 00:56 sundar left 01:06 pmurias left, niros left 01:10 xinming left 01:11 lestrrat is now known as lest_away 01:13 xinming joined 01:14 Chillance left 01:15 rgrau left 01:20 niros joined 01:23 lest_away is now known as lestrrat 01:31 xinming_ left 01:33 LaVolta joined 01:41 patspam left 01:44 ShaneC1 left 01:46 kcwu_ left 01:48 partisan joined 01:50 araujo left, cdarroch left 01:51 [particle] joined 01:52 agentzh joined
pmichaud TimToady: are you actively working on list/iterator issues (in background), or should I keep plugging away at it? 01:55
01:56 cognominal joined 01:59 [particle]1 left 02:02 am0c left 02:05 kcwu joined 02:11 xinming_ joined, xinming left 02:16 lestrrat is now known as lest_away
colomon pmichaud: have you been pressing on with the other issues for list/iterator? It seems like the stuff we've been quibbling over is relatively minor... 02:18
pmichaud colomon: it's major. 02:23
colomon: it significally affects the structure of parameter passing, list context, function call returns, array construction, list assignment, ...
colomon I specifically meant the exact Iterator interface wrt .get versus .next / .value. 02:24
pmichaud even that.
colomon That seems like a small and easily changed detail compared to the rest of it.
02:25 spinclad joined
pmichaud except that the "rest of it" is intimately tied to the relationships between iterators and other classes 02:25
let me put it this way...
with this latest set of changes, I'm now on my _fifth_ implementation of arrays, lists, iterators, and the like, in eighteen months. 02:26
okay, more like 20 months now.
colomon wooof 02:27
that's a lot of rewriting.
pmichaud and not one of them has ever been a "minor detail". The smallest change in structure always requires a significant refactor of everything, and often results in a design spec change.
spinclad pmichaud: (backlogging) my .hasmore, .get example should read .next, .fetch , with .next buffering for .fetch (as in your design earlier). my using .get there confused the issue, .fetch was what i meant. 02:28
pmichaud spinclad: +1 02:29
thanks
at this stage I'm likely to start playing with a variety of implementation approaches (to see if any work) -- my question to TimToady++ was just to see if he was actively pondering things and likely to spring another set of spec changes in the next day or so 02:30
if yes, I'd probably wait for them; if no, then I'll just barrel ahead with my best guess at things
it would also help to know if he (or anyone else) had any specific leanings after today's discussions on the topic 02:31
ruoso++ was favoring an exception-based model
iirc, Tene++ was favoring a next/get model, but having it be somewhat implicit in the .Bool and .get methods 02:32
I'm currently thinking of .get as fundamental, with .next/.value to be able to have a bit more control over things. I haven't figured out how .get signals to the iterator itself "I'm done" (doesn't have to be a sentinal, as the .get could set a flag directly in in the invocant iterator) 02:33
other votes would be very welcome
02:35 TiMBuS joined
colomon pmichaud: you're thinking that when it runs out, .get can return Nil or something like that and set the flag, and the flag is what you use to check and see if you are done? 02:35
02:35 arnsholt_ is now known as arnsholt, orafu left 02:36 orafu joined
colomon I suppose Mu might be better than Nil.... 02:36
arnsholt A sentinel value would preclude storing that value in the underlying list/collection 02:38
But it's also the most convenient in a lot of cases
Hard to make a decision 02:39
pmichaud (on phone) 02:40
02:40 stephenlb left
Tene pmichaud: I'm not attached at all to implicit in .bool/.get, I just find a sentinal value rather distasteful, granting I might isunderstand how Nil is special. 02:41
02:42 niros_ joined 02:43 sjohnson sets mode: +o Tene 02:47 sundar joined 02:48 xinming joined, LaVolta left, lest_away is now known as lestrrat, xinming_ left, LaVolta joined
spinclad for the sake of discussion i suggest calling the two-block/two-continuation interface .get2: $stream.get2( -> $_ { .useit }, { ... #`($stream is done) ... } ) # no sentinal, no buffering 02:52
02:54 niros left
spinclad you can look at the two blocks/continuations as a single multi continuation (where's the syntactic support for that?) 02:54
colomon spinclad: are you proposing the blocks ought to be passed to the iterator? :O 02:57
spinclad and at that as a variant (.getM, say, for the moment) that returns a Maybe Value (in haskell term) to a destructuring case switch:
colomon: no, to the get2 method 02:58
colomon spinclad: of the iterator, though, right?
spinclad yes
it's like continuation passing style 02:59
03:01 drbean joined
colomon It seems like something you'd do in Factor rather than in Perl. (But, you know, Factor is way cool.) 03:02
I'm trying to code up toy examples, just to get a feel for what these things would be like. 03:03
Anyone have a notion whether you'd be allowed to call .value once .next returned false? 03:04
spinclad (... case switch:) (warning, pidgeon haskell) let $maybe = getM $stream in case $maybe of Maybe $value: use $value; Nothing: # $stream is done
colomon I'd be cool with that last one, I think, in a more perl 6ish version.
spinclad in Haskell, aiui, the whole building and tearing down the Maybe gets compiled away. when Perl 6 is farther along and can do that, well, much happiness... 03:06
colomon: me too.
at the moment, though, i don't see a way to compile away the Maybe layer, so at runtime it would carry a lot of overhead. 03:07
something to work for on the longer term.
colomon: once .next returns false, .value might fail. 03:08
colomon if calling .value at that point is forbidden, it actually simplifies things quite a bit. :) 03:09
spinclad (but can you tell that failure from a value whose domain happens to be Failure?) 03:11
(i keep thinking of my $b = Nil #`(or whatever Sentinal is used); for ($a, $b, $c) { #`(does this ever see $c, or even $b?) } 03:13
)
colomon TimToady's theory is that $b just disappears if you do that. 03:14
spinclad it should if it were @b, but not for $b: $b is a single value, not none, and not end-of-list. 03:15
and wouldn't for see $b as end-of-list and quit prematurely, never getting to $c? (like \0 in c strings: the same pathology.) 03:17
03:18 pnate joined
pmichaud colomon: I think that calling .value should be valid -- and it should return the "beyond the end of the iteration" value 03:19
(whatever that happens to be)
colomon I think the idea would be that whatever generates the iterator from $a, $b, $c would do the absorbing of $b.
pmichaud no, my $b = Nil causes $b to be Mu
because Nil in item context becomes Mu
it's not possible to store Nil in a variable
colomon pmichaud: calling .value after the fact would make implementing .value more complicated. 03:21
pmichaud why?
.next sets the value to be used the next time .value is called.
colomon hold on, I'll post an example. 03:22
03:23 hicx174_ joined
pmichaud for reference: 03:23
my $b = Nil; for (1, $b, 3) { say $_.WHAT; } # Int, Mu, Int 03:24
spinclad pmichaud: how about my $b = \Nil? is that already something besides the evanescent Nil itself?
TimToady Parcel(Nil) is not the same as Nil
spinclad ng: my $b = Nil; say $b.WHAT
ENOP6BOT? 03:25
pmichaud looks like ng currently gets it wrong anyway (not surprised)
colomon I think my $.code calling is a bit wrong, but the point should come through: gist.github.com/286514
afk (rocking son) 03:26
TimToady I think I'd be okay with changing Nil to mean something more like () xx *
making it more suitable as an end marker 03:27
pmichaud how would one check for Nil? still the macro?
TimToady it's primitive enough to warrant a macro, methinks
03:27 pnate2 left
TimToady it has to be magical somehow 03:27
it's sort of the only object that isn't an object, as it were 03:28
03:28 jaldhar joined
TimToady an iterator that is guaranteed always to produce nothing 03:28
03:29 araujo joined
pmichaud colomon: the first .next/.value example you have isn't good -- we don't want to invoke $.code on each request for .value 03:29
we want to invoke it once, at the time the value is generated
colomon: but more to the point, I'm thinking the .next/.value semantics belong in the Iterator role (or something that does iterating), and not in each individual iterator type 03:30
i.e., MapIterator shouldn't have to implement a .next/.value because it's already supplied by the role. MapIterator just needs a mechanism to "get the next value"
03:30 dean-ero joined
pmichaud (TimToady: this discussion about .next/.value is highly speculative still -- waiting for some guidance from you :) 03:31
TimToady what is .value?
pmichaud perhaps the best explanation is to look at something like infix:<Z>
just a sec
gist.github.com/286214 # some examples I was playing with earlier 03:32
the problem with version #1 is that we can't always know that all of the iterators/lists can properly signal end-of-list before iterating 03:33
so, one possibility is to have an iterator do ".next" (iterate to the next value, return true if there is one, false if not) and ".value" (give back the value just iterated) 03:34
03:34 cognominal left
TimToady I'm opposed to eof-like solutions 03:34
Tene pmichaud: In that model, how can you check if the iterator is done without advancing?
pmichaud Tene: well, you can't. But that's true in any model, I think. 03:35
spinclad pmichaud: if you s/$.base-iterator/$.base-iterator.value/ in method value, i think it works. if you call .value several times at the same place in map's iterator, it uses the same .value of the base-iterator... (modulo side-effects? arguably they *should* run again?)
pmichaud Tene: wait, I phrased that wrong.
spinclad: they shouldn't. The result of "map" should be the result of applying the code block *once* to each value (unless a REDO exception occurs) 03:36
spinclad pmichaud: (re colomon's example)
pmichaud spinclad: yes, I was working from colomon's example.
TimToady me feeling is that pushback ought to cover all needs to peek ahead
spinclad in which case map will call .value once at each position, and all's well
maybe 03:37
pmichaud spinclad: you're assuming that map is the only thing that would call/use MapIterator, I think?
spinclad a moment while i reread... 03:38
pmichaud TimToady: so, in the case of infix:<Z>, you're explicitly saying that we should use something like the third version?
i.e., where we go ahead and call .get and check for receiving Nil?
spinclad pmichaud: yes i am
pmichaud spinclad: I'm not sure that we can/should assume that any Iterator object has exactly one driver.
TimToady the first versions will tend to be full of race conditions 03:39
our iterators need to deal with backends that can't back up, and need pure gimme-what-you-got-right-now interfaces 03:40
pmichaud TimToady: fair enough. Those are reasons I can cope with.
TimToady the only way to guarantee those kinds of backends work right is never to ask if they're ready, if there's a way to just try to read
much like we almost always discourage people from using eof in p5
just read the filehandle
spinclad actually, i think, map doesn't call .next or .value, but just passes out a MapIterator, and the consumer .next/.value's it... so it's up to a third party. but if the third party wants to dwell on a spot .valuing it, what should happen? unspecced? 03:41
pmichaud spinclad: I think that .next of the map iterator should apply the block to the value, and store it.
spinclad yes, that's another model, and i think i agree, better. 03:42
03:42 pnate left
pmichaud TimToady: okay, I follow the reasons for wanting .get-returns-Nil a bit better now 03:44
(and I can agree with them) 03:45
I'll play with a few designs and see if I can better discover what we want Nil to really be
TimToady and if Nil is magicaller than (), this also improves things from your view, I suspect
pmichaud in some sense, Nil still wants to be a type :-)
that helps make it magicaller :-) 03:46
TimToady well, it's really a junction: none(Mu) :)
pmichaud have you had a chance to read backscroll yet? 03:47
TimToady just started 03:48
pmichaud just in case there are some other ideas there that you might want to incorporate
I kind of like the notion of "interesting values of end-of-iteration"
it may be overkill/unnecessary, but in some ways it seems to fit 03:49
TimToady interesting values of end of iteration are generally quite exceptional, I'd think
pmichaud anyway, if you see anything there worth considering, let me know. otherwise, I'm going to go with a get-returns-Nil based model and also suspend my preconceptions of what "Nil" is internally to see what can be made to fit its requirements 03:50
TimToady so I'd just be inclined to throw 'em, and not try to pass 'em in-band, esp if that slows down the is-nil test
pmichaud well, I'm thinking that in that case, the is-nil test could be a typecheck 03:51
i.e., we test for something that matches the "end of iteration" type
TimToady I'd rather keep it a simple value if possible
pmichaud fair enough.
03:52 cognominal joined
pmichaud so, what are the constraints on Nil? It needs to be something that disappears in list context, and becomes Mu when used like an item. Anything else? 03:52
TimToady since we're going to be iterating iterators at many laziness levels, this has to be a blazing fast test
pmichaud yes, and checking for Nil at the moment isn't a blazing fast test
unless it becomes its own type or something easily distinguishable from other things 03:53
TimToady it doesn't have to disappear in a list if it can never appear in a list
it merely has to terminate a sublist without terminating a superlist
pmichaud that's an interesting concept 03:54
TimToady it's not () anymore
pmichaud well, what would it be in \(1, 2, Nil, 4) ?
TimToady that returns 1,2
say 1, 2, (), 4 to mean the other thing 03:55
if we separate those concepts
pmichaud then \(1, 2, foo(), 4)
and sub foo() { return; }
TimToady can return Parcel()
that's not Nil
pmichaud okay, so...
an empty Parcel is removed in list context, and becomes Mu in item context 03:56
but an empty Parcel isn't Nil
spinclad so sub foo() { return Nil; }
pmichaud (which is a significant departure from what Nil has been previously)
TimToady not much
that returns Parcel(Nil), which is Parcel()
03:57 xinming_ joined
pmichaud I've always understood Nil to be the "undef in item context, empty list in list context" thingy, even before it was () 03:57
spinclad got it, just worked that out for /me
pmichaud I'm fine if () is now that thingy
(I'm very fine with that, btw.)
(as in, I like that *much* better.) 03:58
colomon sounds like we are getting somewhere, \o/
TimToady for Christmas, I got Umberto Eco's book: the Infinity of Lists :) 04:00
04:00 sundar left
pmichaud .... if 04:01
sub foo() { return Nil; }
is the same thing as
sub foo() { return (); }
....then how do we have an iterator return Nil? ;-)
TimToady return from the gather? :P 04:02
pmichaud is that meant seriously or as in "I don't know..."
?
TimToady we could perhaps special-case return Nil for that purpose
pmichaud okay.
"I don't know..."
(wasn't sure how to interpret the :P ) 04:03
TimToady though returning from gather does have that effect
pmichaud right
TimToady the joke was to force everything to use gather/take
pmichaud right
which has its own set of performance issues :)
TimToady including, presumably the implementation of gather :)
pmichaud and we *still* haven't resolved exactly how we want to deal with gather { my $a = 0; for 1..5 { take $a; $a++; } } 04:04
TimToady a function with a declared return type doesn't have to return a Parcel
that might or might not mean anything 04:05
being hauled off, bbl & 04:06
pmichaud okay
thanks for the ideas... I'll play with it a bit more
04:06 justatheory left
pmichaud TimToady: (opinion sought) --- my reading of the current spec prose is that there are a lot of places where "Nil" is really being used to mean "empty Parcel". So much so that it makes sense to have a name for the empty Parcel, such as "Nil" (more) 04:13
So, if that's the case, and if the empty Parcel/Nil doesn't work out well as an iterator sentinel, perhaps we should go ahead and designate some other value or special thing as the end-of-iterator sentinel? 04:14
04:15 xinming left
pmichaud (just a thought... maybe playing with implementation a bit more will yield some more clues.) 04:15
spinclad fwiw, here's a variation on infix:<Z> using a small variation on the .get2 interface: gist.github.com/286535 04:17
(version 4 therein)
04:18 lypanov1 joined 04:20 jaldhar left 04:23 xinming joined
spinclad i'm unsure as yet how well .get2 composes or scales syntactically or semantically; i'm happy with it so far and want to pursue it further. 04:23
let me know if you look at it and see problems. 04:24
04:26 lypanov left
spinclad pursues clothes-washing & 04:29
cognominal pmichaud, I thought of a sngleton value that cannot be used for anything but comparing with itself.
04:30 xinming_ left
cognominal ... well it be usable for assignment too. 04:32
cognominal returns to his bed to try to get some sleep 04:34
04:55 drbean left 04:58 dean-ero left 05:07 xinming_ joined 05:12 frew is now known as frioux 05:13 mssm joined 05:24 xinming left 05:30 xomas left, am0c joined, am0c left 05:35 christine joined 05:38 xinming joined 05:44 xinming_ left 05:47 kcwu_ joined 05:49 eternaleye left 05:53 pnate2 joined 06:00 eternaleye joined 06:01 kcwu left 06:10 sundar joined 06:19 pnate2 left 06:34 cognominal left 06:49 cognominal joined 06:51 simcop2387 left 06:53 niros joined 06:56 k23z__ joined 07:04 niros_ left, jonasbn joined 07:07 am0c joined, am0c left 07:10 simcop2387 joined 07:11 kaare joined, kaare is now known as Guest4236 07:32 Su-Shee joined
Su-Shee good morning 07:33
07:52 Baggiokwok joined 08:02 iblechbot joined 08:10 Guest4236 left 08:11 Guest4236 joined, [particle]1 joined 08:16 pnate joined 08:22 ejs joined 08:25 renormalist joined 08:28 cognominal left, cognominal joined, [particle] left 08:30 rgrau joined 08:33 drbean joined 08:34 niros left 08:35 ejs1 joined 08:36 cj_ joined 08:38 cj left 08:41 am0c joined 08:43 LaVolta left 08:44 ejs left 08:52 cognominal left, cognominal joined 09:09 dakkar joined 09:19 drbean_ joined, tkr left 09:24 Baggiokwok left 09:26 drbean left 09:38 c9s left, c9s joined 09:39 payload left 09:48 lumi joined
moritz_ good morning 09:51
09:51 rgrau left 09:52 rgrau joined
moritz_ just added a link to fedoraproject.org/wiki/Features/Rakudo_Perl_6 to the how-to-get-rakudo site 09:57
gerd++
09:59 meppl joined 10:00 payload joined 10:06 drbean_ left 10:10 Mantis left, bryan_ joined
jnthn morning 10:13
moritz_ good morning 10:14
10:19 lumi left, lumi joined, payload left 10:20 cognominal left 10:22 payload joined 10:26 lestrrat is now known as lest_away, lypanov1 left
mberends goes very offline, to work() on asp.net training 10:30
10:30 mberends left
moritz_ have fun 10:30
10:36 xinming_ joined 10:48 agentzh left 10:50 payload left 10:51 lest_away is now known as lestrrat, payload joined 10:53 mikehh left, lumi left 10:54 lumi joined, xinming left, mikehh joined 11:09 renormalist left 11:31 xomas_ joined 11:33 xomas_ is now known as xomas 11:35 lichtkind joined 11:38 drbean joined 11:39 lumi left 11:40 lumi joined, Baggiokwok joined 11:45 cognominal joined 11:46 payload left 11:47 rjh joined 11:50 cls_bsd left 11:53 Baggiokwok left 12:08 LaVolta joined 12:09 Baggiokwok joined 12:11 mikehh_ joined, mikehh left 12:12 bryan_ left, lumi left, cls_bsd joined
colomon morning! 12:13
moritz_ \o/ 12:14
12:14 lumi joined, payload joined 12:15 slavik joined
lichtkind :) 12:16
12:16 bluescreen joined 12:20 am0c left 12:42 rjh left 12:43 rjh joined
cognominal happy birthday jnthn 12:47
jnthn cognominal: Thanks! :-) 12:48
12:48 lumi left, lumi joined
moritz_ jnthn++ 12:48
erm
jnthn.age++
or so :-) 12:49
12:49 SmokeMachine joined
frettled ooh. 12:49
jnthn: congrats, may there be hundreds of more years in good health! 12:50
and since you're so young, you have a good chance for medical science to make you live for hundreds of years, too ;)
jnthn hundreds? sheesh, I might even get to see Perl 8! 12:51
frettled now now, let's not exaggerate ;)
jnthn OK. Maybe 6.6.6. :-) 12:52
frettled :)
I was going to suggest Perl 7, but...
colomon happy birthday!
12:53 mikehh_ left 12:54 jaldhar joined, mikehh_ joined 13:02 ignacio_ joined 13:05 lumi left
pmichaud good morning #perl6 13:07
13:08 lumi joined
pmichaud "Hundreds? Oh, so there's a small chance you'll see Perl 6 in your lifetime." :-) 13:08
13:09 takadonet joined
takadonet morning all 13:09
13:11 mikehh_ left, mikehh_ joined
sjn o7 13:18
pmichaud: do you know of any short and high-signal "sales texts" for perl6/rakudo? 13:19
short, as in < 100 words
pmichaud sjn: not off the top of my head. might look at perl6.org and see if there's anything there
sjn not really 13:20
a couple of us that are going to FOSDEM (Brussels, Feb 4-6)
...are going to set up a Perl stand there 13:21
frettled sjn++ :)
sjn basically see if we can't make Perl projects a little more visible
so we're trying to write some texts for flyers/postcards and such
TPF is putting some money into this too, luckily 13:22
any pointers would be helpful :) 13:24
this is what we have now: 123.writeboard.com/470b8ce9d41307670 (pw is "") 13:25
still work-in-progres
+s
as you can see, Perl6/Rakudo needs more representation 13:26
pmichaud afk # kids to school 13:35
13:40 sundar left, lumi left 13:41 lumi joined, payload left
jnthn afk # slovak 13:43
13:43 payload joined
slavik ? 13:49
13:51 payload left, payload joined 13:53 go|dfish left 14:05 [particle]1 is now known as [particle] 14:10 LaVolta left, araujo left 14:11 tkr joined 14:15 ignacio_ left 14:22 TiMBuS left 14:24 ignacio_ joined 14:25 am0c joined 14:32 ignacio_ left 14:38 lumi left, lumi joined 14:40 payload1 joined 14:42 mj41 joined 14:47 ignacio_ joined, payload left, partisan left
pugs_svn r29586 | pmichaud++ | [pm.txt]: Added Pm-19 for TimToady++ or others to answer. 14:52
r29586 |
r29586 | Pm-19: In each statement below, how many times is the block argument
r29586 | to .map() executed?
r29586 |
r29586 | my @b = (1,2,3 Z 4,5,6).map({ ... });
r29586 | my @@c = (1,2,3 Z 4,5,6).map({ ... });
14:52 Guest4236 left
pugs_svn r29586 | my ($x, $y, @@z) = (1,2,3 Z 4,5,6).map({ ... }); 14:52
colomon pmichaud: doesn't that depend on the arity (er, count?) of the block? 14:53
pmichaud assume the block has arity 1
moritz_ I guess a default of 1 is assumed
pugs_svn r29587 | pmichaud++ | [pm.txt]: Add arity/count assumption to Pm-19 (colomon++) 14:54
colomon sincerely hopes the answer is the same in all three cases....
pmichaud colomon: and what answer would that be? ;-)
colomon pmichaud: my instinct is 6, but I'd be cool with 3 in a pinch. 14:55
I just don't want what's on the left side of the = influencing the answer.
pmichaud oh, that sort of thing happens already, though. 14:56
colomon I feel strongly that that way lies madness....
moritz_ that's what context is
14:58 mj41_ left 15:01 cotto_w0rk joined, fda314925 joined
colomon But those examples are simple. What if it is something like my @@c = (1, 2, 3 Z 4, 5, 6).map({...}).grep({...}).sort.uniq ? tracing back through three functions to figure out how map is supposed to work in the @@c context..... 15:01
15:02 kcwu_ left
pmichaud colomon: the examples aren't actually that simple. but knowing the answers to those examples would likely tell me the answers to the others. 15:02
15:07 drbean left 15:08 hicx174_ left 15:09 kcwu joined
colomon s/those examples are simple/those examples could be much, much crazier/ 15:09
pmichaud anyway, I think the short(est) answer to your question would be that .map wouldn't need to know about @@c directly -- it would use the context supplied to it by .grep (which uses the context supplied to it by .sort, which uses the context supplied to it by .uniq, which uses the context supplied to it by the assignment). 15:10
however, I agree that this might be somewhat problematic -- it starts to look like the want() issue again.... which is one of the reasons I'm explicitly posing the question in pm.txt :) 15:11
colomon seems like that would require allowing multi methods to overload on context?
pmichaud no, not necessarily. the various iterators and flatteners would just need to know what context(s) to use 15:12
15:12 payload1 left
colomon Hmmm, just to make sure I'm tracking properly -- the idea here is that @@c might want a list of lists rather than a flattened list, right? 15:14
moritz_ right
PerlJam good day #perl6
colomon but doesn't it become an issue then what map's block actually does? maybe it maps single numbers to lists....
pmichaud ...that's one reason why these "simple" examples aren't so simple. :) 15:15
and no, I hadn't thought of that case, which itself is a compounding issue :-)
colomon++ 15:16
PerlJam colomon: why would the answer to Pm-19 be 6? 15:17
pmichaud PerlJam: .map could impose list context on its invocant.
PerlJam seems backwards to my intuition. 15:18
15:19 ejs1 left
pmichaud PerlJam: suppose I said instead: my @b = (foo14(), foo25(), foo36()).map( { ... } ); 15:19
colomon PerlJam: because conceptually (in my head, anyway), a map over a block with an arity of 1 wants to be fed a list of scalars.
pmichaud where each of foo?? returns a 2-element list
in that case, would you expect the lists to flatten, or no?
PerlJam I dunno. Perl 6 has my intuition from Perl 5 all cock-eyed :) 15:20
pmichaud and there's also the case of
colomon that is how it works in master, isn't it?
pmichaud my @b = (@foo[1,4], @foo[2,5], @foo[3,6]).map({ ... }); 15:21
colomon rakudo: (1, 2, 3 Z 4, 5, 6).map({ .say; $_ * 2; }).perl.say
pmichaud colomon: master is definitely not authoritative here -- it doesn't know anything about slices
colomon pmichaud: sure, just trying to justify where I might have gotten my intuitions on the subject. :) 15:22
PerlJam If we say that lists are always flattening, where's the difficulty with that?
pmichaud well, the reason I asked (and the reason for most of my questions in pm.txt) is because I can argue it several ways, so I need someone (TimToady++) to say which way is the "right" one
colomon (is dalek down? anyway, testing locally shows map's block gets called six times.)
pmichaud PerlJam: then how does one iterate over slices? 15:23
ng: say 'hello'; # I think p6eval is down
PerlJam pmichaud: is a slice a list?
pmichaud PerlJam: it's a list of lists
or one might say it's a list of captures 15:24
15:24 p6eval joined
moritz_ pugs: say 1 15:24
p6eval pugs: 1␤
moritz_ rakudo: say 'foo'
p6eval rakudo 1d4928: foo␤
diakopter moritz_: thanks for recovering that
moritz_ diakopter: I just killed the process :-)
diakopter oh 15:25
PerlJam pmichaud: what exactly do you mean by "iterate over slices"? (I can read that 2 ways)
colomon rakudo: (1, 2, 3 Z 4, 5, 6).map({ .say; $_ * 2; }).perl.say
p6eval rakudo 1d4928: 1␤4␤2␤5␤3␤6␤[2, 8, 4, 10, 6, 12]␤
pmichaud PerlJam: process a slice one capture at a time, instead of flattening the lists
15:25 araujo joined
pmichaud colomon: note that the example you give is in list context anyway :-) 15:25
colomon :) 15:26
How does that work, actually? Can you restate it in some other context?
pmichaud ...how does what work? 15:27
PerlJam pmichaud: What's the relationship between captures and lists? Because captures are fairly atomic now (non-flattening) unless we pass them through a |-prefix right?
(or maybe I have that backwards)
colomon pmichaud: how does my example get list context?
15:28 araujo left
colomon If I try to reason backwards, .perl mucks things up, because it takes *something* and returns a Str. 15:29
15:29 cotto_work left
pmichaud colomon: oh, that's a good question. The .say is in void ("sink") context 15:29
15:29 araujo joined
pmichaud the .perl will impose item context on its invocant 15:30
15:30 araujo left
pmichaud short answer -- I'm not at all sure what happens here, because contexts and slices are a bit fuzzy here (thus my question :-) 15:31
PerlJam: Captures are non-flattening, correct.
(unless explicitly flattened with |)
PerlJam so a list of captures is as flat as it's going to get without some prodding by the programmer, so this would be "simple iteration" :) 15:32
15:32 araujo joined
pmichaud oops, I mis-stated 15:32
Captures are non-flattening in slice context, they're flattening in list context
PerlJam Way off topic, but does anyone happen to know the website that has tech docs or podcasts or something for $9? I forget it's name. 15:33
15:34 ejs joined
PerlJam Hmm. so the difference between "slice context" and "list context" is just that the latter flattens and the former does not? 15:36
pmichaud PerlJam: yes, I think so.
15:37 uniejo joined, araujo left 15:38 araujo joined
jnthn pmichaud: Is the latest still that "to enforce a context call a method" holds? e.g. to put in list context, call .list? 15:38
jnthn is trying to keep up and failing
Would that imply a .slice?
pmichaud jnthn: no
jnthn And Parcel would know what to do?
OK
pmichaud .list does not mean "put in list context"
it means "return yourself as a list"
here's the difference 15:39
my $a = [1,2,3];
my @b = [1,2,3];
oops
drat
my $a = [1,2,3];
my @b = 1,2,3;
both $a and @b are Array with 3 elements
$a in list context does not flatten, while @b in list context does flatten
jnthn Right.
OK
pmichaud however, $a.list has three elements 15:40
jnthn So what does "put something in list context" actually mean at this point, or is that still an unknown?
pmichaud list(...)
PerlJam jnthn: to put an expression in a particular context, you'd use a contextualizer: item foo(), hash foo(), list foo(), slice foo()
pmichaud say list($a).elems # 1
say $a.list.elems # 3
jnthn OK, and list(@b) would flatten? 15:41
pmichaud yes.
jnthn Right.
pmichaud say list(@b).elems # 3
jnthn my @a = 1, (2, 3), 4;
my @b = slice 1, (2, 3), 4; 15:42
say @a.elems; # 4 ?
pmichaud yes
jnthn say @b.elems # ??
pmichaud @b.elems would also be 4, I think :)
jnthn Because the my @b = ... is a list assignment and implicitly forces list context ont he RHS?
*on the 15:43
pmichaud because a capture in list context flattens
jnthn Thus the "slice" is useless in what I wrote, essentially?
15:43 iblechbot left
pmichaud yeah, to store a slice one would need @@b 15:43
my @@b = slice 1, (2,3), 4; say @@b.elems # 3
jnthn my @@b = 1, (2,3), 4; # 3 or 4? 15:44
pmichaud 3
jnthn :-/
15:44 bbkr joined
jnthn oh, sorry 15:44
That was the answer I wanted :-)
pmichaud @@b = is slice assignment, not list assignment
jnthn Right.
I braino-d.
pmichaud ($a, @@b) = .... would be list assignment :-)
jnthn my @b; my @@b; # ok or error?
pmichaud error
no
jnthn OK.
pmichaud not error 15:45
jnthn ?
pmichaud two different vars
my $b; my @b; my @@b; my %b;
jnthn OK, so @@ is a sigil?
15:45 uniejo left
pmichaud yes, @@ is a sigil 15:45
jnthn @@b is not just an alternative view of @b?
OK.
pmichaud token sigil:sym<@@> { <sym> }
(from STD.pm)
jnthn OK, I hadn't appreciated that part.
I'd somehow thought @@ was just another view of... 15:46
OK, so we have item, list, slice and hash contexts?
15:46 Psyche^ joined
pmichaud and sink 15:46
jnthn Ah, ok.
PerlJam still thinks "void" when he sees "sink"
jnthn "I just poured my cold coffee into the void!" does sound SO cooler. :-) 15:47
pmichaud: OK, I think I follow the slice thing a bit more now. :-) 15:48
pmichaud "loose lips void ships" # hmmmmmm
jnthn lol!
pmichaud "Perl has everything, including the kitchen void" 15:49
PerlJam And don't even ask about "everything and the ... damn you pm! :-)
jnthn pmichaud: Dare I ask about the iterator stuff? Or should I find time to backlog later? :-) 15:50
15:50 cognominal left
PerlJam So ... if I'm reading S03 correctly, then @@b = 1, (2,3), 4; makes @@b look like [1],[2,3],[4] right? 15:50
jnthn (Gotta head out in a little bit...)
pmichaud PerlJam: more like \1, \(2,3), \4
jnthn: I'm still working away on it, but had to add a new Pm-19 to pm.txt 15:51
short answer is that TimToady++ has some good reasons for wanting a sentinel-based approach to end-of-iterator
jnthn OK.
pmichaud so, I'm heading in that direction.
PerlJam Well, I was reading about @@() and I assume it applies to "slice assignment" the same: say @@(<a b> X <1 2>) # ['a', '1'], ['a', '2'], ['b', '1'], ['b', '2']
S03:4726 15:52
pmichaud PerlJam: yeah, I'm not sure what to think there.
Because if a slice is a list of captures, but captures flatten in list context, then....
jnthn OK, and the exact nature of the sentinel is still being determined?
pmichaud: Maybe a slice is a parcel of captures? 15:53
pmichaud jnthn: correct. And it's possible that "Nil" will not be "()", or that the sentinel will not be Nil.
PerlJam pm: where does it say a slice is a list of captures?
jnthn pmichaud: OK, thanks for the updates. That saves me epic backlogging. :-) 15:54
pmichaud okay, that's not precisely correct
TimToady more like a list of parcels, I think
pmichaud PerlJam: a slice become a list of non-flattening lists
that would be a better way to say it
TimToady sincerely hopes his day is less crazy than yesterday 15:55
pmichaud basically, slice turns off the flattening nature of any of the nested lists
15:55 Baggiokwok left
pmichaud so that in list context, they no longer flatten 15:55
15:56 araujo left
PerlJam This becomes a flat list in C<@> context and a list of arrays in C<@@> context" @@ context is the same as slice context, yes? 15:57
pmichaud yes.
15:57 cognominal joined
cottoo jnthn, happy birthday! 15:57
15:57 araujo joined
TimToady if we consider take to be fairly fundamental, it means whether take 1,2,3 keeps 1,2,3 together as [1,2,3] or flattens into 1,2,3 15:57
jnthn cottoo: Thanks! :-)
15:58 Patterner left, Psyche^ is now known as Patterner
TimToady looking at it from the user end, it's in there mostly for multidimensional subscripting: @a[1,2,3; 4,5,6] 15:58
pmichaud TimToady: fossil at S03:2740?
$a = list 1, 2, 3; # force grouping using listop precedence
$a = @ 1, 2, 3; # same thing
15:58 kaare_ joined
pmichaud (does the @ require a paren?) 15:58
TimToady yes 15:59
std: $a = @ 1, 2, 3;
p6eval std 29587: ===SORRY!===␤Anonymous variable requires declarator at /tmp/FpFZALNOqz line 1:␤------> $a = @⏏ 1, 2, 3;␤ expecting twigil␤Other potential difficulties:␤ Variable $a is not predeclared at /tmp/FpFZALNOqz line 1:␤------> $a⏏ = @ 1, 2,
..…
pmichaud same at S03:2750
anyway, correct -- slice context basically affects the flattening of list elements in the slice 16:00
so, to go back and restate things from earlier 16:01
TimToady it's anti-flattening, in the sense that the conjectural groupings are no longer conjectureal
pmichaud my @b = slice 1, (2,3), 4; # @b.elems == 3
PerlJam needs a Capture, Parcel, Slice, List, Array redux 16:03
pugs_svn r29588 | lwall++ | [S03] fossil dug up by pmichaud++
pmichaud PerlJam: we're still working those out a bit. I'm fairly confident of Array and Parcel. :-0 16:04
TimToady you can mostly forget about Capture, which is just a Parcel sorted out into positional vs named args 16:06
(unless, of course, you're implementing it :) 16:07
pmichaud and a slice is basically a List with non-flattening elements 16:08
colomon TimToady: on that latest patch: @a[$ foo()] = $(bar()); should there also be parens around foo() ?
TimToady of course
blood hasn't hit the coffee stream yet 16:09
16:09 brrant joined
colomon is now imagining TimToady as a coffee-adicted vampire.... 16:09
pugs_svn r29589 | lwall++ | [S03] braino on previous patch
moritz_ is anybody opposed to deleting docs/Perl6/FAQ/Capture.pod in the pugs repo? 16:11
it seems very out of date
pmichaud void it
sink it
moritz_ sunk :-)
pugs_svn r29590 | moritz++ | delete very outdated Capture FAQ
pmichaud moritz_++
moritz_ cdn.shopify.com/s/files/1/0016/9762...od1920.png (very off-topic, but somehow I still had to think about Perl 6) 16:13
16:14 lumi left 16:15 lumi joined 16:18 nihiliad joined
TimToady hmm, no hugme to give a creepy hug to moritz++ 16:19
16:19 hugme joined
moritz_ seems to have been lost in a netsplit 16:19
16:19 moritz_ sets mode: +vv p6eval hugme
TimToady hugme: hug moritz++ creepily 16:21
hugme hugs moritz++ creepily
jnthn hugme: hug me adverbially
hugme hugs jnthn
jnthn aww!
TimToady you didn't smile right
hugme: hug jnthn adverbially 16:23
hugme hugs jnthn adverbially
jnthn \o/ 16:24
hugme: That was a SO adjective hug!
Time to go and celebrate getting a year old...back later/tomorrow. :-) 16:25
TimToady have the appropriate amount of fun
colomon and an inappropriate amount of beer. 16:26
TimToady thinks about chow fun
colomon is that what -Ofun is all about? 16:27
TimToady beats colomon with a wet noodle
colomon Is it a saucy noodle? I'm getting kind of hungry... 16:28
16:28 rgrau left
jnthn augment grammar P6 { token routine_declarator:chow { <sym> <routine_def> } }; chow Main() { } 16:32
<- really gone now :-)
16:33 payload joined, payload1 joined, payload left
diakopter mmm chow mein 16:37
TimToady pmichaud: given how Failure can be either in-band or out-of-band in Perl 6, I think we should probably use some particular Failure as the sentinel, like Failure() 16:51
pmichaud TimToady: yeah, that seems reasonable to me 16:52
TimToady then people can write in 'use fatal' style if they want
pmichaud I'm not sure I understand that last part ('use fatal')
TimToady and since Failure() is both a type and a singleton value, we can optimize
when a sub-iterator terminates with fail; it throws and exception instead of returning Failure() normally 16:53
16:54 sukomalo joined
pmichaud given that lists in general are pretty common, won't that cause lots of exceptions for even normal list semantic type thingies? 16:54
TimToady not sure how that interacts with gather/take though
pmichaud I mean, even a simple say @list; could end up throwing an exception
TimToady normally we'd use the Failure() as a sentinal value
maybe that depends on whether the implementation of say does 'use fatal', not the current scope 16:56
pmichaud ...I thought things like 'use fatal' were dynamic, though.
and it's not really the say() that would be imposing fatalness or non-fatalness, but whatever say uses to iterate its slurpy argument list 16:57
TimToady use fatal is lexically scoped
fail looks up at the caller to see what it says
in the caller's lexical scope
pmichaud just one level of caller?
TimToady don't see how it could work otherwise 16:58
pmichaud okay, that's fine.
16:58 SmokeMachine left
pmichaud I didn't recognize that aspect of 'use fatal', but if that's how it works, no problem. 16:58
TimToady you have to write the code in your lexical scope with one assumption or the other
can't have your caller changing the meaning of your code that way
pmichaud anyway, a sentinel Failure works for me 16:59
TimToady OTOH, maybe Failure() doesn't give a good message
some some particular subtype of Failure
pmichaud yeah, subtype of Failure was where I had been leaning at one point
TimToady Nothing() or some such
pmichaud NoMore() :-)
TimToady AllGone()
pmichaud AllDone() 17:00
Done()
End()
Fini()
TimToady TheEnd()
It'sTheEndoftheWorldasWeKnowIt-andIFeelFine() 17:01
pmichaud Fine()
TimToady Credits() 17:02
pmichaud okay, I'll go with some sort of sentinel or special-typed sentinel and see how that works. Did you see the Pm-19 addition?
TimToady ENOTYET
pmichaud no problem -- I'm about to grab lunch.
there was some discussion of it in the backscroll also, around 14:51Z 17:03
17:04 lumi left 17:05 lumi joined
pmichaud afk, lunch 17:06
TimToady colomon: In my house, you aren't allowed to cry over spilled milk, but you *are* allowed to cry under it. 17:11
17:14 sukomalo left, pma joined 17:15 cotto_w0rk is now known as cotto_work 17:16 SmokeMachine joined 17:22 pma left 17:25 ash_ joined 17:27 cognominal left
colomon TimToady: a sensible policy. 17:28
17:29 justatheory joined 17:32 stephenlb joined 17:36 cdarroch joined
[particle] jnthn: happy birthday! 17:38
ash_ so... jnthn and/or pmichaud and/or colomon, any of you noticed that loop in ng seems to require a ; after it? even when it doesn't seem like it should?
colomon I saw you mentioning it yesterday. 17:41
seems like it must be some sort of parser glitch?
ash_ yeah, i think it is (probably) a parser glitch
ng: eval("loop { say 'done'; last; };");
p6eval ng 7daa82: done␤Warning␤Null PMC access in get_string()␤current instr.: '_block14' pc 29 (EVAL_1:0)␤
ash_ ng: eval("loop { \n say 'done'; \n last; \n } \n");
p6eval ng 7daa82: Unable to parse blockoid, couldn't find final '}' at line 1␤current instr.: 'perl6;Regex;Cursor;FAILGOAL' pc 1664 (src/stage0/Regex-s0.pir:907)␤
TimToady ash_: did you ever find STD.pm? 17:42
ash_ TimToady: yes i did, thanks 17:43
I am starting a compiler independent study in a week-ish and i was going to show my professor some of the perl 6 things I have been working with / learning since the christmas break, the perl 6 grammar is pretty amazing IMO, it would be interesting to implement a parser capable of handling it, like pmichaud's nqp-rx, but i doubt i'd be able to (in any sort of reasonable timeframe) implement the grammar completely, but i might try doing parts of it in our study 17:45
17:46 am0c left
colomon looks like loop is line 354 of Grammar.pm 17:48
PerlJam ash_: you mean loop requires a semicolon after the block even when it shouldn't?
That would be exceedingly weird. 17:49
colomon PerlJam: yet it is true. 17:51
PerlJam is building ng now to see
colomon Works okay if the loop is the last thing in the file, but if something else comes after, it fails.
without the semicolon, that is. with it's fine.
PerlJam weird 17:52
ash_ it gives the "Unable to parse blockoid" parser error if you don't have the ';' 17:54
17:55 Chillance joined
colomon ash_: hmmm, I'm getting the "Confused at line blah" error here. 17:55
PerlJam too
ash_ what is the difference between <block> and <xblock> in the grammar?
PerlJam xblocks can be pointy I think 17:56
ash_ colomon: are you running t/spec/S04-statements/loop.t ?
colomon ash_: no, I just made a dead simple test file.
TimToady xblock is for an expression before a pblock 17:57
such as an if or a for
PerlJam ah, x for expression
ash_ colomon: can i see your example? and/or i can post mine
lisppaste3 colomon pasted "loop example" at paste.lisp.org/display/93942 17:58
PerlJam colomon: mine was just loop { say "hi"; last; } # :-)
colomon that's in working form, obviously, but easy enough to change.
PerlJam: oh sure, golf me. ;)
ash_ still, either way, those examples look perfectly valid to me 17:59
colomon oh sure, it's definitely a bug.
TimToady last I heard, ng was trying to parse without using a MEMO array, like STD uses
17:59 dakkar left
TimToady maybe it's necessary here 18:00
PerlJam looks at STD's statements 18:01
TimToady it's the stuff at the end of blockoid
ash_ i don't know the details, but if it can work for things like 'for' why wouldn't it work for 'loop'? just speculating...
TimToady specifically the endstmt memo 18:02
ash_ if you do <xblock(1)> whats the purpose of the (1) ? i am still learning how the whole grammar thing works :P 18:04
18:04 ejs left
TimToady um, STD doesn't have that parameter 18:04
colomon ash_: it's passed in as $*IMPLICIT 18:05
not that I know what that does.
so maybe setting a flag which is normally 0 to 1?
TimToady maybe it's the difference between if and while on the handling of a bare block 18:06
while assumes -> $_ but if doesn't
18:06 ignacio_ left
TimToady I don't think STD cares about that distinction currently 18:06
ash_ well, for uses <xblock(1)> in ng, but while just uses <xblock> (same with if) 18:07
PerlJam aye, $*IMPLICIT == 1 seems to setup $_
TimToady sorry, I meant if and for 18:08
while is like if
PerlJam well, a true value for $*IMPLICIT anyway
ash_ it seems all the other statement_control tokens use xblock except loop
18:08 go|dfish joined
colomon PerlJam++ has it. line 160 of Actions.pm handles IMPLICIT. 18:09
PerlJam yep
ash_ no, i spoke to soon, default, CATCH, CONTROL statements use <block> as well
PerlJam ash_: default too 18:10
ash_ okay, got ya, so (1) wouldn't be the issue
PerlJam oops, you said that one
the gravity around CATCH an CONTROL was too great for me too see default :)
TimToady well, does default {} fail? 18:11
ash_ no, not for me
ng: given 5 {default {say 'hi';}} 18:12
p6eval ng 7daa82: hi␤
ash_ and its okay with whitespace and newlines around the { } too
PerlJam ash_: you don't even need a give to use default 18:13
er, *given
TimToady ng: given 5 { default { say 'hi'}␤say 'lo'}
p6eval ng 7daa82: hi␤
TimToady well, default needs to know where to succeed to
ash_ i know, i just like know where its going to return to
ng: default { say 'a'; } say 'b'; 18:14
p6eval ng 7daa82: Confused at line 1, near "default { "␤current instr.: 'perl6;HLL;Grammar;panic' pc 500 (src/stage0/HLL-s0.pir:328)␤
TimToady ng: default { say 'hi' }
p6eval ng 7daa82: hi␤
colomon oooo
18:14 stephenlb left
ash_ did i spell something wrong? 18:14
colomon ng: default { say 'a'; }; say 'b';
p6eval ng 7daa82: a␤
TimToady ng default { say 'a' }␤say 'b';
ng: default { say 'a' }␤say 'b'; 18:15
p6eval ng 7daa82: a␤
colomon it is the same bug in this context.
ash_ ah
well then, it might be <block> related
TimToady eh, the semi above is necessary because there's no newline
PerlJam TimToady: I think you were on the right track with @*MEMOS and <endstmt>. Rakudo does something equivalentish, but different.
TimToady not because of the bug
if you put in newline with ␤ it works 18:16
PerlJam: or not equivalent
colomon TimToady++ is correct.
18:16 rgrau joined
colomon blast, I thought we had a clue there. 18:16
TimToady is always correct, except when he isn't.
18:16 araujo left
jettero I don't think my font is showing ␤ well... what is that meant to be? 18:17
ash_ a new line
jettero oh, I guess that's what it is, but it's really small
TimToady which bot does that?
18:18 stephenlb joined
TimToady u: ␤ 18:18
phenny: u: ␤ 18:19
must be misremembering
PerlJam didn't know that any of the bots were unicode-smart
TimToady there was one on here a month or so ago
jettero oic, it's a tiny little N and L in a big enough font. It looks kinda like a right arrow in my terminal font 18:20
TimToady the p6eval bot will translate it both directions 18:21
diakopter .u ␤
phenny U+0020 SPACE ( )
U+2424 SYMBOL FOR NEWLINE (␤)
TimToady that were it
jettero :) How do you type that btw? 18:22
diakopter copy/paste
jettero I can type things like — and ē with my compose key, but I can't find a sequence for ␤
TimToady I have a program that I can type to get it: 'u newline'
various input methods allow raw unicode input, if you know the hex code 18:23
gnome has a native one that I always forget
jettero I'm going to look for that immediately 18:24
ctrl-shift 18:26
TimToady CTRL-SHIFT-u
jettero yeah, the u
18:28 ShaneC joined
lichtkind moritz_: can i get some question time? 18:28
18:34 cdarroch left 18:35 araujo joined
ash_ i like how in OS X you can just hold alt and get a limited set of unicode characters (like ¢ = option + 3) but you can switch input modes and do option + unicode number and it will put the character in 18:37
jettero I'm very fond of the compose key... it's still new for me. You can add things to it if there's characters you like, not on the list 18:39
I needed some way to type: I'm running perl 5.10 on my palm prē
18:44 cdarroch joined 18:45 araujo left 18:46 Chazz joined 18:47 Chazz is now known as Guest77853, araujo joined
ash_ so how would a *MEMO help with finding the end of the loop 18:47
18:50 Guest77853 is now known as Chazz 18:52 cj_ is now known as cj
pmichaud back from lunch 18:54
diakopter on Windows (since 3.1) you can Alt+0, codepoint on numpad
ash_ yay unicode support in all major os's
bsd probably functions the same as linux, if your using gnome, etc. i am sure
jettero I can't get the windows version to work, probably my terminal 18:55
or synergy
pmichaud the problem with "loop" in ng is likely related to the <.ws> 18:56
or perhaps the :s isn't properly scoped
lichtkind what was the end oft pugs hajdays end of 2007 ?? 18:57
18:57 araujo left 18:58 araujo joined
pmichaud I'm guessing it's the :s 18:59
ash_: *MEMO isn't used for finding the end of the loop here -- the problem is that after finding the end of the loop, it's not detecting a valid statement terminator. 19:00
and that generally has to do with eating or not-eating whitespace at the end of the closing brace 19:01
ash_ ah, okay, i guess that makes sense
pmichaud so *MEMO (in STD) keeps track of where it's seen statement-ending curly braces
I have a fix... spectesting now
19:03 rblasch joined 19:04 araujo left
pmichaud pushed as commit 78e3b48 19:05
19:06 araujo joined
dalek kudo/ng: 78e3b48 | pmichaud++ | src/Perl6/Grammar.pm:
Fix statement termination with 'loop' statement control -- noticed
19:06
ash_ cool, t/spec/S04-statements/loop.t probably works then 19:07
pmichaud it fails, redeclaration of $i
ash_ ah, it still has the list declaration issue then
pmichaud right
ash_ i can change the test to not rely on list declarations 19:08
pmichaud yes, changing that causes the test to pass.
(feel free to double-check and commit changes) 19:09
19:09 araujo left 19:11 araujo joined, ejs joined
pmichaud If we use .get() on an Iterator to get a single element, is there a good name for a method on Iterators that could be used to retrieve (up to) $n elements? 19:13
.grab($n) ?
(For filehandles, we use .lines($n), but that doesn't seem to fit for a generic iterator.) 19:14
19:14 araujo left 19:15 rblasch_ joined 19:16 araujo joined
ash_ collect? 19:17
.collect(5)
pmichaud I thought of collect earlier, but didn't like it for some reason. although it seems better now. 19:18
Plus, if we do that then we can always call collect :-)
(sorry, bad pun)
PerlJam why not just .get($n) ? 19:19
ash_ .gimme(5)
pmichaud because it (currently) conflicts with .get on filehandles :)
I'm fine if .get accepts an argument
19:19 araujo left
colomon what does .get($n) return? 19:20
PerlJam .lines($n) seems like it could be a synonym for .get($n) that just has the unit of iteration built-in for human convienence.
colomon: a list of $n things from the iterator.
pmichaud colomon: .collect($n) (or .get($n) if adopted) returns a parcel with the $n next elements from the iteration 19:21
19:21 araujo joined
colomon so is .get(1) equivalent to .get() or does it return a parcel with 1 element? 19:21
PerlJam If there's only 2 things left to iterate and we ask for 5 things from the iterator, do we get 3 Failure()s ?
pmichaud PerlJam: either that or just 2 elements 19:22
or 2 elements and 3 nils
I'd reserve returning Failure() for when nothing is returnable.
PerlJam colomon: yes :)
19:22 rblasch__ joined
pmichaud in general, a parcel with 1 element is the same thing as the one element. 19:23
colomon pmichaud: ah
sorry, just trying to work through the ramifications of having the function which defines iteration return something which requires iteration. 19:24
PerlJam colomon: a parcel doesn't *require* iteration
colomon (or will a n element parcel have some other approach for examining its values)
PerlJam colomon: you just have to put it in the proper container or context
pmichaud basically, one possibility of map: 19:25
my $c = $iter.collect(&block.count); 19:26
last if $c ~~ sentinel;
&block(|$c)
modulo syntax and the fact that eventually we don't want to be using .count to figure out the number of arguments
ash_ so... that could be like $file.map -> $line_1, $l2, $l3, $l4 { } and have line_1 ... n ? 19:27
colomon pmichaud: shouldn't the test be more like "last if $c.elems != &block.count" ? (understanding that .elems probably doesn't work here)
19:27 araujo left
pmichaud colomon: no, it's possible to call block with fewer than .count elements 19:28
(optional params, for example)
colomon rakudo: (1..5).map({ say $^a; say $^b; });
p6eval rakudo 1d4928: 1␤2␤3␤4␤
pmichaud that's a bug in rakudo 19:29
colomon k
pmichaud rakudo: (1..5).map( -> $a, $b? { say $a; say $b; });
p6eval rakudo 1d4928: 1␤Use of uninitialized value␤␤2␤Use of uninitialized value␤␤3␤Use of uninitialized value␤␤4␤Use of uninitialized value␤␤5␤Use of uninitialized value␤␤
pmichaud that should display 1 2 3 4 5 Mu()
19:29 araujo joined
pmichaud (with \n's) 19:29
19:30 rgrau left
colomon pmichaud: is the ? necessary or just polite? I guess I'm asking, if it weren't there, should it display 1 2 3 4 ? 19:30
pmichaud if the ? isn't there, then there should be a complaint about not enough arguments being sent to the block 19:31
19:31 araujo left
pmichaud just as if one did 19:31
rakudo: (-> $a, $b { say $a; say $b; })(5)
p6eval rakudo 1d4928: Not enough positional parameters passed; got 1 but expected 2␤in Main (file src/gen_setting.pm, line 324)␤
colomon gotcha.
okay, sorry for the digression. 19:32
ash_ std: (-> $a, $b? { say $a; say $b; })(5)
p6eval std 29590: ok 00:01 108m␤
ash_ looks good to the std if you just use ?
PerlJam syntax isn't the problem.
pmichaud rakudo: (-> $a, $b? { say $a; say $b; })(5)
p6eval rakudo 1d4928: 5␤Use of uninitialized value␤␤
19:32 iblechbot joined
pmichaud okay, Use of uninit valud then :-) 19:32
19:32 araujo joined
pmichaud *value 19:33
I'll go with .collect($n) for now. 19:34
ash_ rakudo: (-> $a, $b? { say $a; say $b.WHAT; })(5)
p6eval rakudo 1d4928: 5␤Failure()␤
colomon pmichaud++ # .collect($n) 19:35
pmichaud desperatly wants to eliminate rakudo's master branch so that we don't see all of the places where it's become wrong
19:36 rblasch left
ash_ pmichaud++ # for trying to get things figured out so ng can be master 19:36
19:38 araujo left 19:39 araujo joined 19:40 rblasch_ left
colomon wants to be able to say "ng is my master now." 19:42
pmichaud afk for a bit 19:43
ash_ how does rakudo-master deal with some of the issues like iterators? 19:44
PerlJam colomon: you could, on your local repo, delete master and rename ng to master. :)
colomon PerlJam: it wouldn't be the same.
PerlJam colomon: then perhaps you really want to be able to say "ng is our master now" :) 19:45
19:45 ash_ left
colomon fair enough. :) 19:48
TimToady it seems strange if $iterator.collect($n) just returns another iterator 19:50
for native types at least, you'd like to get a compact representation of those $n elements
and for other types, a Seq or Array of 'em 19:51
19:52 mariano__ joined
TimToady there has to be some reason you want $n of them all together, and I suspect that'll involve treating them out-of-order, which implies indexing 19:52
or some other reason for keeping the batch as a single object
(I'd prefer .getbatch over .collect, I think, just to emphasize the relationship with .get) 19:53
and to me, "collect" implies looking in random places 19:54
19:54 cdarroch_ joined, bluescreen left
PerlJam TimToady: why not just .get($n) ? 19:55
TimToady because then the type of the return value is not constant
PerlJam .many($n) then? 19:56
TimToady maybe .getseq($n)
PerlJam getseq and getbatch seem to be encoding type information in the name when it should be a parameter IMHO 19:57
.get($n, Seq) # I'm stubborn :)
TimToady BLETCH
19:57 ash_ joined, lumi left 19:58 lumi joined
TimToady if anything is parametric, it's the type of each element 19:58
PerlJam yes, I agree with the sentiment, but getseq makes me feel the same way :)
true
(or maybe true :)
TimToady and getseq may be written quite differently from getarray 19:59
I think we also need to think hard about where we're baking in serial assumptions that we shouldn't 20:00
20:00 ejs left
TimToady i.e. hyper map should not be implemented with a while loop 20:01
PerlJam tries to wrap his head around "non-linear" iterators 20:04
20:06 cdarroc3 joined, jonasbn left
jettero "serial assumptions" as in: maybe it's on multicore? 20:07
or something fancier?
20:09 cdarroch left
TimToady research.sun.com/projects/plrg/Publ...Steele.pdf 20:10
20:11 cdarroch_ left 20:14 araujo left, uniejo joined
pmichaud I don't want $iterator.collect to return an iterator, it returns a Parcel 20:14
which can then be turned into a Capture (and that doesn't require iterating or flattening)
20:15 araujo joined, jaldhar left
pmichaud I'm fine with .getbatch 20:15
jettero these slides are great. 20:16
PerlJam jettero: they were fine until he started speaking lisp :) 20:17
20:17 payload joined
jettero heh 20:17
I may not get all the way through then 20:18
pmichaud I'm fine with .getseq also
20:19 payload1 left
pmichaud .getbatch is nice; I had been considering .batch some time ago, to also emphasize the "batch" nature 20:19
.getseq might imply that what we're getting back is a Seq, which really oughtn't be the case
PerlJam concludes that TimToady and pmichaud have some weird aesthetics
pmichaud PerlJam: yeah, we both like Perl 6. :)
20:20 lumi left, lumi joined
PerlJam .getseq and .getbatch both make me retch a little. I could probably warm up to .batch though since it works in multiple conceptual dimensions. 20:20
pmichaud in some sense, they should make one wretch. We don't generally expect people to be using these directly :) 20:21
*retch
or *a wretch :-)
20:22 japhb left
pugs_svn r29591 | pmichaud++ | [t/spec]: Remove unnecessary list declaration from loop.t . 20:22
TimToady have also been considering whether the done testing should be an ugly operator: take @iterators.>>get /// last 20:24
20:24 cdarroc3 left
TimToady instead of a macro 20:24
(well, such operators are macros) 20:25
it's also possible we should be hijacking the existing orelse/andthen for this
pmichaud hmmm, hadn't thought of those. that's a possibility.
anyway, I've created a new branch ("ng1") for ripping-out/refactoring ng's current parcel/list/array stuff -- we'll see how far I get :) 20:26
TimToady since there's basically in there to process lists of continuations
dalek kudo/ng: b8201fd | pmichaud++ | t/spectest.data:
Mark t/spec/S04-statements/loop.t as passing.
colomon I dunno, I'd hesitate to add language-level support for using the iterators without some evidence that end-users were using them directly on a fairly regular basis. 20:27
TimToady the basic point of the Steele slides is that parallizable lists should be represented as trees that can subdivide the work in parallel
colomon: if you want to write the primitive operations in Perl 6, you have to have even more primitive operators to write 'em with 20:28
pmichaud since our lists are lazy, that sounds more like parallizable iterators
TimToady hyper lists are the opposite of lazy
they're a form of eager list 20:29
pmichaud okay, but to get to the eager list we often have to go through an iterator first
TimToady but we still have to be able to iterate those
colomon I thought we'd done away with the concept of hyper / eager lists?
pmichaud colomon: nafaik
TimToady who ever said that?
pmichaud I'm sure that @a >>+<< @b involves hyper lists :-) 20:30
colomon no one ever said it directly, but I thought the point of what we were doing is that lists are by definition lazy.
pmichaud "lists" plain, yes. but hyper lists are a different animal.
lists are lazy, unless eager or hyper :-) 20:31
TimToady at least two different defs of list here
list *context* is lazy
colomon I thought that @a >>+<< @b would be adding two Seqs, or something like that.
pmichaud (Seqs are lazy too :-) 20:32
TimToady can be lazy
just like Arrays
pmichaud right
colomon (BTW, I'm still somewhat tempted to allow @a >>+<< @b to be lazy... or to have an equivalent lazy concept, at least.)
TimToady well, it depends on whether the context of *that* wants it lazily, eagerly, or hyperly
but hyperops are already claiming you don't care what order they're done in 20:33
pmichaud I thought part of the point of >><< was to say that it could be hyperized
right
20:33 cdarroch joined
TimToady which kinda implies you'll eventually want all the values 20:33
regardless of which order you use them
that's why we say that hyper is a form of eager 20:34
pmichaud I've been very tempted several times in Rakudo to go make sure that >><< doesn't evaluate things in sequence
TimToady they're both run-to-completion semantics
pugs did that :)
pmichaud haven't done it yet, but I'm likely to do so 20:35
PerlJam pmichaud: after ng becomes master :)
TimToady pugs: (1,2,3)>>.say
p6eval pugs: 2␤3␤1␤
20:36 uniejo left
pmichaud PerlJam: yeah, the setback on lists/iterators this past weekend has definitely put me behind schedule. I'm trying to catch up. 20:36
(not behind schedule for Rakudo *, just behind schedule for my milestone)
colomon Right, I understand the benefits of having hyper. I'm just thinking there are potential benefits to having list-ops, too, like the ability to add two finite lists with a single operator.
s/finite/infinite/
I suppose it falls into the category of "easy enough to implement that you can do it in a module". :) 20:37
TimToady it might fall out from the S metaoperator
pmichaud "so easy, even a caveman can do it." 20:38
colomon pmichaud: seriously, it's just (@a Z @b).map(-> $a, $b { $a + $b; }), isn't it? 20:40
the only tricky bit is handily the grammar to make using it elegant.
*handling
pmichaud colomon: yes, that works 20:41
or even { $^a + $^b } for @a Z @b
TimToady of course, Z could in some cases hyperize itself too 20:43
colomon TimToady: S»op« -- example says "single-thread", but does it also implement "serial" (ie in order)
TimToady "serial" is one of the things the S stands for
colomon ?
TimToady: is that a yes? 20:44
20:45 araujo left, araujo joined 20:46 araujo left
PerlJam colomon: See S03:4282 :-) 20:46
colomon PerlJam: That's exactly where I'm looking. 20:47
20:47 araujo joined
PerlJam colomon: I know ... the paragraph right above the example you gave seems pretty clear to me. 20:47
colomon PerlJam: combined with the examples it doesn't seem that clear to me. 20:51
PerlJam colomon: why? Do you think it's doing something different in each of those examples? 20:52
colomon In particular, normal hyper-ops both don't have a default ordering and are potentially multi-threaded. 20:53
The example suggests S makes a hyper-op single-threaded.
That doesn't tell me if it is also serial. 20:54
It certainly isn't short-circuit, I hope!
I'm trying to figure out what set of S-words apply.
And are they still otherwise hyper? 20:55
It seems like serial, single-threaded hyper-ops could be lazy. This spec most definitely does not say that, though...
20:59 araujo left, araujo joined, fridim_ joined 21:00 tarski joined, SmokeMachine left, lumi left, lumi joined 21:01 japhb joined
colomon Though I suppose the only point (that I can see) to force single-threading is to also force it to run in order. 21:07
spinclad well, it does say Sequential...
ash_ forcing single-threading might also be to protect the data if you don't know if its thread safe? 21:20
colomon ash_++ 21:24
21:24 mariano__ left
ash_ since most people don't write threadsafe code by default, since its only occasionally a legitimate concern 21:25
21:31 k23z__ left 21:33 payload left 21:35 ejs joined 21:36 payload joined 21:40 meteorja1 joined, meteorjay left 21:45 athaba joined 21:52 cdarroch left, rblasch__ left 21:57 araujo left 21:58 araujo joined 22:02 lumi left, lumi joined 22:08 uniejo joined
ash_ completely unrelated to perl 6 but i found this, its pretty cool, this guy visualized some sorting algorithms, corte.si/posts/code/sortvis-fruitsa...index.html 22:18
22:21 pnate left
ash_ is there a reason for ng1 on github? 22:24
pmichaud ng1 is where I'm going to push my list/iterator changes for the next couple of days 22:27
because they're guaranteed to break tests for a short while 22:28
when it's done (hopefully tonight/tomorrow), I'll merge back to ng
22:29 kaare_ left
ash_ is it that big of a deal if ng regresses? since its not master 22:29
22:30 kraih_sri left 22:31 Su-Shee left
pmichaud no, but branches are cheap. 22:32
and merges are easy in git.
ash_ yeah, true
pmichaud I only expect to keep the branch for a day or so, unless I bog down, in which case it's much easier to throw away the branch than it is to revert a bunch of changes
and that's the other reason for using a branch, I'm not sure that the next attempt will be the one we ultimately want to keep 22:33
although I already ripped out the Parcel -> List conversions in ng1, and I'm surprised at how much still works :)
although arrays are pretty much hosed atm
ash_ do any of the perl 6 list things have much of an affect on nqp-rx? 22:37
pmichaud not yet. the @(...) definition might.
but it should be pretty similar overall. 22:38
the main reason nqp-rx doesn't have an issue is that its lists aren't lazy :)
and there's no flattening or list context -- it's just binding
ash_ ah, okay, cool 22:40
22:45 mikehh_ left
PerlJam nqp-rx++ (A verful useful version of simplicity) 22:46
s/verful/very/ 22:47
pmichaud hmmm
PerlJam one of these days I'll get my fingers and brain a little more coordinated
japhb Still, the sentiment was accurate. 22:48
22:49 iblechbot left
pmichaud looks like the difference between .list and .iterator is that the former is marked as "flattening" 22:50
s/is/might be/
ash_ i am doing an independent study with a professor on compilers soon, i was thinking of trying to implement part of nqp for part of it
pmichaud ash: that'd be cool
22:51 colomon_ joined 22:52 he_ left, mtve left, yves left, REPLeffect left
pmichaud need walk -- bbl 22:52
ash_ i am working from the Compilers principles, techniques and tools second edition and the crafting compilers book, so i'll see what happens
22:52 yves joined, mtve joined, ejs left 22:53 athaba left 22:54 davidfetter joined
davidfetter oh hai 22:54
PerlJam ash_: what would your compiler generate? C? or something else?
davidfetter what's the latest re: rakudo atop parrot 2.0?
ash_ probably llvm for now, i don't know though, i am still learning :P 22:55
PerlJam ash_: were you going to try the GSoC too? I think I saw you say something about that on #parrot 22:56
22:57 alester left
ash_ yeah, this independent study is only till may-ish, so GSoC i think is more summer time, i was hoping to learn about compilers in general and then hoping for the GSoC to do the stack frame builder in llvm if it hasn't been done, or some other things if i can figure out something useful to try with parrot 22:58
the independent study is so i am not completely lost if i talk to the #parrot people about compilers 22:59
23:06 mssm left, mssm joined 23:09 Chillance_ joined, _Chillance_ joined
pmichaud davidfetter: rakudo runs on parrot 2.0 23:10
(both ng and master branches)
23:12 lumi left, lumi joined, patspam joined
ash_ unfortunately there hasn't been enough interest in a compiler class at my college, so i am doing it as an independent study 23:13
23:13 RichiH left 23:14 RichiH joined
lichtkind why is parrot no 2.0 23:16
API breakes?
Tene lichtkind: what? why is parrot 2.0? Because January happened.
lichtkind ah so year was over 23:17
i thought parrot 1.0 was because to st an API that will not be changed until 2.0
ash_ the major number changes once a year, its 2.0 this year, next year it will bump to 3.0 23:18
for parrot
davidfetter pmichaud, great! is there anything else gating distribution on fedora?
ash_ i only know because i asked them a few days ago :P
lichtkind ash_: so no major API breaks? 23:19
ash_ nope
well, Context and CallSignature PMCs merged into CallContext but thats all in the changelogs
i think thats the biggest change incompatibility change i can think of, but ask on #parrot for more details 23:20
lichtkind ash_: thanks but i was never much into the low level side 23:21
23:23 lumi left, lumi joined 23:26 Chillance left 23:27 Chillance_ left 23:34 ihrd joined 23:35 uniejo left 23:40 hudnix joined 23:44 ash_ left
hudnix rakudo: class A { method foo {say "foo"} }; class B {has A $.aaa handles 'foo' }; my B $b; $b.foo 23:54
p6eval rakudo 1d4928: ( no output )
23:56 hercynium joined 23:59 ihrd left