»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, std:, or /msg camelia p6: ... | irclog: irc.perl6.org | UTF-8 is our friend! Set by masak on 12 May 2015. |
|||
00:14
Peter_R left
00:32
yqt left,
vendethiel- left
00:33
rangerprice joined
|
|||
rangerprice | Hi everyone | 00:33 | |
00:36
colomon joined
00:39
colomon left,
colomon joined
00:50
n0tjack joined,
BenGoldberg joined
00:54
n0tjack left
01:16
aborazmeh left
01:18
colomon left
01:19
colomon joined
01:22
gfldex left
01:25
abaugher left
01:26
abaugher joined
01:37
aborazmeh joined,
aborazmeh left,
aborazmeh joined
02:06
noganex_ joined
02:09
noganex left
|
|||
colomon | m: say List ~~ Positional | 02:30 | |
camelia | rakudo-moar e6f360: OUTPUT«True» | ||
02:36
laouji joined
|
|||
ShimmerFairy | .tell jnthn I put japhb's code in val(), with minimum modification to make it work properly, and got marginal improvements (null program startup decreased by about .01s, profiling sorting line shows it went down ≈1.2s). It's of course better (so I'll keep it in ☺), but val()'s implementation seems to be a non-issue now | 02:36 | |
yoleaux | ShimmerFairy: I'll pass your message to jnthn. | ||
ShimmerFairy | .tell jnthn I suspect having a version of val() in World.nqp, or perhaps even in NQP itself, for strings with compile_time_values would be the most helpful, considering how many constant strings in quotewords there are in CORE and such :) | 02:39 | |
yoleaux | ShimmerFairy: I'll pass your message to jnthn. | ||
02:46
Sqirrel left
02:54
n0tjack joined
02:58
ggoebel left
02:59
n0tjack left
03:01
skids joined
03:02
ggoebel joined
03:03
ggoebel2 joined
03:05
Sqirrel joined
03:06
ggoebel left
03:10
aborazmeh left
03:11
laouji left
03:12
laouji joined
03:15
ifim left
03:16
laouji left,
laouji_ joined
03:40
n0tjack joined
03:47
lolisa joined
03:52
AlexDaniel left
04:01
orbusbak joined
04:02
gfldex joined,
orbusbak left,
orbusbak joined
04:05
orbus left
04:08
skids left
04:21
laouji_ left
04:26
laouji joined
04:30
MadcapJake joined
04:33
n0tjack left
|
|||
jdv79 has never used :right | 04:36 | ||
04:40
BenGoldberg left
04:41
khw left
|
|||
dalek | ast/allomorphs: 27cc5ac | ShimmerFairy++ | S32-str/numeric.t: Improve testing functions in S32-str/numeric.t The failure check now prints a .perl of the string it was given, so that the output makes sense (changing it from Q[+-3/-2] to Q[+"-3/-2"] , for example). The success check now uses 'is' instead of the weird use of 'ok' shown before, since 'is' works just fine. |
04:46 | |
MadcapJake | in Supply's `done` method, why does it call the result of `$t.done()` github.com/rakudo/rakudo/blob/nom/...ply.pm#L74 | 04:47 | |
dalek | kudo/allomorphs: 7d56f92 | ShimmerFairy++ | src/core/ (2 files): Reinstate the string-to-number code by japhb++ It's a bit faster than my version, and it was the original implementation, so in it goes, in preference of me wasting time trying to optimize my version further (since such optimizations at this point would've been of the trickier, more subtle variety). The biggest functional change to it, aside from making it work in val(), was disallowing 'Infi' and 'NaNi' as valid numbers. Other test failures as a result of this code concern things like if Rat fractions should allow negative denominators, so it's been left untouched for now. Unfortunately, it seems that the particular implementation of val() is not the cause for the perceived slowdown anymore, so this replacement doesn't offer much improvement. The cause is likely the existence of a bunch of val() calls on quotewords in CORE existing now. Handling val() calls at compile time where possible might offer the best improvement at this point. |
04:50 | |
04:58
dustinm` left
05:03
dustinm` joined
05:14
Sqirrel_ joined,
Sqirrel left,
rangerprice left
05:24
laouji left
|
|||
moritz | ShimmerFairy: marking the val(|) proto as 'is pure' might help to promote some calls to compile time | 05:28 | |
ShimmerFairy | moritz: oh, what does 'pure' mean? | 05:29 | |
nvm, found the doc :) | 05:31 | ||
moritz | for the record, it means "can be constant-folded" | 05:40 | |
MadcapJake | anyone able to answer my question above? Just trying to understand why Supply's done method calls the result of `$t.done()`? I thought `done` was jut a supplied callback? | 05:44 | |
is it because `$l` could be a Lock? | 05:46 | ||
no, that couldn't be it because `&.done` is just a callback, it's not something handled internally. | 05:48 | ||
05:53
kaare_ joined
06:01
perl6_newbee joined
|
|||
MadcapJake | It seems like both `done` and `emit` invoke themselves before proceding (emit procedes by invoking again with `msg` and done procedes by invoking if not nil). Is that accurate? I don't quite understand why that's necessary. | 06:06 | |
moritz | I thought 'done' invoked the 'done' callback of the tap(s) | 06:15 | |
06:24
laouji joined
|
|||
MadcapJake | yeah it does, i just am trying to follow the code: `for self.tappers -> $t {my $l = $t.done(); $l() if $l;}` | 06:25 | |
what does the `$l() if $l` mean? I don't follow why that's necessary. | 06:26 | ||
06:29
laouji left
06:31
xfix joined
06:33
laouji joined
06:39
lolisa left
06:40
RabidGravy joined
06:45
CIAvash joined
06:46
rurban joined
|
|||
RabidGravy | marning! | 06:47 | |
ShimmerFairy | moritz: hm, adding a 'proto sub val(|) is pure {*}' seems to have made things worse. I'll try adding 'is pure' to just the single-value multi, though. (It does seem to have done stuff, at least, seeing as the optimize stage goes up about 10s with the addition ☺) | 06:59 | |
07:04
CIAvash left
07:05
CIAvash joined
07:11
TEttinger left
07:12
TEttinger joined
07:13
darutoko joined,
CIAvash_ joined,
CIAvash_ left
07:15
CIAvash left
07:20
ab5tract_ joined
|
|||
ab5tract_ | .tell MadcapJake that's because the return value of $tap.done() is the callback itself | 07:21 | |
yoleaux | ab5tract_: I'll pass your message to MadcapJake. | ||
ab5tract_ | m: class Hap { has &.done }; my $f = Hap.new( done => { say "here we go"; 42 } ); my $b = $f.done(); $b.WHAT.say; $b().say | 07:22 | |
camelia | rakudo-moar e6f360: OUTPUT«(Block)here we go42» | ||
ab5tract_ | .tell MadcapJake try this example: `class Hap { has &.done }; my $f = Hap.new( done => { say "here we go"; 42 } ); my $b = $f.done(); $b.WHAT.say; $b().say` | ||
yoleaux | ab5tract_: I'll pass your message to MadcapJake. | ||
ab5tract_ | .tell MadcapJake contrast that with replacing `my $b = $f.done()` with `my $b = &($f.done)()`. So the reason it is written this way is because the second option would be run time error if the tap did not define a done block | 07:25 | |
yoleaux | ab5tract_: I'll pass your message to MadcapJake. | ||
ab5tract_ | *be a | ||
07:26
rurban left
07:29
n0tjack joined
07:34
n0tjack left
07:38
lizmat left
07:51
vendethiel joined
|
|||
nine | Good morning #perl6! | 07:55 | |
ab5tract_ | morning, nine! | 07:57 | |
nine | I've just slept for 10 1/2 hours...this feels strange ;) | ||
ab5tract_ | :) | 08:00 | |
nine: so does the GMR (Great Map Refactor?) plan to address the points raised by postcircumfix.com/2015-08-29-untang...-hierarchy | 08:05 | ||
dalek | ast/gmr: 434b189 | (Stefan Seifert)++ | S (3 files): Rename EnumMap to Map |
08:06 | |
ast/gmr: a2d3e62 | (Stefan Seifert)++ | S (7 files): Merge Enum into Pair This should reduce the confusion around enum, Enum an Enumeration. Pair now implements shallow immutability like List. Pairs themselves are immutable, but containers used as values can be assigned to. |
|||
nine | ab5tract_: that blog post is exactly what I'm implementing | 08:07 | |
though half of it seems obsolete, as for example Hashes don't do Positional | |||
ab5tract_ | indeed | 08:08 | |
nine | Note that it has not been decided, if we really want those changes. I'm just implementing them to see how much work it would be and what problems may arise. So far I like what I've seen. | 08:09 | |
ab5tract_ | An exploratory branch :) | 08:10 | |
A Map for a potential voyage! (*baddum ching*) | 08:11 | ||
ab5tract_ wanders to breakfast | |||
08:13
SamuraiJack joined
08:14
pmurias joined
|
|||
pmurias | in which branch does the post glr rakudo live? | 08:14 | |
08:15
lizmat joined
|
|||
ShimmerFairy | pmurias: nom | 08:17 | |
lizmat | commuting& | 08:18 | |
08:18
lizmat left
08:19
rurban joined
08:29
cognominal joined
08:31
ab5tract_ left
|
|||
ambs | we can't make perl6 a little more intelligent? "min 1..*" takes forever to compute. | 08:34 | |
RabidGravy | yes | 08:39 | |
m: multi sub min(Range $a) { $a.bounds[0] }; say min(1..*) | |||
camelia | rakudo-moar e6f360: OUTPUT«1» | ||
ambs | not really... then min 10..5 would not work :-) | 08:40 | |
it I understood it correctly | 08:41 | ||
s/it/if/ | |||
RabidGravy | ah yes | ||
ambs | but yeah, not something relevant right now | ||
was just messing around with ranges and lazyness. | |||
ShimmerFairy | Yeah, if rakudo knew how to determine if a range was all-ascending or all-descending, then there are some nice shortcuts that could be implemented :) | 08:42 | |
RabidGravy | m: multi sub min(Range $a) { min($a.bounds) }; say min(1..*); say min(10..5)' | ||
camelia | rakudo-moar e6f360: OUTPUT«5===SORRY!5=== Error while compiling /tmp/qnrLbWOIpJTwo terms in a rowat /tmp/qnrLbWOIpJ:1------> 3bounds) }; say min(1..*); say min(10..5)7⏏5' expecting any of: infix infix stopper postfix s…» | ||
08:43
ab5tract_ joined
|
|||
RabidGravy | m: multi sub min(Range $a) { min($a.bounds) }; say min(1..*); say min(10..5);' | 08:43 | |
camelia | rakudo-moar e6f360: OUTPUT«5===SORRY!5=== Error while compiling /tmp/R2GRDS_HsYUnable to parse expression in single quotes; couldn't find final "'" at /tmp/R2GRDS_HsY:1------> 3unds) }; say min(1..*); say min(10..5);'7⏏5<EOL> expecting any of: sing…» | ||
ambs | RabidGravy: I see what you are trying to do there :-) | ||
RabidGravy | m: multi sub min(Range $a) { min($a.bounds) }; say min(1..*); say min(10..5) | ||
camelia | rakudo-moar e6f360: OUTPUT«Cannot call min(Parcel); none of these signatures match: (Range $a) in sub min at /tmp/xFCWE2y0tQ:1 in block <unit> at /tmp/xFCWE2y0tQ:1» | ||
RabidGravy | or something like that | ||
08:46
[TuxCM] joined
08:49
ab5tract_ left
08:53
camelia left,
camelia joined,
laouji left
|
|||
nine | m: say (1,2).WHAT | 08:53 | |
08:54
ChanServ sets mode: +v camelia
|
|||
camelia | rakudo-moar e6f360: OUTPUT«(Parcel)» | 08:54 | |
vendethiel | camelia is pre-merge, IIRC | 08:55 | |
nine | Yeah, trying to figure out how to fix that | ||
08:56
laouji joined
08:58
laouji left
09:00
[TuxCM] left
|
|||
jdv79 | grondilu: i would help if i understood Digest better. there's a bunch of syntax i'm not familiar with in there. | 09:01 | |
09:01
laouji joined
|
|||
RabidGravy | right, off to the "White Isle" in a bit, see you all in two weeks. Don't break anything I wouldn't and play nicely | 09:02 | |
09:02
TEttinger left
|
|||
nine | Have fun :) | 09:02 | |
09:03
laouji left
|
|||
RabidGravy | always do :) | 09:03 | |
byeee | |||
09:03
RabidGravy left,
laouji joined
09:06
ndo joined
09:09
Ven joined
|
|||
pmurias | the post glr semantics are described in S07-glr-draft.pod? | 09:09 | |
nine | More or less. That document is not up to date. | 09:10 | |
pmurias | S07-lists.pod is pre-glr? | ||
09:11
telex left
|
|||
nine | I don't think anyone has updated the specs yet. | 09:11 | |
pmurias | that sucks badly :( | 09:12 | |
09:12
telex joined
|
|||
nine | m: say (1,2).WHAT | 09:14 | |
camelia | rakudo-moar 13f829: OUTPUT«(List)» | ||
nine | \o/ | ||
vendethiel | \o/ | ||
nine | I disabled build of the jvm backend for now. | ||
09:23
laouji left
09:27
laouji joined
09:36
mprelude joined
09:44
Ven left
|
|||
nine | m: (:a(1) :b(2)).perl.say | 09:44 | |
camelia | rakudo-moar 13f829: OUTPUT«(:a(1), :b(2))» | ||
09:46
rmgk_ joined,
rmgk left,
rmgk_ is now known as rmgk
09:51
perl6_newbee left
09:56
n0tjack joined
|
|||
ShimmerFairy | nine: I was thinking, could you and/or other people familiar with GLR put up a gist or something with bullet points on what's changed with having GLR (or at least the important bits of GLR), so it's easier for someone interested in updating the specs to do so? | 09:58 | |
10:01
n0tjack left
|
|||
ShimmerFairy | (I ask because I'm possibly interested in helping update S07 and related, but I'm not nearly familiar enough with GLR to write specs on it yet. A gist-like thing would just speed up that familiarization for someone like me ☺) | 10:02 | |
10:03
cschwenz joined
10:05
leont joined
|
|||
leont | How can I interpret a string as hex? | 10:05 | |
vendethiel | m: say :16("CAFE"); # what was it? | ||
camelia | rakudo-moar 13f829: OUTPUT«51966» | ||
ShimmerFairy | Yeah, also available as :16<CAFE> or :16[12, 10, 15, 14] :) (though :16() will let you handle variables) | 10:06 | |
vendethiel | m: my @a = 12, 10, 15, 14; say :16[|@a]; | 10:08 | |
camelia | rakudo-moar 13f829: OUTPUT«51966» | ||
vendethiel | *g* | ||
10:21
AlexDaniel joined
|
|||
hahainternet | i'm not exactly likely to be helping out with GLR but i would appreciate the same as ShimmerFairy, a nice summary somewhere when someone has time | 10:21 | |
10:30
SamuraiJack left
|
|||
leont | Interestingly, :16("0o10") == 8 | 10:34 | |
Is that intended or a bug? | 10:35 | ||
10:37
colomon left
|
|||
ShimmerFairy | intended, :16() only sets a default radix, which can be overridden by the string | 10:37 | |
10:40
dayangkun left
10:42
cschwenz1 joined
10:44
cschwenz2 joined
10:45
cschwenz left
10:46
cschwenz1 left
|
|||
cdc | ShimmerFairy: don't you think :16("0o10") should be rejected? For instance, in the follozing scenario: $input = prompt("Enter hex"); $checked-input = :16($intput)" | 10:54 | |
10:55
spider-mario joined
|
|||
ShimmerFairy | cdc: nope, the idea is that the string knows what it wants better than the surrounding conversion function. | 10:55 | |
It's been that way forever, so it's not my design decision in the first place :) . Nevertheless I agree with it. | |||
10:56
kaare_ left
|
|||
ShimmerFairy | If you _really_ wanted to enforce hex, easiest way would be :16("0x" ~ $input) , which will die if the string ends up being "0x0o10" | 10:56 | |
hahainternet | you'd want to do some sanitation on the input regardless | 10:57 | |
because 'z' | |||
i'm half and half | |||
it would be nice to know there were ways to be strict about formatting built in | |||
11:04
colomon joined
|
|||
cdc | well, I understand your point, but :16("0o10") == 8 looks so weird to me. | 11:05 | |
11:07
cschwenz2 left
|
|||
hahainternet | cdc: it does, but if you gave that octal a variable name it would make much more sense | 11:08 | |
11:15
colomon left
11:17
colomon joined
|
|||
MadcapJake | m: class Hap { has &.done }; my $f = Hap.new( done => { say "here we go"; 42 } ); my $b = $f.done(); my $c = $f.done; my $d = &($f.done); say $b === $c && $c === $d; | 11:18 | |
yoleaux | 07:21Z <ab5tract_> MadcapJake: that's because the return value of $tap.done() is the callback itself | ||
07:22Z <ab5tract_> MadcapJake: try this example: `class Hap { has &.done }; my $f = Hap.new( done => { say "here we go"; 42 } ); my $b = $f.done(); $b.WHAT.say; $b().say` | |||
camelia | rakudo-moar 13f829: OUTPUT«True» | ||
yoleaux | 07:25Z <ab5tract_> MadcapJake: contrast that with replacing `my $b = $f.done()` with `my $b = &($f.done)()`. So the reason it is written this way is because the second option would be run time error if the tap did not define a done block | ||
11:19
colomon left
11:21
colomon joined
11:26
ndo left
|
|||
MadcapJake | ab5tract: so in the case of assigning a method to a variable, there's no difference between `$f.done()` and `$f.done`? Both will just assign the variable to the given block. Is that correct? | 11:33 | |
ShimmerFairy | both .done() and .done call a method | 11:37 | |
MadcapJake | but if you do `my $b = $f.done` you don't call it, you just assign the block to $b | ||
ShimmerFairy | m: class C { method M { 42 } }; my $b = C.M; say $b.perl | ||
camelia | rakudo-moar 13f829: OUTPUT«42» | ||
MadcapJake | m: class C { method M { 42 } }; my $b = C.M; say $b.WHAT.say | 11:38 | |
camelia | rakudo-moar 13f829: OUTPUT«(Int)True» | ||
ShimmerFairy | m: class C { method M { -> $a { say $a } } }; my $b = C.M; say $b.perl | ||
camelia | rakudo-moar 13f829: OUTPUT«-> $a { #`(Block|71367056) ... }» | ||
11:39
laouji left,
laouji joined
|
|||
ShimmerFairy | m: class C { has $.done }; my $obj = C.new(done => 42); say $obj.done.perl | 11:39 | |
camelia | rakudo-moar 13f829: OUTPUT«42» | ||
MadcapJake | wait, what about when it's like this | ||
ShimmerFairy | m: class C { has $.done }; my $obj = C.new(done => { 42 }); say $obj.done.perl | ||
camelia | rakudo-moar 13f829: OUTPUT«-> ;; $_? is parcel { #`(Block|55982096) ... }» | ||
MadcapJake | yeah like that :P | ||
timotimo | that's how | ||
ShimmerFairy | when the "done" attribute is assigned a block, then calling the method returns that block :) | 11:40 | |
(the has $.done declaration creates 'method done' for you) | |||
MadcapJake | so it's not really a method, it's just a block? is that what i'm getting confused about? | ||
ohhhhh | |||
timotimo | it's a method tthat returns a block | ||
you'd call it an attribute instead of a method, probably | |||
MadcapJake | so when you instantiate the class, you're passing what the `done` method will return? | 11:41 | |
timotimo | right, though of course the code in the class may re-assign to $!done or implement "method done" itself in a different way if it likes to | ||
ShimmerFairy | yeah, the 'done => { 42 }' part sets the value of the $!done attribute. The main difference between 'has $!done' and 'has $.done' is that you'll get a method done { $!done } made for you | 11:42 | |
11:43
laouji left,
laouji joined
|
|||
MadcapJake | ok! I get it now! :) I was thinking that `has $.done` was just creating an empty "field". But really the `.` twigil means it's actually building an accessor/gette | 11:43 | |
timotimo | that's right | 11:44 | |
MadcapJake | awesome! Thanks so much for the explanation! | ||
timotimo | and if the . twigil gets combined with "is rw", the accessor will also allow assignment | ||
ShimmerFairy | MadcapJake: note that when you _use_ the attribute in your class' methods, $!foo is the actual variable, and $.foo is treated like $(self.foo) | 11:45 | |
MadcapJake | ok cool, i read about `is rw` but it wasn't really making sense until now xD | ||
11:48
laouji left,
laouji joined
|
|||
MadcapJake | ShimmerFairy: but `$!foo` would only be available inside the class body, right? | 11:48 | |
ShimmerFairy | yes | ||
Use $!foo whenever you want to modify or otherwise use the attribute directly. $.foo is nice for letting subclasses define their own 'method foo' and getting that used | 11:49 | ||
timotimo | and $!foo is namespaced to the current class, so if you want to access a superclass' attribute "$!foo", you'll have to go a different way | 11:52 | |
ShimmerFairy | m: class C { has $.bar; method foo { "This is a $.bar" } }; class D is C { method bar { "derived class" } }; say C.new(bar => 42).foo; say D.foo | 11:53 | |
camelia | rakudo-moar 13f829: OUTPUT«This is a 42This is a derived class» | ||
ShimmerFairy | ^ example of what I was talking about with using $.foo | ||
MadcapJake | cool! Thanks ShimmerFairy & timotimo! It all fits now that I understand that darn twigil xD | 12:07 | |
12:14
kaare_ joined
12:16
CQ joined
12:18
leont left
12:20
lizmat joined,
laouji left
|
|||
lizmat waves from 2500m up on the Sierra Nevada | 12:20 | ||
12:23
mprelude left,
n0tjack joined
12:28
n0tjack left
|
|||
FROGGS | .tell japhb I'm unable to merge C++ support in rakudo until it got ported to jvm... and I cannot port it as long as the jvm build is broken | 12:29 | |
yoleaux | FROGGS: I'll pass your message to japhb. | ||
FROGGS | TimToady / jnthn: I intend to bisect the setting this evening (by commenting stuff out), until the jvm build succeeds... if one of you have better ideas, please let me know | 12:30 | |
12:40
Loren joined
|
|||
lizmat | .tell TimToady looks like brokenness of Vampire-number/vampire-number.pl6 is also a @a := Seq issue | 12:41 | |
yoleaux | lizmat: I'll pass your message to TimToady. | ||
12:45
lizmat left
|
|||
[Tux] | o/ | 12:45 | |
12:49
rindolf joined
|
|||
_itz | m: say (1,2).WHAT | 12:49 | |
camelia | rakudo-moar 13f829: OUTPUT«(List)» | ||
_itz | is jvm fixed? | ||
TimToady | nach nicht | 12:50 | |
yoleaux | 12:41Z <lizmat> TimToady: looks like brokenness of Vampire-number/vampire-number.pl6 is also a @a := Seq issue | ||
moritz | but that's a current rakudo | 12:51 | |
on camelia | |||
12:53
xfix left
|
|||
timotimo is still a bit sad about the re-naming of the Cheese Shop to PyPI | 12:54 | ||
ShimmerFairy | moritz: JVM build has been disabled on camelia for the time being | ||
moritz | :sadface: | 12:56 | |
12:58
FROGGS left
13:26
cognominal left
13:30
colomon left
13:31
rurban left
13:32
aborazmeh joined,
aborazmeh left,
aborazmeh joined
13:37
AlexDaniel left
13:39
vendethiel left
13:40
AlexDaniel joined
13:41
laouji joined
13:48
skids joined
13:55
khw joined
13:56
vendethiel joined
13:57
FROGGS[mobile] left,
FROGGS[mobile] joined
14:03
lichtkind joined
|
|||
lichtkind | cheers i saw parcel is gone | 14:03 | |
where can i read mor on that? | 14:04 | ||
14:05
aborazmeh left
|
|||
nine | FROGGS[mobile]: do you have any idea, why after adding a multi method new($key, Mu \value) to Pair.pm I still get a "Default constructor for 'Pair' only takes named arguments" but only for this weird :a(1) b(2) case (without comma) | 14:05 | |
FROGGS[mobile]: I also removed $key.named('key'); and $value.named('value'); from make_pair in Actions.nqp | 14:06 | ||
14:12
Sqirrel_ left
|
|||
nine | lichtkind: it's not yet documented | 14:13 | |
lichtkind | nad whats main idea, that list can contain named vals ? | 14:14 | |
nine | ? | ||
lichtkind | the amin idea between parcels was that they are not decided if they become list or hashes | 14:17 | |
what makes them dispensable | 14:18 | ||
masak | m: sub s($x) { $x ?? $x < 0 ?? -1 !! 1 !! 0 }; say s($_) for -42, 0, 42, NaN | 14:21 | |
camelia | rakudo-moar 13f829: OUTPUT«-1011» | ||
masak | m: sub s($x) { $x / abs $x }; say s($_) for -42, 0, 42, NaN | 14:22 | |
camelia | rakudo-moar 13f829: OUTPUT«-1Attempt to divide by zero using div in block <unit> at /tmp/h1bOsgu6S9:1Actually thrown at: in block <unit> at /tmp/h1bOsgu6S9:1» | ||
masak | (some wrong implementations of the 'sign' function I've found on Github so far) | ||
m: sub s($x is copy) { !($x = +$x) ? $x : $x > 0 ? 1 : -1 }; say s($_) for -42, 0, 42, NaN | 14:23 | ||
camelia | rakudo-moar 13f829: OUTPUT«5===SORRY!5=== Error while compiling /tmp/as7bLcyhYeUnsupported use of ? and : for the ternary conditional operator; in Perl 6 please use ?? and !!at /tmp/as7bLcyhYe:1------> 3sub s($x is copy) { !($x = +$x) ?7⏏5 $x : $x > 0 ? 1 : -1 }; s…» | ||
masak | m: sub s($x is copy) { !($x = +$x) ?? $x !! $x > 0 ?? 1 !! -1 }; say s($_) for -42, 0, 42, NaN | 14:24 | |
camelia | rakudo-moar 13f829: OUTPUT«-101-1» | ||
14:24
cognominal joined
|
|||
nine | lichtkind: you mean Captures | 14:24 | |
lichtkind | im pretty sure i mean parcel but i will recheck | 14:25 | |
masak | m: sub s($x) { if $x > 0 { return 1 }; return -1 }; say s($_) for -42, 0, 42, NaN | ||
camelia | rakudo-moar 13f829: OUTPUT«-1-11-1» | ||
masak | I'm thinking of writing a blog post follow-up about how virtually everybody who tries to implement/polyfill Math.sign is also too inexperienced to get it right. | 14:26 | |
but now that I'm looking around, I'm not sure I'll be able to research it enough without becoming too depressed about what I find. | 14:27 | ||
m: sub s($x) { $x < 0 ?? -1 !! 1 }; return -1 }; say s($_) for -42, 0, 42, NaN | |||
camelia | rakudo-moar 13f829: OUTPUT«5===SORRY!5=== Error while compiling /tmp/QwvRM1MH6WUnexpected closing bracketat /tmp/QwvRM1MH6W:1------> 3 s($x) { $x < 0 ?? -1 !! 1 }; return -1 7⏏5}; say s($_) for -42, 0, 42, NaN» | ||
masak | m: sub s($x) { $x < 0 ?? -1 !! 1 }; say s($_) for -42, 0, 42, NaN | ||
camelia | rakudo-moar 13f829: OUTPUT«-1111» | ||
lichtkind | nine: your right but i thought it was the other way around for long time | 14:28 | |
masak | there's definitely a blog post's worth in there, though. | ||
mst | lichtkind: I always suspected you were a little bit backwards | 14:29 | |
(sorry :) | |||
lichtkind | sometimes i am | ||
_itz | lichtkind++ # good .es art gallery tips :) | ||
lichtkind | thanks | 14:30 | |
yes leaving granada tomorrow | |||
ShimmerFairy | m: sub sign($n) { $n ?? $n / $n.abs !! 0 }; say (-42, 0, 42, NaN)».&sign # masak: this is my version :) | ||
camelia | rakudo-moar 13f829: OUTPUT«(-1 0 1 NaN)» | ||
14:31
Begi joined
|
|||
Begi | Hey #perl6 ! I'm new to Perl6. I've code a little Reverse Polish notation calculator. Can you tell me what can I improve ? gist.github.com/Emeric54/b94d607aca841df8f2d8 | 14:33 | |
Juerd | Begi: That's nice! | 14:34 | |
In general, in any programming language, I think things become harder to read if you have many nested constructs and high indentation levels. It's a good reason to refactor things into subroutines. | 14:35 | ||
That'll force you to think about how to share values. Explicit passing and returning is widely considered as the best solution, followed by hiding state in objects. | 14:36 | ||
But for code this small it might be overkill :) | |||
I'm not sure if "defined +$w" makes sense | 14:37 | ||
vendethiel | Juerd: that's to make sure .Int returned an Int :) | ||
(at least that's what I'm guessing) | |||
Juerd | vendethiel: I don't understand. There's no .Int in the code. | ||
vendethiel | Juerd: there's a + | 14:38 | |
m: say +"foo" | |||
camelia | rakudo-moar 13f829: OUTPUT«Cannot convert string to number: base-10 number must begin with valid digits or '.' in '⏏foo' (indicated by ⏏) in block <unit> at /tmp/7VAhJ9Nxx4:1Actually thrown at: in block <unit> at /tmp/7VAhJ9Nxx4:1» | ||
vendethiel | m: say defined +"foo" | ||
camelia | rakudo-moar 13f829: OUTPUT«False» | ||
vendethiel | the defined "traps" the failure :) | ||
Begi | Yes, I started with a subroutine, but I deleted it because the code was very small. | ||
Juerd | Oh wow, so +"foo" evaluates to an unthrown exception? | 14:40 | |
Which is then thrown if you use it where you can't?! | |||
vendethiel | Juerd: +"foo" evaluates to a Failure | ||
Juerd | I think I read about this, but this is the first time I understand it... | ||
(I think) | 14:41 | ||
vendethiel | m: say (+"foo").WHAT.perl | ||
camelia | rakudo-moar 13f829: OUTPUT«Failure» | ||
vendethiel | m: say (+"foo").Bool | ||
camelia | rakudo-moar 13f829: OUTPUT«False» | ||
Juerd | m: sub bar ($f :D) { }; bar(+"foo") | ||
camelia | rakudo-moar 13f829: OUTPUT«===SORRY!===Cannot invoke this object (REPR: P6opaque, cs = 0)» | ||
Juerd | Slightly LTA. | 14:42 | |
Which object?! | |||
vendethiel | whoops. :-) | ||
m: sub bar($f :D) {}; bar(1); | |||
camelia | rakudo-moar 13f829: OUTPUT«===SORRY!===Cannot invoke this object (REPR: P6opaque, cs = 0)» | ||
vendethiel | m: sub bar($f:D) {}; bar(1); | ||
camelia | rakudo-moar 13f829: OUTPUT«===SORRY!===Cannot invoke this object (REPR: P6opaque, cs = 0)» | ||
vendethiel | Juerd: you can't :D something that's not a type btw | 14:43 | |
m: sub bar($f:D) {}; | |||
camelia | rakudo-moar 13f829: OUTPUT«===SORRY!===Cannot invoke this object (REPR: P6opaque, cs = 0)» | ||
vendethiel | Juerd: Any:D would work, fwiw | ||
masak | I just realized that NaN boolifies to True in Perl 6. have we ever thought about whether it should...? | 14:44 | |
(data point so far: it boolifies to false in JavaScript) | |||
vendethiel has no idea, since he never writes code that takes NaN into account | 14:45 | ||
14:46
raiph left
|
|||
nine | GLRR semantics in a gist: gist.github.com/niner/d5f825c07ce1f7a6f7bb | 14:46 | |
masak | in a way, NaN (being a kind of numeric failure) feels falsy. | 14:47 | |
14:47
Begi left
|
|||
nine | At least what came to mind right now | 14:47 | |
14:47
skids left
14:48
laouji left
|
|||
ShimmerFairy | masak: I think the issue is that "not a number" is far too general for an easy answer | 14:48 | |
nine | ShimmerFairy: gist.github.com/niner/d5f825c07ce1f7a6f7bb | 14:49 | |
ShimmerFairy | thanks :) | ||
nine | I'll be happy to add clarifications and answer questions that this will raise. | ||
ShimmerFairy | Ah, so the $ protection was added then? Seems like the sanest option, considering how many problems not having something like it was causing :) | 14:50 | |
nine | Added jnthn++'s clarifications about slurpies | 14:52 | |
masak | ShimmerFairy: well, many languages do answer it by allowing NaN to be coerced, implicitly or explicitly, to a boolean value. | ||
ShimmerFairy: I agree it's not an easy question. but there's certainly prior art. | |||
ShimmerFairy | masak: what I mean is the question of "is NaN truthy or falsy?" | ||
masak | and I'm wondering if there's any language out there besides Perl 6 that boolifies NaN to True. | ||
ShimmerFairy | nine: shouldn't 'is rw' be the one that leads to Array, if Lists are immutable? | 14:53 | |
14:53
raiph joined
|
|||
masak | hm, Perl 5 does too, it seems. | 14:53 | |
$ perl -Mstrict -wE 'say !! +"NaN"' | |||
1 | |||
Loren | m: say (+"fgg").perl | 14:54 | |
camelia | rakudo-moar 13f829: OUTPUT«Failure.new(exception => X::Str::Numeric.new(source => "fgg", pos => 0, reason => "base-10 number must begin with valid digits or '.'"), backtrace => Backtrace.new)» | ||
ShimmerFairy | masak: from a purely bit-pattern perspective, NaN does have some on bits :P | ||
14:55
dakkar joined
|
|||
dakkar | why does IO::Path cache the "exists" bit? | 14:56 | |
my $f = '/tmp/thing'.IO; $f.spurt('something'); say $f.e; # prints False | 14:57 | ||
nine | ShimmerFairy: well the "is rw" allows you to assign to @foo. It doesn't say anything about @foo itself. But other than having slowly come to terms with this, I share your confusion. | ||
14:57
bbkr joined
|
|||
ShimmerFairy | nine: Another possibility is perhaps "use Array for *@, since we've flattened already and might as well enforce scalar containers, and use List for **@ , since we're keeping structure and shouldn't enforce containerization on any part of it" | 14:59 | |
nine | Well there's still lizmat++'s proposal to have **@arr expose the single arg semantics we use for all builtins. | ||
bbkr | Hi. I've published new blog post of how to deal with asynchronous parallel nested documents processing (and don't get crazy). Enjoy: blogs.perl.org/users/pawel_bbkr_pab...bread.html ! | 15:00 | |
ShimmerFairy | nine: how would you enforce single-arg rule like the "for" keyword, currently? | ||
nine | ShimmerFairy: oh it's easy. It just involves some nqp... | 15:02 | |
ShimmerFairy | nine: is that because of GLRR? I recall that being default earlier | 15:03 | |
(that is, I remember that you couldn't get rid of single-arg earlier on) | |||
15:06
lichtkind left
|
|||
nine | The canonical way seems to be having a multi candidate that takes a \value and one for **@values. Then first one does an istype(Iterable) && !iscont check on value | 15:07 | |
ShimmerFairy | It'd be nice if that were easier to do :) .oO(***@i-want-single-arg :P) | 15:10 | |
15:14
bbkr left
15:15
n0tjack joined
|
|||
grondilu | m: constant foo = grep * % 2, 1 .. *; say foo[1]; say foo[1]; | 15:17 | |
camelia | rakudo-moar 13f829: OUTPUT«33» | ||
grondilu | m: constant primes = grep *.is-prime, 2 .. *; say (map 2 * *, primes)[^3]; say (map 3 * *, primes)[^3]; | 15:18 | |
camelia | rakudo-moar 13f829: OUTPUT«(4 6 10)This Seq has already been iterated, and its values consumed in block <unit> at /tmp/mNp30ZydZT:1» | ||
grondilu | m: constant @primes = grep *.is-prime, 2 .. *; say (map 2 * *, @primes)[^3]; say (map 3 * *, @primes)[^3]; | ||
camelia | rakudo-moar 13f829: OUTPUT«(4 6 10)This Seq has already been iterated, and its values consumed in block <unit> at /tmp/kUDir4ylC_:1» | ||
grondilu | m: my @primes = grep *.is-prime, 2 .. *; say (map 2 * *, @primes)[^3]; say (map 3 * *, @primes)[^3]; | ||
camelia | rakudo-moar 13f829: OUTPUT«(4 6 10)(6 9 15)» | ||
15:19
perl6_newbee joined,
n0tjack left
15:21
dakkar left
|
|||
FROGGS[mobile] | nine: perhaps look of the ast what :a(1) :b(2) produces, to be able to reproduce it with other Perl 6 code | 15:24 | |
nine: if nothing helps I can look into it in about three hours | 15:25 | ||
cdc | bbkr: I think you wouldn't exhaust the thread pool if you move the start block after the recursive call, ie. "start { sleep 1 # here the chapter itself is processed }" | 15:26 | |
FROGGS[mobile] | nine: though I plan to spend the night fighting the JVM breakage | 15:27 | |
cdc | .tell bbkr: irclog.perlgeek.de/perl6/2015-09-06#i_11176345 | 15:28 | |
yoleaux | cdc: What kind of a name is "bbkr:"?! | ||
cdc | .tell bbkr irclog.perlgeek.de/perl6/2015-09-06#i_11176345 | ||
yoleaux | cdc: I'll pass your message to bbkr. | ||
15:35
bbkr joined
15:40
lolisa joined
|
|||
bbkr | cdc: yes, but this is suboptimal solution. It was my first attempt to fix: gist.github.com/bbkr/b27aca2d1a265...e-txt-L127 | 15:44 | |
yoleaux | 15:28Z <cdc> bbkr: irclog.perlgeek.de/perl6/2015-09-06#i_11176345 | ||
[Tux] | GLR: | ||
test 50000 54.743 54.658 | |||
test-t 50000 54.748 54.664 | |||
timotimo | that's more than it used to be, huh? :( | ||
bbkr | I've even explained why it won't give full speedup, but whole post became too big so I got this solution removed. | 15:45 | |
[Tux] | yes, but I have been able to test GLR just *once* before | ||
[Tux] is building nom just now to compare | |||
timotimo | OK | ||
masak | ShimmerFairy: the correct answer, if such a thing existed, would of course be "Not a Boolean" :P | 15:47 | |
timotimo | NaB, eh? | 15:48 | |
15:49
spider-mario left
|
|||
timotimo | hm | 15:50 | |
[Tux] | have glr and nom been merged? I now get the same errors in nom as I get in glr | ||
timotimo | the problem i may be seeing is an eliminated-by-optimizer block has survived and that causes some trouble | ||
or something | |||
glr is now in nom, yes | |||
cdc | bbkr: oh, I see. | 15:52 | |
masak | found a regression. | 15:55 | |
m: sub foo { sub bar($) { "OH HAI" }; bar 5 }; say foo | |||
camelia | rakudo-moar 13f829: OUTPUT«OH HAI» | ||
masak | m: sub foo { bar 5; sub bar($) { "OH HAI" } }; say foo | ||
camelia | rakudo-moar 13f829: OUTPUT«sub bar ($) { #`(Sub|71849184) ... }» | ||
masak submits rakudobug | |||
I think this is unusual enough that it hasn't been discovered yet in the spectests or ecosystem. | 15:57 | ||
but we should probably have a spectest for it :) | |||
anyway, behold! gist.github.com/masak/b9371625ad85cfe0faba -- fizzbuzz without conditionals in Perl 6 :) | 15:59 | ||
(forked from a Clojure version) | |||
garu | masak++ | 16:04 | |
timotimo | masak: so ... what is the bug? | 16:05 | |
vendethiel | masak: you can also cheat and use && - || instead of ?? - !! :P | 16:06 | |
timotimo | pah | ||
but then you have a conditional on the LHS of && | 16:07 | ||
vendethiel | m: say True && 1 || 0; | ||
camelia | rakudo-moar 13f829: OUTPUT«1» | ||
vendethiel | timotimo: ? | ||
masak | timotimo: the bug is that the sub is not called if it's post-declared. | 16:08 | |
m: sub foo { bar 5; sub bar($) { "OH HAI" } }; say foo | |||
camelia | rakudo-moar 13f829: OUTPUT«sub bar ($) { #`(Sub|64738528) ... }» | ||
masak | ^ that's wrong. | ||
vendethiel | masak: it is called, you're just not "say"ing in it | ||
masak | no, look again. | ||
vendethiel | m: sub foo { bar 5; sub bar($) { say "OH HAI" } }; say foo | ||
camelia | rakudo-moar 13f829: OUTPUT«OH HAIsub bar ($) { #`(Sub|50845312) ... }» | ||
masak | oh, argh. | 16:09 | |
vendethiel | masak: the say is after the return. what's returned is the last expr - the sub | ||
masak | yes, I'm wrong. ignore me. :) | ||
masak goes to reject the ticket | |||
timotimo | :) | ||
masak | m: sub foo { return bar 5; sub bar($) { "OH HAI" } }; say foo | 16:10 | |
camelia | rakudo-moar 13f829: OUTPUT«OH HAI» | ||
masak | that's what I meant. | ||
timotimo | good that it works :) | ||
i'm pretty sure we rely on calling postdeclared subs in core, actually | 16:13 | ||
mst | masak: cute | ||
masak | mst: yes, one of those "ooh, I wish I had thought of that" ideas | 16:14 | |
of course, both multis and infix:<5> could be said to be conditional-ish in nature | 16:15 | ||
infix:<%> * | |||
typing with 8mo in lap :) | |||
timotimo | i think there's some oversharing of QAST::Var objects going on somewhere in rakudo and that's what messes up the optimizer :| | 16:16 | |
mst | masak: felt very erlang-ish |