»ö« 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. |
|||
00:02
xinming left
00:03
xinming joined
00:06
MayDaniel left
00:08
xinming left
00:11
xinming joined
00:15
xinming left
00:21
snearch left
00:22
xinming joined,
replore_ joined
00:25
retupmoca left
00:26
xinming left
00:29
Chillance left
00:30
isBEKaml left
00:32
dayangkun joined
00:34
isBEKaml joined
00:40
Trashlord left
00:42
isBEKaml left
00:44
xinming joined,
isBEKaml joined
00:48
xinming left
00:54
isBEKaml left
00:56
isBEKaml joined
00:58
scott_ joined,
scott_ is now known as Guest79334
00:59
dayangkun left
|
|||
araujo looks in | 01:21 | ||
01:26
xinming joined,
zby_home left
|
|||
sorear | araujo \o/ | 01:30 | |
good * #perl6 | |||
araujo | sorear, /o/ | ||
hehe | 01:31 | ||
shachaf | sorear: Hello. | ||
01:31
xinming left
01:32
isBEKaml left
01:34
zby_home_ joined
01:35
xinming joined
01:41
zby_home_ left
01:42
dayangkun joined
01:46
xinming left,
dayangkun left
01:51
benabik joined
01:56
replore_ left
02:01
zby_home_ joined
02:06
tokuhirom left
02:09
lestrrat left
02:10
lestrrat joined
02:20
packetknife joined
02:44
xinming joined
02:49
xinming left
02:54
xinming joined
03:01
xinming left
03:02
whiteknight left
03:07
xinming joined
03:09
pat_js left
03:10
benabik left
03:34
orafu left,
orafu joined
|
|||
TimToady | sorear: if you haven't, see discussion from irclog.perlgeek.de/perl6/2012-02-14#i_5149103 and following | 03:46 | |
03:47
xinming left
|
|||
TimToady | (the gist has been revised a couple times since then, however) | 03:47 | |
03:49
xinming joined
|
|||
sorear | is REALLY an existing concept? | 03:52 | |
03:55
xinming left
03:56
xinming joined
03:58
Bucciarati joined
04:03
xinming left,
xinming joined
|
|||
TimToady | no | 04:09 | |
see the further discussion of "delegate" and such | 04:10 | ||
though it might possibly be a pointer in the object header that is already there | |||
we're basically trying to suss out the bits and pointer of something SV-esque | 04:11 | ||
04:14
xinming left
04:15
xinming joined
|
|||
TimToady | of course, this meaning of "delegate" could also just be composition for simple types, depending on VM support for this and that | 04:19 | |
04:20
xinming left
04:30
xjiujiu joined,
packetknife left,
packetknife joined
04:32
dalek left,
xinming joined
04:33
dalek joined,
ChanServ sets mode: +v dalek,
rsimoes1 left
04:35
noam joined,
rsimoes1 joined
04:40
packetknife left
04:48
thou joined
|
|||
sorear | TimToady: I don't like this "intrinsic truth" thing - niecza only has one concept of truthiness atm | 04:50 | |
I'm only looking at the gist currently | 04:51 | ||
04:53
jaldhar left
|
|||
sorear | less charitably, niecza has a lot riding on .Bool being the only real truth. :D | 04:54 | |
04:55
retupmoca joined
04:57
odoacre joined
|
|||
sorear | TimToady: what do you mean by OK and Nil being *roles*?! and how is it possible for a role to be "in" Any? | 04:57 | |
o/ retupmoca | |||
retupmoca | \o | ||
05:12
birdwindupbird joined
|
|||
TimToady | sorear: please read the backlog on that; they aren't really roles | 05:16 | |
I'm just trying to talk about low-level concepts in terms of high-level concepts that don't quite fit | 05:18 | ||
05:23
am0c joined
|
|||
TimToady | sorear: so, if you don't have a low-level concept of "true", how do you tell if the result of .Bool is true or not? :) | 05:23 | |
05:29
daemon left,
daemon joined
05:30
diakopter left
05:32
diakopter joined,
sorear left
05:33
sorear joined
05:40
xjiujiu left
05:45
kaleem joined,
X99 joined
05:52
X99 left,
X99 joined
05:56
xinming left,
kcw left,
xinming joined
06:03
birdwindupbird left
06:05
birdwindupbird joined
|
|||
moritz | \o | 06:06 | |
sorear | o/ moritz | 06:08 | |
I am not going to understand this proposal until I've had a chance to talk to jnthn, I think | 06:09 | ||
moritz | phenny: tell jnthn that on the bs branch, t/hll/01-language.t segfaults here in default_type_check -- want a backtrace or anything? | 06:14 | |
phenny | moritz: I'll pass that on when jnthn is around. | ||
06:33
xinming left
06:42
stepnem left
06:44
xinming joined
06:55
X99 left,
xinming left
06:59
thou left
07:00
xinming joined
07:04
zby_home_ left
07:07
tarch joined
|
|||
TimToady | perl6: for [1..5] X [0..2] -> $a, $b { say "A $a B $b" } | 07:07 | |
p6eval | pugs b927740: OUTPUT«A 1 0 B 1 1A 1 2 B 2 0A 2 1 B 2 2A 3 0 B 3 1A 3 2 B 4 0A 4 1 B 4 2A 5 0 B 5 1A 5 2 B » | ||
..niecza v14-42-g1d02da9: OUTPUT«A 1 2 3 4 5 B 0 1 2» | |||
..rakudo bd5adb: OUTPUT«A 1 B 0A 1 B 1A 1 B 2A 2 B 0A 2 B 1A 2 B 2A 3 B 0A 3 B 1A 3 B 2A 4 B 0A 4 B 1A 4 B 2A 5 B 0A 5 B 1A 5 B 2» | |||
07:08
tarch left
|
|||
TimToady | only niecza++ gets that right | 07:08 | |
unfortunately, rosettacode.org/wiki/Knapsack_probl...ded#Perl_6 depends on rakudo's incorrect behavior | 07:09 | ||
07:09
wtw joined
07:12
xinming_ joined
|
|||
TimToady | perl6: for 1..5 X 0..2 -> $a, $b { say "A $a B $b" } | 07:13 | |
p6eval | pugs b927740: OUTPUT«A 1 0 B 1 1A 1 2 B 2 0A 2 1 B 2 2A 3 0 B 3 1A 3 2 B 4 0A 4 1 B 4 2A 5 0 B 5 1A 5 2 B » | ||
..rakudo bd5adb, niecza v14-42-g1d02da9: OUTPUT«A 1 B 0A 1 B 1A 1 B 2A 2 B 0A 2 B 1A 2 B 2A 3 B 0A 3 B 1A 3 B 2A 4 B 0A 4 B 1A 4 B 2A 5 B 0A 5 B 1A 5 B 2» | |||
07:14
xinming left
|
|||
TimToady | pugs appears to be assuming a lol that it shouldn't, but both rakudo++ and niecza++ get that one right | 07:14 | |
07:20
xinming_ left
|
|||
sorear | fwiw, what you're seeing at :07 is what I call the major design flaw with **@foo | 07:21 | |
well, "most major". I could live with it in 6.0 if nobody has a good fix, it's not blocker-level by any means | 07:22 | ||
...wait, we had this discussion already, wrt removing the Any/list fallback | |||
07:23
tarch joined
|
|||
sorear | heh. over on #p5p we see... a guy ranting about Perl 5.16 removing a feature. Which has been officially deprecated since 1998. | 07:25 | |
moritz | oh. Which one? | 07:28 | |
sorear | defined(@array) | 07:29 | |
moritz | oh | ||
07:35
Guest79334 left,
fsergot joined
07:38
pomysl joined,
pomysl left,
pomysl joined
07:40
scott_ joined,
scott_ is now known as Guest83103
07:48
SHODAN left
07:49
SHODAN joined
07:50
xinming joined,
overrosy_ left
08:02
kaleem left
08:03
kaleem joined
08:06
ab5tract left
08:12
fsergot left
08:13
am0c left
08:20
ab5tract joined
08:22
mj41 joined
08:30
noam left
08:32
stepnem joined
08:34
noam joined
08:46
zihan joined
|
|||
zihan | hi | 08:47 | |
08:48
zihan left
09:03
lestrrat left
09:04
lestrrat joined
09:11
noam left
09:12
noam joined
09:25
fsergot joined
|
|||
moritz | nom: say 'foo'.split('+')[0] | 09:26 | |
p6eval | nom bd5adb: OUTPUT«foo» | ||
moritz | nom: say 'foo'.split('+', 2)[0] | ||
p6eval | nom bd5adb: OUTPUT«foo» | ||
09:29
mj41 left
|
|||
moritz has several things to discuss with jnthn++, and really wishes for a higher bandwidth medium than IRC | 09:29 | ||
masak | sort of like a Perl workshop or something. | 09:32 | |
good antenoon, #perl6. | 09:33 | ||
moritz | oh right, and we two coming up \o/ | ||
I've decided not to tackle <*foo> right now. But I think it's worth attacking sink context. | |||
masak | ++moritz | 09:39 | |
moritz | I just don't know if it's within my reach | 09:40 | |
09:41
mj41 joined,
jnthn joined
|
|||
dalek | kudo/nom: a94a530 | moritz++ | src/core/Backtrace.pm: make backtraces a bit more awesome |
09:42 | |
jnthn | morning, #perl6 | 09:43 | |
phenny | jnthn: 06:14Z <moritz> tell jnthn that on the bs branch, t/hll/01-language.t segfaults here in default_type_check -- want a backtrace or anything? | ||
09:43
dakkar joined
|
|||
jnthn | Dang, irssi hung, lost all my windows. :( | 09:43 | |
Granted it'd been running for six months straight or something... | 09:44 | ||
apejens | 10:44 Irssi uptime: 468d 22h 57m 8s | ||
sorear | morning, jnthn | ||
sorear wonders if jnthn has used /upgrade | 09:45 | ||
jnthn | sorear: no | ||
moritz | apejens: cool | ||
jnthn | apejens: wow. :) | ||
apejens | only thing as stable around here must be the box it runs on :p | ||
jnthn figures he should get stuff ready for this week's Stockholm trip. | 09:46 | ||
moritz | jnthn: I've noticed that string interpolation generates code that boxes the literal chunks, and calls infix:<~> on them and the variables | 09:47 | |
jnthn: wouldn't it be more efficient to deal with native strings, and emit concat calls directly? | 09:48 | ||
jnthn | moritz: huh, the literal chunks should be coming from the constant table... | ||
moritz: Though yeah, we could just embed them as STRING* literals. | 09:49 | ||
moritz | jnthn: should I add that as an optimizer ROADMAP item, maybe? | ||
jnthn | moritz: You could even make an argument for code-genning it as a join | ||
moritz | ah yes, that's even more efficient, probably | 09:50 | |
jnthn | moritz: I'd be more inclined to just code-gen it faster in the first place ;-) | ||
moritz | jnthn: second question, I've been thinking about object hashes | 09:54 | |
the obvious approach would be have a role, just like for typed hashes, and mix it into Hash | |||
but that doesn't scale well; if you want both typed keys and values, you're in trouble | |||
so I think we need a better general approach - have you possibly though of something already? | 09:55 | ||
masak reads what S09 has to say on the topic | |||
09:55
snearch joined
|
|||
moritz | masak: iirc it just states the expected behavior, not how it's supposed to be done | 09:55 | |
ie you write my %h{Any}, and then can use Any keys | 09:56 | ||
without stringification, that is | |||
I've prototyped that functionality in gist.github.com/1826725 but that seems to be the easiest part of it | 09:57 | ||
09:57
daxim joined
|
|||
masak | ooh | 09:57 | |
yes, that seems to be what S09 says. | 09:58 | ||
10:05
Trashlord joined
|
|||
jnthn | moritz: I think we should be able to do more efficiently then needing two hashes (one for keys, one for values), fwiw. Parrot's Hash PMC has a set_key_type method, for example. That in turn winds up calling VTABLE_hashvalue. | 10:13 | |
moritz: Beyond that it's mostly wiring that up to .WHICH. | 10:15 | ||
moritz: Is your prototype relying on ObjAt stringification? | 10:17 | ||
moritz | jnthn: yes. ObjAt boxes a string right now, so unboxing that would also work | ||
jnthn | Ah, so in this view of things object hashes just call .WHICH on their argument. | 10:18 | |
10:19
PZt left,
cosimo left,
jtpalmer_ left,
ranguard left,
ranguard joined
10:20
jtpalmer joined
|
|||
moritz isn't aware of alternative views that would work, and DWIS on value types | 10:20 | ||
10:20
JimmyZ joined
10:21
cosimo joined
10:22
Trashlord left
10:25
Trashlord joined
|
|||
jnthn | moritz: I guess another override of the role TypedHash that introduces a %!keys would do it | 10:26 | |
10:27
wolv is now known as wolverian
10:34
PZt joined
10:35
PZt left
10:37
Pzt3 joined
|
|||
masak | given a shaped array of hashes @AoH, I should be able to do @AoH[*; 'key2'] = @AoH[*; 'key1'], and it assigns the value of 'key1' to the value of 'key2' of every hash in the array, right? | 10:38 | |
10:38
Pzt3 is now known as PZt
10:39
birdwind1pbird joined
|
|||
masak | I just got asked the corresponding question from a colleague, but in Perl 5. the best I could give him was either 'for my $hash_ref (@AoH) { $hash_ref->{key2} = $hash_ref->{key1} }' or '$_->{key2} = $_->{key1} for @AoH'. | 10:39 | |
moritz | can you really do hash indexing in .[]? | ||
masak checks S09 again | |||
moritz | I don't trust S09 too much here, because it's never been implemented | 10:40 | |
masak | I don't find it in S09. | 10:42 | |
I agree it's not immediate that it should work. | |||
but that's why I said "shaped array of hashes", because I figgered the compiler or the runtime would need to know that @AoH has a "array of hashes" structure. | 10:43 | ||
jnthn | moritz: I'm quickly playing with something while packing. | ||
masak .oO( repeat while .pack { ... } ) | 10:44 | ||
jnthn | My train is an hour later than I'd first thought :) | 10:45 | |
masak | :) | ||
10:47
birdwind1pbird left
10:50
birdwind1pbird joined
|
|||
dalek | kudo/sink: 4d0f65c | moritz++ | / (3 files): Add a stub Perl6::Sinker to add &sink annotations This is blatantly stolen from Perl6::Optimizer, and currently just walks the tree and does nothing else |
10:51 | |
moritz | nom: say do { if 1 { 2 } } | 10:54 | |
p6eval | nom bd5adb: OUTPUT«2» | ||
10:57
Trashlord left
11:08
Guest83103 left
|
|||
jnthn | moritz: gist.github.com/1835111 | 11:11 | |
moritz | \o/ | 11:12 | |
jnthn | Let's see if I busted any spectests. | ||
moritz | meh, a working PAST dumper would be helpful for the sink stuff | 11:14 | |
I'm trying to come up with a list of things that don't need &sink | 11:15 | ||
and at the same time I wonder if it wouldn't be easier to add :nosink annotations in Perl6::Actions for the less obvious stuff | |||
11:21
birdwind1pbird left
11:22
xinming left
|
|||
dalek | kudo/nom: e89eb10 | jnthn++ | src/core/Hash.pm: First cut of getting moritz++'s object hash prototype work integrated into Hash itself. |
11:25 | |
kudo/nom: b7a852a | jnthn++ | src/Perl6/ (2 files): Wire up the my %h{SomeType} syntax. |
|||
jnthn | moritz: May well be. | ||
moritz: It'd perhaps have to be a <nosink> annotation now, but figuring out what we want there means we can put it more neatly into QAST. | 11:26 | ||
moritz nods | 11:28 | ||
11:30
pernatiy left
|
|||
jnthn | 2 ** Rat/FatRat/Rational cleanup | 11:34 | |
Is that ROADMAP item done now? | |||
11:45
MayDaniel joined
11:53
am0c joined
11:56
sisar joined
|
|||
jnthn | stockholm ^ | 12:04 | |
& even | |||
masak | safe journey. | 12:08 | |
moritz | jnthn: well, we have Rat and FatRat, but in theory Rational should be a parametric role, and it isn't yet (but I consider that a rather low priority goal right now) | 12:25 | |
12:25
am0c left
|
|||
masak | I'm vaguely bothered by the word "OKness". feels like we could do better. | 12:27 | |
12:36
benabik joined
12:40
pernatiy joined
12:50
bacek joined
13:11
skids left
|
|||
moritz | that's... my smallest concern with that proposal :-) | 13:13 | |
13:14
noam left
|
|||
masak | sure, naming isn't a big deal, and nothing to get stuck on. | 13:16 | |
but they are often an indication that a concept is missing, or has been overlooked. | |||
to me, "OKness" seems an unwieldy version of a word that we haven't discovered yet. | 13:17 | ||
dalek | ast: 1b362ee | moritz++ | S09-hashes/objecthash.t: initial object hash tests |
13:26 | |
kudo/nom: fd74491 | moritz++ | / (2 files): test object hashes; remove them from the roadmap |
13:27 | ||
13:28
noam joined
|
|||
masak | moritz++ | 13:34 | |
13:48
kaleem left
|
|||
dalek | kudo/nom: e238121 | moritz++ | src/core/Hash.pm: make Hash.push aware of non-Str keys |
13:48 | |
ast: 38ed6b6 | moritz++ | S09-hashes/objecthash.t: Hash.push + typed hashes |
|||
moritz | so, writing tests does find bugs :-) | 13:49 | |
turns out that Hash.push allows creation of arrays as elements in the case that a hash is both typed and key-typed | |||
if it's just typed, it is correctly prevented | 13:50 | ||
13:54
kaleem joined
|
|||
JimmyZ can't understands why 0.5 dies ok, but 0.9 lives ok | 13:55 | ||
moritz | JimmyZ: because 0.5 already has a value | 13:56 | |
JimmyZ: so Hash.push turns it into an array [$old_value, $new_value] | |||
JimmyZ: but the type constraint on the hash forbids the creation of an array | 13:57 | ||
JimmyZ | moritz: thanks, just see the old value in the top | 14:00 | |
masak | nom: sub balanced { return if (my $c += $_ eq "[" ?? 1 !! -1) < 0 for $^s.comb; return !$c }; .say if .&balanced for map { .fmt("%06b").trans("01" => "[]") }, ^64 | 14:05 | |
p6eval | nom bd5adb: OUTPUT«[[[]]][[][]][[]][][][[]][][][]» | 14:06 | |
JimmyZ | it's give me an impression that typed hash is slower than untyped hash | ||
14:06
raoul joined
|
|||
JimmyZ | *giving | 14:07 | |
moritz | JimmyZ: how did you arrive at that conclusion? did you benchmark the two? | ||
masak | nom: sub balanced { return if (my $c += $_ eq "[" ?? 1 !! -1) < 0 for $^s.comb; return !$c }; .say when &balanced for map { .fmt("%06b").trans("01" => "[]") }, ^(2 ** 6) | 14:08 | |
p6eval | nom bd5adb: OUTPUT«[[[]]][[][]][[]][][][[]][][][]» | ||
JimmyZ | moritz: same pir ops, but typed hash uses more | 14:09 | |
moritz | JimmyZ: that's not a good way to judge performance. Not at all. | ||
JimmyZ | moritz: just an impression, hehe | 14:10 | |
moritz | but you are right, they are slower | 14:12 | |
6.6s (no types) vs 8.5 (just value types) vs 12s (both values and keys typed) | 14:13 | ||
JimmyZ | moritz: yes, pmc hash object is the killer, from bacek++'s gist | 14:14 | |
14:17
jaldhar joined
14:18
kaleem left
|
|||
masak | nom: sub balanced { all((my $c += $_ eq "[" ?? 1 !! -1) < 0 for $^s.comb) && !$c }; .say when &balanced for (^(2 ** 6))».fmt("%06b")».trans("01" => "[]") | 14:26 | |
p6eval | nom bd5adb: OUTPUT«===SORRY!===Redeclaration of symbol $cat /tmp/f7OZkWSnoP:1» | ||
masak | huh. | 14:27 | |
moritz | nom: my $x = $_ for 1..2 | ||
p6eval | nom bd5adb: ( no output ) | ||
masak | hehe, I just did that locally :P | 14:28 | |
moritz | but why all()? | ||
masak | yeah, that's a bad choice. | ||
shoulda gone with [&&] | |||
all() doesn't guarantee me order, and I want that here. | 14:29 | ||
nom: say all(my $c for ()) | 14:30 | ||
p6eval | nom bd5adb: OUTPUT«===SORRY!===Redeclaration of symbol $cat /tmp/ihiTsgEUHA:1» | ||
masak | nom: all(my $c for ()) | ||
p6eval | nom bd5adb: OUTPUT«===SORRY!===Redeclaration of symbol $cat /tmp/XLWPyMzIwp:1» | ||
masak | that's the shortest I can make it. | ||
masak submits rakudobug | |||
nom: sub balanced { ([&&] ((my $c += $_ eq "[" ?? 1 !! -1) < 0 for $^s.comb)) && !$c }; .say when &balanced for (^(2 ** 6))».fmt("%06b")».trans("01" => "[]") | 14:31 | ||
p6eval | nom bd5adb: ( no output ) | ||
moritz | nom: sub balanced($c) { my @c = [\+] $c.comb.map: { $_ eq '[', ?? 1, -1}; @c[*-1] == 0 && not grep * < 0, [\+] @c }; say balanced '[]' | ||
p6eval | nom bd5adb: OUTPUT«False» | ||
masak | too many [\+] | 14:32 | |
moritz | nom: sub balanced($c) { my @c = [\+] $c.comb.map: { $_ eq '[', ?? 1, -1}; @c[*-1] == 0 && not grep * < 0, @c }; say balanced '[]' | ||
p6eval | nom bd5adb: OUTPUT«False» | ||
masak | and 'not grep' better written 'none' :) | ||
moritz | nom: my $c = '[[][]]'; my @c = [\+] $c.comb.map: { $_ eq '[' ?? 1, -1 }; say @c | 14:33 | |
p6eval | nom bd5adb: OUTPUT«===SORRY!===Found ?? but no !! at line 1, near ", -1 }; sa"» | ||
moritz | nom: my $c = '[[][]]'; my @c = [\+] $c.comb.map: { $_ eq '[' ?? 1 !! -1 }; say @c | ||
p6eval | nom bd5adb: OUTPUT«1 2 1 2 1 0» | ||
masak | yeah, huh, how did the above even compile? | ||
that seems to be yet another bug. | |||
moritz | nom: sub balanced($c) { my @c = [\+] $c.comb.map: { $_ eq '[' ?? 1, -1}; @c[*-1] == 0 && not grep * < 0, @c }; say balanced '[]' | ||
p6eval | nom bd5adb: OUTPUT«===SORRY!===Found ?? but no !! at line 1, near ", -1}; @c["» | ||
moritz | which "above"? | ||
masak | oh ', ??' | ||
moritz | nom: sub balanced($c) { my @c = [\+] $c.comb.map: { $_ eq '[' ?? 1 !! -1}; @c[*-1] == 0 && not grep * < 0, @c }; say balanced '[]' | ||
p6eval | nom bd5adb: OUTPUT«True» | ||
masak | nevermind. | 14:34 | |
nom: sub balanced($c) { my @c = [\+] $c.comb.map: { $_ eq '[' ?? 1 !! -1}; @c[*-1] == 0 && none(@c) < 0 }; say balanced '[]' | |||
p6eval | nom bd5adb: OUTPUT«none(False, False)» | ||
masak | nom: sub balanced($c) { my @c = [\+] $c.comb.map: { $_ eq '[' ?? 1 !! -1}; @c[*-1] == 0 && so none(@c) < 0 }; say balanced '[]' | ||
p6eval | nom bd5adb: OUTPUT«True» | ||
masak | \o/ | ||
moritz | nom: sub balanced($c) { my @c = [\+] $c.comb.map: { $_ eq '[' ?? 1 !! -1}; @c[*-1] == 0 && not grep * < 0, @c }; say $_, balanced $_ for '[[][]]', '][', [' | ||
p6eval | nom bd5adb: OUTPUT«===SORRY!===Confusedat /tmp/L0yD9O0N9k:1» | ||
moritz | nom: sub balanced($c) { my @c = [\+] $c.comb.map: { $_ eq '[' ?? 1 !! -1}; @c[*-1] == 0 && not grep * < 0, @c }; say $_, balanced $_ for '[[][]]', '][', '[' | 14:35 | |
p6eval | nom bd5adb: OUTPUT«[[][]]True][False[False» | ||
14:35
skids joined
|
|||
moritz | masak: you can replace '&& so none' with '?& none' I think | 14:35 | |
nom: sub balanced($c) { my @c = [\+] $c.comb.map: { $_ eq '[' ?? 1 !! -1}; @c[*-1] == 0 ?& none(@c) < 0 }; say balanced '[]' | 14:36 | ||
p6eval | nom bd5adb: OUTPUT«False» | ||
moritz sucks at this | |||
masak | :) | 14:37 | |
moritz | nom: sub balanced($c) { my @c = [\+] $c.comb.map: { $_ eq '[' ?? 1 !! -1}; @c[*-1] == 0 ?& (none(@c) < 0) }; say balanced '[]' | ||
p6eval | nom bd5adb: OUTPUT«True» | ||
moritz | precedence. You must be aware of it. | ||
14:37
xinming joined
|
|||
masak | :) | 14:37 | |
14:37
PacoAir joined
|
|||
moritz | it's a bit sad that @c must be checked for two conditions, so we can't use it anonymously | 14:39 | |
masak | nom: subset NonNegative of Positional where { none(@^l) < 0 }; subset LastZero of Positional where { @^l[*-1] == 0 }; sub balanced { ([\+] $^s.comb.map: { $_ eq '[' ?? 1 !! -1 }) ~~ NonNegative && LastZero }; say balanced '[]' | 14:42 | |
p6eval | nom bd5adb: OUTPUT«Positional()» | ||
masak | augh. | ||
nom: subset NonNegative of Positional where { none(@^l) < 0 }; subset LastZero of Positional where { @^l[*-1] == 0 }; sub balanced { ([\+] $^s.comb.map: { $_ eq '[' ?? 1 !! -1 }) ~~ NonNegative & LastZero }; say balanced '[]' | |||
p6eval | nom bd5adb: OUTPUT«Type check failed in assignment to '$v'; expected 'Mu' but got 'NonNegative' in sub balanced at /tmp/dybF1FYbfQ:1 in block <anon> at /tmp/dybF1FYbfQ:1» | ||
14:43
tarch left
|
|||
masak | o.O | 14:43 | |
there... is no '$v'. | |||
moritz | nom: say 5.rand for 1..10; | 14:48 | |
p6eval | nom bd5adb: OUTPUT«0.5896159486337822.731608651099441.318237302085151.88230775923761.399604688108782.445747182864511.202006063642062.385828551110023.674385935257351.49030266708337» | ||
lumi___ | nom: subset Foo of Int where { * }; say Foo | ||
p6eval | nom bd5adb: OUTPUT«Foo()» | ||
lumi___ | nom: subset Foo of Positional where { * }; say Foo | ||
p6eval | nom bd5adb: OUTPUT«Positional()» | 14:49 | |
lumi___ | That's kind of weird | ||
moritz | nom: role A { }; subset Foo of A where True; say Foo; | ||
p6eval | nom bd5adb: OUTPUT«A()» | ||
moritz | seems subsets of roles aren't OK | ||
14:50
preflex_ joined
|
|||
masak | they don't identify themselves well. | 14:51 | |
moritz | nom: gist.github.com/1836329 | ||
p6eval | nom bd5adb: OUTPUT«[][][][][[]]» | ||
moritz | nom: gist.github.com/1836329 | ||
p6eval | nom bd5adb: OUTPUT«[[[]]][][][]» | ||
14:52
preflex left,
preflex_ is now known as preflex
|
|||
moritz | masak: I guess they aren't uniformly distributed, but IMHO it's a nice solution | 14:52 | |
masak | was just gonna say :) | ||
moritz | nom: say 0.rand | ||
p6eval | nom bd5adb: OUTPUT«0» | ||
masak | nice, but I can almost guarantee that they aren't uniformly distributed. | ||
I've been toying with the idea of a binary decision tree during the day. | 14:53 | ||
that idea might fly if there's a way to generate the weights of the tree without first generating all strings. | |||
and that seems plausible. | |||
moritz | I'd like to see an indication that they aren't uniformely distributed | ||
let's try to do the math for $c == 2, so a total string of length 4 | 14:54 | ||
we have [][] and [[]] as possible solutions | 14:55 | ||
so once we've generated the '[', the probabilities for '[' and ']' should be equal | |||
masak | running a simulation for $c == 4. | ||
moritz | and... they are not | ||
they are 1/3 vs. 2/3 in my code | |||
masak | "[][][][]" is about 8 times as common as "[[[[]]]]". | 14:56 | |
I like this problem, it's elusive ;) | |||
moritz | should ']' and '[' be equally probable as long as both are allowed? | 14:57 | |
masak | no. | ||
the first char is always '['. | |||
the second, in the case of '[][][]'-length strings, is '[' with prob 2/5 and ']" with prob 3/5. | 14:58 | ||
s/"/'/ | |||
moritz | that's what my code does, curiously | ||
masak | oops, sorry. i got the probabiliries reversed just there. | 14:59 | |
'[' is 3/5, ']' is 2/5. | |||
moritz | indeed. | 15:00 | |
masak | nom: gist.github.com/1836395 | ||
p6eval | nom bd5adb: OUTPUT«[][][][[][]]» | ||
moritz | there are 5 distinct ways to write them with $c == 3, right? | ||
masak | factored out some repetition :) | ||
moritz: right. | |||
because oeis.org/A000108 | 15:01 | ||
moritz | masak: ah yes, I've thought of that too (but didn't do it) | ||
masak | not sure it was worth it. | 15:02 | |
15:03
birdwindupbird left
15:10
sisar left
|
|||
moritz | masak: maybe the closed form for the number of total strings can be used to construct the probabilities | 15:17 | |
for each step, that is | |||
masak | the closed form for the total number of strings will be equal to the denominator in the first choice, yes. | 15:18 | |
it doesn't immediately indicate what the numerators are, or how to make subsequent choices. | 15:19 | ||
moritz | well, I thought that maybe one can find paths in pascal's triangle that represent the numerators of the probabilities, or something | 15:20 | |
masak | ooh | 15:21 | |
moritz | but it's really just a rather handwavy idea | 15:23 | |
15:23
tokuhirom joined
|
|||
masak | it gave me a lot of new ideas :) | 15:24 | |
ok, I'm now convinced that the probabilities can be calculated *a priori*. | 15:28 | ||
15:28
kmwallio joined
15:29
Bucciarati left
|
|||
moritz | what do you mean by "a priori"? | 15:29 | |
masak | "without precalculating all the strings of that length" | 15:30 | |
moritz | ok | 15:31 | |
masak | the probabilities can be derived from the geometry of a Pascal-like triangle. | ||
moritz | I think so, but I'm not sure how the exact rules for deriving those numbers are | ||
but there are interesting recursion properties in there | 15:32 | ||
for example if you construct a string of length 6, the probabilities after '[[]' and after '[][' are the same as for constructing a string of length 4 after '[' has been given | |||
masak | I've basically worked it out now. | ||
just need to write something up. | 15:33 | ||
15:33
snearch left
|
|||
moritz | maybe it even makes sense to build them up from the end | 15:34 | |
masak | by symmetry it makes no difference... :) | 15:35 | |
the algorithm I have in sight can do it from either end. | |||
moritz | the probability table, not the strings :-) | ||
masak | oh, I've left the idea of building a probability table. | 15:36 | |
I just calculate the probabilities on demand. | |||
moritz | I'm still in the process of trying to understand the probabilities | ||
so I want to build a table to understand how they are calculated | |||
and once I understood them, I can find closed forms to calculate them as I go along | 15:37 | ||
but you're two steps ahead of me here :-) | |||
masak | here's how I started down the current path: I imagined a "[" as a leftwards diagonal arrow, and a "]" as a rightwards diagonal arrow. | ||
so each string forms a path. | |||
it's significant that the paths diverge and converge. | 15:38 | ||
and all of them form a triangular kind of graph. | |||
15:38
tarch joined
|
|||
moritz | aye | 15:39 | |
I was thinking of a function a(n, i), where n is the number characters to go, and i the number of already used '[' minus the number of already used ']' | 15:42 | ||
so a(n, 0) = c(2n), where c are the catalan numbers | |||
15:43
sisar joined
|
|||
moritz | and a(n, i) tells me how many options I have left at that point | 15:43 | |
15:44
tokuhir__ joined
|
|||
moritz | and I know that a(n, n/2) == 1 | 15:44 | |
15:44
Psyche^ joined,
thou joined
|
|||
moritz | and a(n-1, 1) is also c(2n) | 15:45 | |
15:45
tokuhir__ left,
tokuhir__ joined
|
|||
moritz | but that alone isn't enough | 15:46 | |
moritz waits for more enlightenment from masak++ | |||
masak | enlightenment coming up. | ||
15:46
tokuhirom left
|
|||
moritz | ah, and of course a(n, k) = a(n-1, k) + a(n-1, k+1) | 15:47 | |
15:47
Patterner left,
Psyche^ is now known as Patterner
|
|||
moritz | erm no | 15:47 | |
a(n, k) = a(n-1, k-1) = a(n-1, k+1) | 15:48 | ||
which shows the bit-like-Pascal-triangle-but-not-quite relation | |||
sisar | since nqp is a subset of perl6, is it 'feature'-frozen? i mean, if you continue to add more and more specs of p6, what prevents it from becoming a full-fleged compiler itself? | ||
its possible i'm might have a completly wrong picture here, so please correct me | |||
15:48
tokuhirom joined
|
|||
moritz | sisar: nqp is a tool. It's not feature frozen, but we only enhance it if we see it as the path of least resistance to get something done | 15:50 | |
sisar: also nqp should stay fast, so it won't implement stuff that is hard to do on top of parrot (or whatever platforms it will run on in the future) | |||
15:52
tokuhir__ left
|
|||
sisar | so speed and 'path of least resistance' mark the line between what goes into nqp ? no other considerations ? | 15:53 | |
15:54
wtw left
|
|||
sisar | ah, if something is required for bootstrapping, then it might also be needed in nqp | 15:54 | |
mean implemented in nqp | |||
masak | nom: my $L = 4; sub p($x, $y) { $y && $x + $y < $L ?? p($x + 1, $y) + p($x, $y - 1) !! 1 }; my ($x, $y) = 0, $L; while $x < $L { if $L - ($x + $y) == 0 { print "["; $y-- } elsif $y == 0 { print "]"; $x++ } else { my ($d, $r) = p($y - 1, $x), p($y - 1, $x + 1); if ($d + $r).rand < $d { print "["; $y-- } else { print "]"; $x++ } } } | ||
p6eval | nom bd5adb: OUTPUT«[][[][]]» | ||
masak | presto. | ||
uniform distribution in a box. | 15:55 | ||
ladies and gentlemen, we have arrived. | |||
moritz | sisar: one could argue that "required for bootstrapping" is part of "least resistance" | ||
JimmyZ | nom: my Int %hash{int}; %hash{1} = 2; | 15:56 | |
p6eval | nom bd5adb: OUTPUT«===SORRY!===Shaped variable declarations are not yet implemented at line 1, near "; %hash{1}"» | ||
TimToady | re balanced brackets: irclog.perlgeek.de/search.pl?channe...q=Quincunx | ||
sisar | moritz: i agree | ||
masak | TimToady: oh, right. I had forgotten you had mentioned that. | 15:57 | |
moritz | masak: your p() is a bit like my a(), and has the same recurrence | ||
masak | TimToady: to what extent is my solution above similar to the one you arrived on, with the table? | ||
15:58
lateau_ joined
|
|||
masak | moritz: 'p' is for 'number of choice points' (from here on and downstream) | 15:58 | |
moritz | masak: and note that p() recurses, so that can be equivalently written as a table | ||
masak | I have a feeling it has a closed form too. | ||
moritz | (so that it doesn't have to be recomupted) | ||
wait, it's not the same recurrence | 16:04 | ||
16:06
JimmyZ left
16:08
tokuhirom left
|
|||
moritz | masak: so, $y is the number of [' to be still printed, and $x is the number of ]'s already printed? | 16:09 | |
then it does map to my recurrence, with n == $x + $y and k = $L + $x - $y, I think | 16:10 | ||
moritz too confused | |||
masak | nod. | ||
it's possible that there's a much better coordinate system for that algorithm. | 16:11 | ||
moritz | I like mine because it doesn't have to carry $L around | ||
masak | well, you need $L in some form. | ||
to get uniformity. | |||
TimToady | in diamond quincunx terms, you can turn it 45° and run the x and y as choice of left or right, and the limit is the size of the square | 16:12 | |
moritz | masak: yes, in my case n starts out as $L | ||
erm no, that's not right | |||
2 * $L | 16:13 | ||
but then the mapping isn't right | |||
GRRRRR | |||
moritz too distracted | |||
masak | :) | ||
I feel we have gotten somewhere today, though. | |||
moritz | well, you have, mostly :-) | ||
masak | I can't find a closed form for &p, but if I do, I'll consider this problem solved. | ||
TimToady | you can start both x and y at the length of a side of the square, and just decrement randomly till both are 0 | ||
masak | TimToady: making sure never to cross the diagonal. | 16:14 | |
16:14
tarch left,
tarch joined
|
|||
TimToady | right | 16:14 | |
masak | and "randomly" still needs to be weighted in a certain way to make the results come out uniform. | ||
and that's what I do above. | 16:15 | ||
TimToady | yes, Aron figured that out last year, and wrote it down, but I don't think it got online | ||
masak | yes, it did. | ||
TimToady | okay | ||
masak | irclog.perlgeek.de/perl6/2011-07-31#i_4196730 | ||
TimToady | I believe he figured it out from the back end | 16:16 | |
masak | irclog.perlgeek.de/perl6/2011-07-31#i_4198360 | ||
my insight today was that the probability of a given choice is proportional to the number of possible paths downstream of the current choice point. | 16:17 | ||
er, downstream of following that choice. | 16:18 | ||
yes, Aron's solution looks like it has the same thinking behind it. | 16:19 | ||
TimToady | that was how Aron thought of it :) | ||
16:23
tarch_ joined,
tarch left
|
|||
masak | now I'm a bit annoyed that my calculate-the-probabilities solution reduces to Aron's DP solution :P | 16:29 | |
TimToady | now you know how I feel every time I invent something independently and then someone claims it was derived from such and such in the literature that I never read :) | 16:31 | |
masak | curse you, connectedness of everything! :P | ||
skids | damn math. why does it have to be so universal? | 16:33 | |
TimToady | masak: careful, the connectedness of everything might be listening... | ||
masak sucks up a bit to the connectedness of everything, just in case | 16:35 | ||
maybe someone in here can help me find the closed formula? | 16:36 | ||
[Coke] listens to TimToady give a talk about how he drinks Pepsi. The horror. | |||
geekosaur | the connectedness of everything may be listening, but if it were competent the world wouldnt be such a mess :p | 16:37 | |
TimToady | non-messes are boring | 16:38 | |
masak | it has two parameters, so it's a sequence of sequences. the first sequence is 1, 1, 1, 1, 1, 1..., the second is 1, 2, 3, 4, 5..., the third is 1, 4, 8, 13..., and each new sequence starts with 1, and then each term is the sum of the previous one (in the current sequence) and the next one (in the previous sequence). | 16:39 | |
oeis.org says that the formula for the third one is C($n + 1, 2) + $n - 1, but it has no clue about that fourth one. | 16:41 | ||
16:42
isBEKaml joined
|
|||
masak | isBEKaml! \o/ | 16:42 | |
isBEKaml | \masak/ | 16:43 | |
skids | nom: class A { multi method postcircumfix:<( )> (::T $s: $c) { T.say; $c.WHAT.say; }}; my $a = A.(4); # specs on this are strange, why the unflattening capture OOC? | 16:44 | |
p6eval | nom bd5adb: OUTPUT«A()Capture()» | ||
isBEKaml | masak: you saw my pugs msg? Do you intend to bring it back alive? | ||
16:45
tarch__ joined
16:46
tarch_ left
|
|||
masak | this one? irclog.perlgeek.de/perl6/2012-02-14#i_5149217 | 16:46 | |
it'd be fun to dig into Pugs, yes. I think it'd be good for everyone if the project were actively developed again. | 16:47 | ||
isBEKaml | masak: yeah. it was quite easy to set it up once I had cabal installed. | ||
skids | pugs served to remind other implementations how far they had to go WRT laziness :-) | 16:48 | |
16:48
dakkar left
|
|||
masak | isBEKaml: cabal was already installed for me on feather. I installed all the dependencies. everything built fine until I suddenly got a compile error in the second-last step. | 16:49 | |
isBEKaml | skids: lazy bum on the beach, working his ass off! (pugs) :D | ||
masak: that was what prompted me to send out that msg. :) | 16:50 | ||
16:51
Trashlord joined,
dakkar joined
|
|||
isBEKaml | masak: I didn't upgrade GHC since 7.4 with all parallel processing bells and whistles don't make much sense on an ancient machine. | 16:51 | |
masak | isBEKaml: right. moritz got it to run on 7.4.1, though. | ||
no idea how he did it, both [Coke] and I get the error. :/ | 16:52 | ||
isBEKaml | masak: oh, peek into his .cabal tree? :) | 16:55 | |
masak | TimToady: should I expect something like '@AoH[*]<key2> = @AoH[*]<key1>;' to work in Perl 6? can it be sugared into '@AoH[*, "key2"] = @AoH[*, "key1"];'? | ||
isBEKaml: it was identical to [Coke], IIUC. | |||
er, to [Coke]'s. | |||
16:56
raoul left
|
|||
masak decommutes | 16:57 | ||
TimToady | masak: I think as currently defined you'd have to write it with hypers: @AoH[*]»<key2> = @AoH[*]»<key1> | ||
17:00
cognominal___ joined
17:01
pernatiy left
17:02
cognominal_ left
17:08
kcw joined
|
|||
TimToady | for the record, OKness is the third or fourth word I've had there...most candidates are too long or too overloaded or too confusing | 17:10 | |
17:14
tarch joined
17:15
tarch__ left
17:16
tarch_ joined
17:17
tarch_ left
17:18
tarch__ joined,
tarch left
17:21
hemi22189 joined
17:22
kaare_ joined
|
|||
TimToady | #phasers in 7? | 17:22 | |
hemi22189 | hi | ||
TimToady | howdy | 17:23 | |
17:23
hemi22189 left
|
|||
isBEKaml | nom: my $x = 42 but False; say "Foo!" unless $x; say "bar" if $x; | 17:27 | |
p6eval | nom bd5adb: OUTPUT«bar» | ||
isBEKaml | ^^ is that right? | ||
geekosaur | I think that's a known issue | 17:28 | |
isBEKaml | jnthn++ said he fixed it in his #phasers report. Got me curious. | 17:29 | |
benabik | Fixed in d4d4a2 | ||
isBEKaml | so nom not built yet. I see. | ||
benabik | p6eval just needs to be updated. | ||
moritz | I could imagine that the rakudo builds start to fail due to memory requirements | ||
no | 17:30 | ||
it says it couldn't find nqp::div_In | 17:31 | ||
which implies that NQP is too old | |||
but I did bump NQP_REVISION, didn't I? | |||
has anybody else trouble building latest nom with --gen-parrot / --gen-nqp? | 17:32 | ||
17:33
localhost joined
|
|||
TimToady | trying, didn't require a reConf with I said make | 17:33 | |
17:34
yeltzooo left
|
|||
moritz | well, the last NQP bump was 2 days ago | 17:35 | |
17:35
yeltzooo joined,
tarch__ left,
tarch joined
17:36
kaleem joined
|
|||
TimToady | colomon: #phasers? | 17:36 | |
trying a hilite... | 17:37 | ||
colomon | ooo, right!@ | ||
! | |||
benabik | NQP_REVISION seems to be correct. | ||
TimToady | tadzik: #phasers? | 17:39 | |
[Coke]: #phasers? | |||
17:48
lateau_ left
17:49
Chillance joined
17:53
dakkar left,
tarch left
18:07
mj41 left
18:10
pernatiy joined
18:16
jaldhar left,
jaldhar joined
18:21
kaleem left
|
|||
TimToady | just did a fairly heavy revision of rosettacode.org/wiki/Knapsack_probl...ded#Perl_6 to make it work under niecza | 18:21 | |
niecza doesn't like: | |||
has ($.foo, $.bar); | 18:22 | ||
it doesn't seem to do $object."$methname"() yet | |||
and it blew up for mysterious reasons on the printf | |||
there's an interesting indentation idiom on the for ... X ... X ... -> $p, $i, $g | 18:23 | ||
18:25
Trashlord left
|
|||
colomon | TimToady: I've seen niecza blow up on printfs as well, that was one of the issues I ran into during the panda port. | 18:26 | |
[Coke] | sorry about phasers. it was lunch time here. | 18:29 | |
18:33
Teratogen left,
sisar left
|
|||
colomon | niecza: class Blah is Array { method Str { ~self[0]; }; }; say Blah.new([10, 12, 14]) | 18:36 | |
p6eval | niecza v14-42-g1d02da9: OUTPUT«Unhandled exception: Excess arguments to List.new, used 1 of 2 positionals at /home/p6eval/niecza/lib/CORE.setting line 0 (List.new @ 1)  at /tmp/BKNyZ3K7fj line 1 (mainline @ 3)  at /home/p6eval/niecza/lib/CORE.setting line 3773 (ANON @ 3)  at /ho… | ||
colomon | niecza: class Blah is Array { method Str { ~self[0]; }; }; say Blah.new(Array{ [10, 12, 14] }) | 18:37 | |
p6eval | niecza v14-42-g1d02da9: OUTPUT«Unhandled exception: Excess arguments to List.new, used 1 of 2 positionals at /home/p6eval/niecza/lib/CORE.setting line 0 (List.new @ 1)  at /tmp/w6Jxmrw2ej line 1 (mainline @ 3)  at /home/p6eval/niecza/lib/CORE.setting line 3773 (ANON @ 3)  at /ho… | ||
colomon | niecza: class Blah is Array { method Str { ~self[0]; }; }; say Blah.new() | ||
p6eval | niecza v14-42-g1d02da9: OUTPUT«» | ||
colomon | niecza: class Blah is Array { method Str { ~self[0]; }; }; my $a = Blah.new(); $a[0] = 10; say ~$a; | 18:41 | |
p6eval | niecza v14-42-g1d02da9: OUTPUT«10» | ||
colomon | niecza: class Blah is Array { method Str { ~self[0]; }; }; my $a = Blah.new(); $a[0] = 10; $a[1] = 11; say ~$a; | 18:42 | |
p6eval | niecza v14-42-g1d02da9: OUTPUT«10» | ||
colomon | niecza: class Blah is Array { method Str { ~self[0]; }; }; my $a = Blah.new(); $a[] = 1..10; say ~$a; | ||
p6eval | niecza v14-42-g1d02da9: OUTPUT«Unhandled exception: No value for parameter 'index' in 'postcircumfix:<[ ]>' at /home/p6eval/niecza/lib/CORE.setting line 0 (postcircumfix:<[ ]> @ 1)  at /tmp/xVFbuk8Nwy line 1 (mainline @ 4)  at /home/p6eval/niecza/lib/CORE.setting line 3773 (ANON @… | ||
colomon | niecza: class Blah is Array { method Str { ~self[0]; }; }; my $a = Blah.new(); $a[0..9] = 1..10; say ~$a; | ||
p6eval | niecza v14-42-g1d02da9: OUTPUT«1» | ||
18:43
localhost left
|
|||
moritz | nom: .say if 0 but True | 18:45 | |
p6eval | nom e23812: OUTPUT«Any()» | ||
moritz | nom: my %foo{Int} = 3; say %foo.keys[0].WHAT | ||
p6eval | nom e23812: OUTPUT«Odd number of elements found where hash expected in method STORE at src/gen/CORE.setting:5529 in block <anon> at /tmp/1rIUWs9ZAq:1» | ||
moritz | nom: my %foo{Int}; %foo{2} = 3; say %foo.keys[0].WHAT | 18:46 | |
p6eval | nom e23812: OUTPUT«Int()» | ||
18:46
localhost joined
18:49
Trashlord joined
18:52
tarch joined
18:53
xinming left
|
|||
skids | nom: my grammar G { token foo { <?{ fail("other") }> }}; my $s = "a" ~~ m/<?{fail "local"}>/; $s.perl.say; $s = "a" ~~ m/<G::foo>/; $s.perl.say; | 18:57 | |
p6eval | nom e23812: OUTPUT«Bool::FalseCan not get non-existent attribute '$!pos' on class 'Cursor' in regex <anon> at /tmp/iqQkhFtT8E:1 in method ll-match at src/gen/CORE.setting:3522 in method match at src/gen/CORE.setting:3570 in block <anon> at /tmp/iqQkhFtT8E:1» | ||
18:59
GlitchMr joined
|
|||
moritz | that error message sucks | 18:59 | |
but I think it's wrong to use fail there | |||
skids | Works for the local case, just unusual it doesn't work for the imported grammar. According to TimToady++ , the actual interwork of fail and backtracking is still TBD. | 19:01 | |
19:04
daxim left
|
|||
skids | my grammar G { token foo { <?{ fail("other") }> }}; my $s = G.parse("a", :rule<foo>); $s.perl.say; #also works fine with .parse | 19:05 | |
19:06
birdwindupbird joined
19:07
retup-work left
19:09
raoul joined,
retup-work joined
|
|||
dalek | kudo/nom: f9fcb24 | moritz++ | src/core/Hash.pm: hide Hash.STORE from backtraces |
19:14 | |
19:26
rindolf joined
|
|||
TimToady | in looking at some of the style changes I tend to apply to other folk's RC entries, I see something that puzzles me | 19:27 | |
it's when people value DRY above clarity | |||
it most often shows up when people do everything in their power to avoid using the same declarator on multiple lines, preferring instead to declare a list of things, and then assign a list of initializers to that | 19:28 | ||
this is often quite unclear | |||
whereas the vertical lining up of similar constructs, while a technical violation of DRY, should be encouraged when clarity is enhanced | 19:29 | ||
Perl 6 gives more ways to factor things out, and hence more ways to avoid visual parallelism | 19:30 | ||
colomon | examples? I"m having a hard time visualizing either approach.... | ||
TimToady | but avoiding visual parallelism is often the path to more gobbledygooky code | ||
colomon | (please) | 19:31 | |
TimToady | well, first understand I'm not just picking on one person here, but here's the latest example | 19:32 | |
compare rosettacode.org/mw/index.php?title=...299#Perl_6 | |||
flussence | perl6: say [] + [], [] + {}, {} + [] | 19:33 | |
p6eval | rakudo f9fcb2, niecza v14-42-g1d02da9: OUTPUT«000» | ||
..pugs b927740: OUTPUT«00» | |||
TimToady | to rosettacode.org/mw/index.php?title=...333#Perl_6 | ||
flussence | 00? | ||
pugs: say [] + [] | |||
p6eval | pugs b927740: OUTPUT«0» | ||
TimToady | the diff is at rosettacode.org/mw/index.php?title=...did=132299 | ||
flussence | pugs: say ([] + {}).WHAT, ({} + []).WHAT | 19:34 | |
p6eval | pugs b927740: OUTPUT«NumNum» | ||
flussence | perl6: say ([] + []), ([] + {}), ({} + []) # oh, probably a precedence thing... | ||
p6eval | pugs b927740, rakudo f9fcb2, niecza v14-42-g1d02da9: OUTPUT«000» | ||
colomon | TimToady: you're talking about initializing $panacea, etc and $max_val etc? | 19:36 | |
TimToady | things like: my ($max_val, @solutions, %max_items) = 0; | 19:37 | |
colomon | you'd prefer it with three mys, yes? | ||
19:37
snearch joined
|
|||
TimToady | yes, that's what is in the other solution | 19:38 | |
there's another use of indirect method calls to avoid write two parallel "next ifs", which is a similar DRY over clarity, in my opinion | |||
*writing | |||
colomon | I'm with you 100% on my ($max_val, @solutions, %max_items) = 0; | 19:39 | |
mikemol | !define DRY | ||
TimToady | Don't Repeat Yourself | ||
colomon | I'm a big fan of DRY, but I don't consider saying "my" three times instead of one to count. :) | 19:40 | |
flussence | non-sequitur code between an infix and its args (though this is just my opinion :) = bad stuff | ||
TimToady | I'm mostly just trying to understand how people think, when they don't think like I do. :) | ||
mikemol | FWOW, I don't like the my "($max_val, @solutions, %max_items) = 0;" line, because it's a lot for a newcomer to chew over in a single line. | 19:41 | |
TimToady | I know Perl, and I had to read it three times. | ||
it's not just newcomers :) | 19:42 | ||
mikemol | What does it mean to assign 0 to an array and to a dict? Individually, they'd be quick to understand, but having them that close in context makes it trickier for me to grok them that way. | ||
TimToady | after it uses up the 0, all that is left to assign to the others is () | ||
19:43
Trashlord left
|
|||
mikemol | Ok, now *that* completely flew past me on reading. | 19:43 | |
I read it more like the 0 being applied to each of the vars declared in the (...) | |||
TimToady | but I'd like to know why some people prefer to write it that way | 19:44 | |
mikemol | Ok, so (...) is a bad way to describe it, as that probably has its own semantic meaning... | ||
TimToady | mikemol: that's how I read it the first time, and realized it couldn't be true :) | ||
it parses the (...) as a signature, but if it looks like a Perl 5 list assignment, it trying to keep those semantics, making the array and hash implicitly slurpy | 19:46 | ||
*tries | |||
but this is not terribly obvious to people not coming from Perl 5 | |||
colomon | "indirect method calls to avoid write two parallel "next ifs"" -- finally looked at this code, it's nearly completely insane IMO. But hey, TMTOWTDI... | 19:47 | |
TimToady | I think it's just treating DRY as a supreme principle, but that's just a guess | ||
mikemol | Honestly, it looks like something I might write, if I understood Perl 6 well enough. Thing is, I'd do it that way because I *deplore* tedium in code, which leats to a lot of utility methods so I can reach DRY. | 19:48 | |
TimToady | good rhetoricians know that repeating yourself is essential to effective communication | ||
at some point, adding indirection is more obfuscatory than not | 19:49 | ||
mikemol | Looking at the code, it wouldn't be so obfuscatory if $c were a more descriptive variable name. Even giving it the name $method would help be expository. | 19:50 | |
skids | Well, to play devil's advocate, it is more extendible. One could just add an element to add another criteria. | 19:51 | |
mikemol | Which reminds me... | ||
TimToady | sure, and if I had five of them stacked up, I might start to consider such a solution | ||
colomon is sure he has done many worse things in his own p6 code.... | |||
mikemol | The go-to task for demonstrating too many ways to do something: rosettacode.org/wiki/FizzBuzz#Perl_6 | 19:52 | |
TimToady | heh | ||
mikemol | Well, the P6 example not so much. Others, somewhat. | ||
Also, that page is hell on my server. I need to get caching implemented around the syntax highlighter. | |||
jnthn | evening, #perl6 | 20:03 | |
colomon | o/ | ||
[Coke] | blah! | 20:07 | |
20:07
ksi joined
|
|||
moritz | just a quick reminder, the day after tomorrow is the deadline for the prisoner's dilemma mini challenge | 20:09 | |
[Coke] | blah blah! | ||
moritz | blah blah blah? | 20:13 | |
jnthn | Blah! Blaaah blah blah! | 20:15 | |
.oO( conversation here is pretty straightforward here some days... 0 |
|||
...er. :) | |||
jnthn gets a build of Rakudo and NQP and ponders a little hacking | 20:16 | ||
20:28
skids left
20:30
GlitchMr left
20:33
localhost left
20:34
localhost joined
20:35
tarch_ joined
20:36
tarch left
20:46
tarch_ is now known as tarch
20:50
birdwindupbird left
20:58
cooper left,
cooper joined
|
|||
dalek | p/bs: b0cca57 | jonathan++ | src/guts/multi_dispatch.c: Get multi-dispatcher able to work with the new NQPRoutine (but leave the original DispatcherSub PMC hanlding in for now too). |
21:06 | |
21:08
Chillance left
21:12
Trashlord joined
21:24
awoodland joined
21:25
rindolf left
21:35
freeu4 joined
21:36
ksi left
|
|||
freeu4 | i install rakudo-start , but after tun ./perl6 give error PARROT VM: Could not load bytecode Could not load oplib `nqp_ops' | 21:36 | |
masak | freeu4: did you do 'make install'? | 21:38 | |
freeu4 | masak: yes, | ||
masak | then the binary in ./install/bin/perl6 should work. | ||
freeu4 | i run ./install/bin/perk6 | 21:39 | |
and ./install/bin/nqp | |||
but give error | |||
jnthn | freeu4: What platform? | ||
freeu4 | linux ,kubuntu , | ||
jnthn | Hm. Nothing unusual then. | ||
freeu4 | jnthn: linux,kubuntu | 21:40 | |
after first run perl6 , give error about libparrot.so.3.11.0 ,i add ./install/lib to my lib system | 21:43 | ||
21:45
skids joined
21:48
freeu4 left
21:51
thou left
21:57
kaare_ left
22:00
noam left
22:04
noam joined
|
|||
masak | you shouldn't need to add anything, I think. | 22:07 | |
22:07
havenn joined
|
|||
[Coke] | do you have an older version installed somehwere? | 22:10 | |
(nevermind, 3.11 parrot is the latest one we use.) | |||
Did you remove the build directory? | |||
I remember an old parrot bug where installed parrot depended on parrot source dir. | 22:11 | ||
flussence | rakudo keeps working after a `make clean`, last time I tried it | ||
22:21
icwiener joined
22:22
thou joined
22:31
ab5tract left
22:32
snearch left,
snearch joined
22:46
kmwallio left
22:48
Teratogen joined
22:56
benabik left
23:09
snearch left
|
|||
masak | 'night, #perl6 | 23:19 | |
23:20
MayDaniel left
23:40
PacoAir left
23:41
havenn left
23:42
tarch left
|