»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋 Set by Zoffix on 25 July 2018. |
|||
00:00
lizmat joined,
p6bannerbot sets mode: +v lizmat
00:09
MasterDuke left,
lizmat left
00:34
TriangleSausage joined,
p6bannerbot sets mode: +v TriangleSausage
00:35
SCHAPiE joined,
p6bannerbot sets mode: +v SCHAPiE
00:36
TriangleSausage left
00:47
timotimo left,
Zoffix joined,
p6bannerbot sets mode: +v Zoffix,
Zoffix left
00:49
timo joined,
p6bannerbot sets mode: +v timo,
timo is now known as timotimo
|
|||
benjikun | howdy timotimo | 00:57 | |
timotimo | howdy | ||
01:06
x[LGWs4x4i]uG2N0 left
01:10
x[LGWs4x4i]uG2N0 joined,
p6bannerbot sets mode: +v x[LGWs4x4i]uG2N0
01:52
MasterDuke joined,
p6bannerbot sets mode: +v MasterDuke,
MasterDuke left,
MasterDuke joined,
herbert.freenode.net sets mode: +v MasterDuke,
p6bannerbot sets mode: +v MasterDuke
01:53
Ven` joined
01:54
p6bannerbot sets mode: +v Ven`
01:57
Ven` left
02:06
aborazmeh joined,
aborazmeh left,
aborazmeh joined,
p6bannerbot sets mode: +v aborazmeh,
Kaiepi left,
Kaiepi joined,
p6bannerbot sets mode: +v aborazmeh
02:07
p6bannerbot sets mode: +v Kaiepi
02:37
spycrab0 joined,
p6bannerbot sets mode: +v spycrab0
02:44
araraloren_ joined,
p6bannerbot sets mode: +v araraloren_
02:53
w_richard_w joined
02:54
p6bannerbot sets mode: +v w_richard_w
03:08
Grimnir14 joined
03:09
Grimnir14 left
03:20
quester joined,
p6bannerbot sets mode: +v quester
03:43
benjikun left
03:52
Gizmokid20057 joined,
Gizmokid20057 left
03:54
Ven` joined,
p6bannerbot sets mode: +v Ven`
03:58
Ven` left
03:59
matsuzine joined,
p6bannerbot sets mode: +v matsuzine
04:08
matsuzine left
04:09
kaare_ joined
04:10
p6bannerbot sets mode: +v kaare_
04:46
SakiTW joined,
p6bannerbot sets mode: +v SakiTW
04:47
SakiTW left
04:52
sandy joined,
p6bannerbot sets mode: +v sandy
04:56
sandy left
04:58
matsu joined
04:59
p6bannerbot sets mode: +v matsu
05:06
spycrab0 left
|
|||
xinming | How do we call the same sub or method with arg modified? | 05:14 | |
geekosaur | manually, unless you are doing dispatching and want to try the next candidate which is callwith or nextwith. to call the exact same sub again there is no mechanism. | 05:19 | |
05:24
aborazmeh left
05:33
giraffe left
|
|||
xinming | thanks | 05:46 | |
m: my @a = ('a' .. 'c'); my @b = (1 .. 3); my @c = @a x @b; @c.perl.say; | 05:47 | ||
camelia | ["a b ca b ca b c"] | ||
xinming | In perl6, There is a op to combine @a and @b, what that op is called? so the output will be something like, [a 1 | ||
In perl6, There is a op to combine @a and @b, what that op is called? so the output will be something like, [a 1], [a 2], [a 3], [b 1], [b 2], [b 3]... | 05:48 | ||
not zip | |||
m: my @a = ('a' .. 'c'); my @b = (1 .. 3); my @c = @a zip @b; @c.perl.say; | |||
camelia | 5===SORRY!5=== Error while compiling <tmp> Two terms in a row at <tmp>:1 ------> 3a' .. 'c'); my @b = (1 .. 3); my @c = @a7⏏5 zip @b; @c.perl.say; expecting any of: infix infix stopper postfix … |
||
xinming | m: my @a = ('a' .. 'c'); my @b = (1 .. 3); my @c = @a y @b; @c.perl.say; | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Two terms in a row at <tmp>:1 ------> 3a' .. 'c'); my @b = (1 .. 3); my @c = @a7⏏5 y @b; @c.perl.say; expecting any of: infix infix stopper postfix … |
||
xinming | m: my @a = ('a' .. 'c'); my @b = (1 .. 3); my @c = @a Z @b; @c.perl.say; | ||
camelia | [("a", 1), ("b", 2), ("c", 3)] | ||
xinming | m: my @a = ('a' .. 'c'); my @b = (1 .. 3); my @c = @a X @b; @c.perl.say; | 05:49 | |
camelia | [("a", 1), ("a", 2), ("a", 3), ("b", 1), ("b", 2), ("b", 3), ("c", 1), ("c", 2), ("c", 3)] | ||
xinming | This is what I want. | ||
I use the x which is wrong | |||
05:54
Ven` joined
05:55
p6bannerbot sets mode: +v Ven`
05:59
Ven` left
06:00
araraloren_ left
06:01
Guest14872 joined,
p6bannerbot sets mode: +v Guest14872
06:05
araraloren joined
06:06
p6bannerbot sets mode: +v araraloren
06:25
spycrab0 joined,
p6bannerbot sets mode: +v spycrab0
06:36
quester left
06:39
molaf joined,
p6bannerbot sets mode: +v molaf
07:02
rindolf joined
07:03
p6bannerbot sets mode: +v rindolf
07:06
ExeciN27 joined,
p6bannerbot sets mode: +v ExeciN27
07:07
ExeciN27 left
07:09
w_richard_w left
07:16
espadrine joined
07:17
p6bannerbot sets mode: +v espadrine
07:25
robertle joined
07:26
p6bannerbot sets mode: +v robertle
07:54
lizmat joined,
p6bannerbot sets mode: +v lizmat,
Ven` joined
07:55
p6bannerbot sets mode: +v Ven`
07:59
Ven` left
08:06
grumble left
08:07
grumble joined,
p6bannerbot sets mode: +v grumble
|
|||
Geth | doc: 318d8a89df | (JJ Merelo)++ | doc/Language/101-basics.pod6 Deletes last reference to Perl 5 I have actually left the reference when talking about `use v6`. In fact, it happens to me from time to time, and there's no way to explain what it does other than referencing this. I agree with @stmuk that it shouldn't be moved. It serves its purpose, which is to serve as an introduction *for anyone*, not for Perl 5 users now that all those references have been eliminated. This closes #2191 |
08:12 | |
synopsebot | Link: doc.perl6.org/language/101-basics | ||
08:26
bananas0 joined
08:27
p6bannerbot sets mode: +v bananas0
08:28
bananas0 left
08:36
spycrab0 left
09:10
abraxxa left
09:12
cpage left
09:18
Tison joined,
p6bannerbot sets mode: +v Tison
|
|||
Tison | xinming: @array x <rhs> would numify the rhs and repeat @array +<rhs> times | 09:21 | |
X is cross meta op IIRC | |||
docs.perl6.org/language/operators#...perator%29 | |||
09:39
molaf left
09:44
tomaw17 joined
09:45
p6bannerbot sets mode: +v tomaw17
09:46
tomaw17 left
09:55
Ven` joined
09:56
p6bannerbot sets mode: +v Ven`
09:59
Ven` left
10:01
sarna-web joined,
p6bannerbot sets mode: +v sarna-web
|
|||
sarna-web | m: for 1..3 -> $n {.say} | 10:02 | |
camelia | (Any) (Any) (Any) |
||
sarna-web | why doesn't it say "1 2 3"? | ||
10:04
kaare__ joined,
kaare_ left,
p6bannerbot sets mode: +v kaare__
|
|||
sarna-web | also, this is weird | 10:07 | |
m: for '1'..'9' -> $n {say $n} | 10:08 | ||
camelia | 1 2 3 4 5 6 7 8 9 |
||
sarna-web | m: for '1'..'10' -> $n {say $n} | ||
camelia | 1 | ||
sarna-web | :D | ||
lizmat | m: say "2" cmp "10" # indeed | 10:11 | |
camelia | More | ||
Geth | Pod-To-HTML/master: 6 commits pushed by (Armand Halbert)++, (Jonathan Stowe)++ | 10:13 | |
sarna-web | m: for '00'..'99' -> $n {say $n} | ||
camelia | 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 5… |
||
sarna-web | oh, that works :^) | ||
lizmat | m: for '000'..'99' -> $n {say $n} # this doesn't :-) | 10:19 | |
camelia | 000 | ||
10:24
astj joined
10:25
p6bannerbot sets mode: +v astj
|
|||
xinming | m: class A { multi method t (Str $s) { $s.say; }; multi method t (Hash %h) { nextwith (to-json %) } }; A.new.t({}) | 10:27 | |
camelia | Cannot resolve caller t(A: Hash); none of these signatures match: (A: Str $s, *%_) (A: Hash %h, *%_) in block <unit> at <tmp> line 1 |
||
xinming | How can we do nextwith on the method? | ||
m: class A { multi method t (Str $s) { $s.say; }; multi method t (Hash %h) { nextwith to-json({}) } }; A.new.t({}) | 10:28 | ||
camelia | Cannot resolve caller t(A: Hash); none of these signatures match: (A: Str $s, *%_) (A: Hash %h, *%_) in block <unit> at <tmp> line 1 |
||
xinming | m: class A { multi method t (Hash %h) { nextwith to-json({}) }; multi method t (Str $s) { $s.say; }; }; A.new.t({}) | ||
camelia | Cannot resolve caller t(A: Hash); none of these signatures match: (A: Hash %h, *%_) (A: Str $s, *%_) in block <unit> at <tmp> line 1 |
||
xinming | m: class A { multi method t (%h) { nextwith to-json({}) }; multi method t (Str $s) { $s.say; }; }; A.new.t({}) | ||
camelia | ( no output ) | ||
xinming | m: class A { multi method t (Hash $x) { nextwith to-json($x) }; multi method t (Str $s) { $s.say; }; }; A.new.t({}) | 10:29 | |
camelia | ( no output ) | ||
xinming | m: class A { multi method t (Hash $x) { nextwith to-json($x) }; multi method t (Str $s) { $s.say; }; }; A.new.t("{abc}") | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Undeclared routine: abc used at line 1. Did you mean 'abs'? |
||
xinming | m: class A { multi method t (Hash $x) { nextwith to-json($x) }; multi method t (Str $s) { $s.say; }; }; A.new.t("abc") | ||
camelia | abc | ||
xinming | m: class A { multi method t (Hash $x) { nextwith to-json($x) }; multi method t (Str $s) { $s.say; }; }; A.new.t(%({})) | ||
camelia | ( no output ) | ||
10:29
Ven` joined
|
|||
xinming | m: use JSON::Fast; class A { multi method t (Hash $x) { nextwith to-json($x) }; multi method t (Str $s) { $s.say; }; }; A.new.t({}} | 10:29 | |
camelia | ===SORRY!=== Could not find JSON::Fast at line 1 in: /home/camelia/.perl6 /home/camelia/rakudo-m-inst-1/share/perl6/site /home/camelia/rakudo-m-inst-1/share/perl6/vendor /home/camelia/rakudo-m-inst-1/share/perl6 CompUni… |
||
10:30
p6bannerbot sets mode: +v Ven`,
sarna-web left
|
|||
xinming | nextsame | 10:32 | |
not nextwith | |||
Need a lot of attention to distinuish all the differences between these | |||
10:41
Ven` left
10:47
kerframil left
11:02
Ven` joined,
p6bannerbot sets mode: +v Ven`
11:13
[particle]1 left
|
|||
xinming | m: ["hello" X [1..5]].perl.say; | 11:14 | |
camelia | [("hello", 1), ("hello", 2), ("hello", 3), ("hello", 4), ("hello", 5)] | ||
xinming | m: (["hello" X [1..5]].map: .hash).perl.say; | 11:15 | |
camelia | Cannot map a Array to a Hash. Did you mean to add a stub ({...}) or did you mean to .classify? in block <unit> at <tmp> line 1 |
||
xinming | m: (["hello" X [1..5]].map: *.hash).perl.say; | ||
camelia | ({:hello(1)}, {:hello(2)}, {:hello(3)}, {:hello(4)}, {:hello(5)}).Seq | ||
11:18
jjmerelo joined
11:19
p6bannerbot sets mode: +v jjmerelo
11:20
jmerelo left
11:21
astj left
11:31
kaare_ joined
|
|||
thundergnat | m: ("hello" X=> [1..5]).perl.say; | 11:31 | |
camelia | (:hello(1), :hello(2), :hello(3), :hello(4), :hello(5)).Seq | ||
11:31
kaare__ left,
p6bannerbot sets mode: +v kaare_
11:34
astj joined
11:35
p6bannerbot sets mode: +v astj
11:36
lizmat left
11:42
Ven` left
11:45
jjmerelo left
11:47
mscha joined,
p6bannerbot sets mode: +v mscha
|
|||
mscha | m: my SetHash $foo; for ^250_000 { $foo{$_} = True; }; say now - INIT now; | 11:48 | |
camelia | 3.2284417 | ||
mscha | m: my %foo{Int}; for ^250_000 { %foo{$_} = True; }; say now - INIT now; | ||
camelia | 0.8601462 | ||
11:48
EvilRoey15 joined
|
|||
mscha | m: 'my %foo; for ^250_000 { %foo{$_} = True; }; say now - INIT now; | 11:48 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Unable to parse expression in single quotes; couldn't find final "'" (corresponding starter was at line 1) at <tmp>:1 ------> 3 %foo{$_} = True; }; say now - INIT now;7⏏5<EOL> expecting … |
||
mscha | m: my %foo; for ^250_000 { %foo{$_} = True; }; say now - INIT now; | ||
camelia | 0.3908848 | ||
11:48
EvilRoey15 left
|
|||
mscha | Conclusion: using a SetHash is *much* slower than using a regular hash. | 11:48 | |
In addition, using a (regular) hash with Int keys is slower than using a hash with default string keys. | 11:49 | ||
12:07
pmurias joined,
p6bannerbot sets mode: +v pmurias
12:12
astj left
12:13
astj joined
12:14
p6bannerbot sets mode: +v astj
12:16
Ven` joined
12:17
p6bannerbot sets mode: +v Ven`,
molaf joined
12:18
[particle] joined,
p6bannerbot sets mode: +v molaf,
p6bannerbot sets mode: +v [particle],
astj left
12:28
kaare_ left,
sno left
12:29
astj joined
12:30
p6bannerbot sets mode: +v astj,
sno joined
12:31
p6bannerbot sets mode: +v sno
12:32
astj_ joined
12:33
p6bannerbot sets mode: +v astj_
12:36
astj left,
MilkmanDan left
12:37
MilkmanDan joined,
p6bannerbot sets mode: +v MilkmanDan
12:38
astj_ left
12:42
lizmat joined
12:43
p6bannerbot sets mode: +v lizmat,
Tison left
12:50
astj joined
12:51
p6bannerbot sets mode: +v astj
12:54
astj left
|
|||
xinming | termbin.com/qsdk <--- Anyone here tells me why will this method always ROLLBACK when I use txn-do: ? | 13:11 | |
I check the pg log, I found it always call ROLLBACK instead of COMMIT | 13:12 | ||
Where I do wrong? | |||
the True in sink context in LEAVE phasers are just testing. | |||
the $! returns Nil always. | 13:13 | ||
13:13
spycrab0 joined,
p6bannerbot sets mode: +v spycrab0
|
|||
xinming | but somehow, the UNDO block is always processed. | 13:13 | |
I just now find the problem, maybe this is a bug, or someone can explain this for me? termbin.com/r43u | 13:23 | ||
jnthn | xinming: UNDO and REDO care about the result that the block they're in evaluates to | 13:27 | |
When you return, you throw a control exception, which means you exit the nested block with an undefiend value, which triggers UNDO | |||
13:28
pmurias left
|
|||
jnthn | Solution: don't write `return`, or put the UNDO/KEEP at the sub level | 13:29 | |
xinming | Does that mean we can't return "value"? | ||
a little confused how the logic is | 13:30 | ||
13:31
pmurias joined
|
|||
jnthn | Sure, you just need your UNDO/REDO at the level of the sub | 13:31 | |
13:31
quiz9613 joined
|
|||
jnthn | Then they'll examine the sub's return value | 13:31 | |
xinming | termbin.com/qsdk <--- What about this? | ||
13:32
p6bannerbot sets mode: +v pmurias
|
|||
jnthn | Exactly the same situation, no? | 13:32 | |
13:32
p6bannerbot sets mode: +v quiz9613,
quiz9613 left
|
|||
xinming | jnthn: for the return part, I'm thinking how these can be better solved | 13:32 | |
the method txn-do | |||
jnthn | Oh, you want the early return | ||
xinming | jnthn: Yes, if we have early return, how this can be fixed? | 13:33 | |
jnthn | Just remove the second return, and use an implicit return | ||
xinming | If we early return, the KEEP will be executed, and then, we got result commited. | ||
jnthn | So the block has the correct result | ||
Or if you don't like that, factor the second part out into another sub | |||
13:33
rorx13 joined
13:34
p6bannerbot sets mode: +v rorx13
13:35
Ven` left,
rorx13 left
|
|||
xinming | If the LEAVE last statement return False, Will it cause UNDO to be run? | 13:36 | |
I found that if i have LEAVE statement in txn-do method, It'll still go to UNDO | 13:37 | ||
13:43
Ven` joined,
p6bannerbot sets mode: +v Ven`
13:48
Ven` left
13:49
Zoffix joined,
p6bannerbot sets mode: +v Zoffix,
kaare_ joined
13:50
p6bannerbot sets mode: +v kaare_,
MilkmanDan left
13:51
MilkmanDan joined,
p6bannerbot sets mode: +v MilkmanDan
|
|||
Zoffix | PSA: we modified perl6 GitHub org perms a bit. Default org perm was Write and has been reduced to Read. Any new repo now will need you to add `perl6` team to it with write perms, if you want regular members of the or to be able to write to it. The nqp repo has been excluded from the `perl6` default team. To add new committers to `nqp` repo, add them to `nqp` team. If you used to be a contributor to nqp and now | 13:53 | |
lost your access, ping one of the org admins and we'll be able to add you back | |||
s/of the or to/of the org to/; | 13:57 | ||
14:01
Zoffix left
14:22
zakharyas joined
14:23
p6bannerbot sets mode: +v zakharyas
|
|||
pochi | "MoarVM panic: Internal error: zeroed target thread ID in work pass" | 14:31 | |
what does this mean? | |||
AlexDaniel | pochi: most likely a bug, although it somewhat depends on what you were doing | 14:58 | |
15:01
Ven` joined
15:02
p6bannerbot sets mode: +v Ven`
15:04
petercommand left
15:10
jmerelo joined,
p6bannerbot sets mode: +v jmerelo
15:25
araraloren left
|
|||
xinming | m: my %x = ("a", "b"); sub t ( %h) { %h.perl.say }; t ({ |%^C :a("b") }); | 15:27 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Unsupported use of %^C variable at <tmp>:1 ------> 3; sub t ( %h) { %h.perl.say }; t ({ |%^C7⏏5 :a("b") }); |
||
xinming | m: my %x = ("a", "b"); sub t ( %h) { %h.perl.say }; t ({ |%x, :a("b") }); | ||
camelia | Type check failed in binding to parameter '%h'; expected Associative but got Block (-> ;; $_? is raw { #`...) in sub t at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
xinming | m: my %x = ("a", "b"); sub t ( %h) { %h.perl.say }; t ({ %x, :a("b") }); | 15:28 | |
camelia | {:a("b")} | ||
xinming | m: my %x = ("x", "y"); sub t ( %h) { %h.perl.say }; t ({ %x, :a("b") }); | ||
camelia | {:a("b"), :x("y")} | ||
xinming | m: sub h () { my %x = ("a", "b") }; sub t ( %h) { %h.perl.say }; t ({ h(), :a("b") }); | 15:29 | |
camelia | Type check failed in binding to parameter '%h'; expected Associative but got Block (-> ;; $_? is raw { #`...) in sub t at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
xinming | How do we force { } to be a hash in this case? | ||
samcv | AlexDaniel: i'm working on github.com/rakudo/rakudo/issues/2198 right now | 15:30 | |
yoleaux | 10 Aug 2018 18:56Z <AlexDaniel> samcv: GH#2198 | ||
synopsebot | GH#2198 [open]: github.com/rakudo/rakudo/issues/2198 [UNI][regression] The Regional Indicator Symbols seem to get mangled when flipped sometimes | ||
AlexDaniel | cool! | ||
xinming | m: sub h () { my %x = ("a", "b"); %x }; sub t ( %h) { %h.perl.say }; t {(h(), :a("b"))}; | ||
camelia | Type check failed in binding to parameter '%h'; expected Associative but got Block (-> ;; $_? is raw { #`...) in sub t at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
jmerelo | samcv++ | 15:32 | |
15:34
Ven` left
|
|||
xinming | m: sub h () { my %x = ("a", "b"); %x }; sub t ( %h) { %h.perl.say }; t {:a("b"), h}; | 15:36 | |
camelia | {:a("b")} | ||
xinming | m: sub h () { my %x = ("x", "y"); %x }; sub t ( %h) { %h.perl.say }; t {:a("b"), h}; | ||
camelia | {:a("b"), :x("y")} | ||
xinming | m: sub h () { my %x = ("a", "c", "x", "y"); %x }; sub t ( %h) { %h.perl.say }; t {:a("b"), h}; | 15:37 | |
camelia | {:a("c"), :x("y")} | ||
xinming | m: sub default () { my %x = ("a", "c", "x", "y"); %x }; sub t ( %h) { %h.perl.say }; t {default, :a("b") }; | ||
camelia | Type check failed in binding to parameter '%h'; expected Associative but got Block (-> ;; $_? is raw { #`...) in sub t at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
xinming | m: sub default () { my %x = ("a", "c", "x", "y"); %x }; sub t ( %h) { %h.perl.say }; t { %(default), :a("b") }; | ||
camelia | Type check failed in binding to parameter '%h'; expected Associative but got Block (-> ;; $_? is raw { #`...) in sub t at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
15:40
xelak joined,
p6bannerbot sets mode: +v xelak
|
|||
xinming | In my case, is there a way to force the "block" to be hash? | 15:40 | |
xelak | m: my $p=Proc::Async.new("xxxx"); await $proc.start; CATCH { default {say "caught!"}} | 15:43 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '$proc' is not declared. Did you mean 'Proc'? at <tmp>:1 ------> 3my $p=Proc::Async.new("xxxx"); await 7⏏5$proc.start; CATCH { default {say "caugh |
||
15:43
beaver25 joined
|
|||
xelak | m: my $p=Proc::Async.new("xxxx"); await $p.start; CATCH { default {say "caught!"}} | 15:43 | |
camelia | caught! | ||
15:43
beaver25 left
15:44
jmerelo left
|
|||
xelak | m: my $p=Proc::Async.new("xxxx"); $p.Supply.act: { .print }; CATCH { default {say "caught!"}} | 15:47 | |
camelia | caught! | ||
xelak | m: my $p=Proc::Async.new("xxxx"); $p.Supply.act: { .print }; await $p.start; CATCH { default {say "caught!"}} | 15:50 | |
camelia | caught! | ||
15:51
MilkmanDan left
15:52
MilkmanDan joined,
p6bannerbot sets mode: +v MilkmanDan
15:56
Herby joined
15:57
p6bannerbot sets mode: +v Herby
|
|||
Herby | o/ | 15:57 | |
xelak | m: my $p=Proc::Async.new("/bin/sh echo 42; echo 100 >&2"); $p.Supply.act: { .print }; await $p.start; CATCH { default {say "caught!"}} | 15:59 | |
camelia | caught! | ||
xelak | m: my $p=Proc::Async.new("/bin/sh echo 42; echo 100 >&2"); $p.Supply.act: { .print }; await $p.start; | ||
camelia | Proc::Async is disallowed in restricted setting in sub restricted at src/RESTRICTED.setting line 1 in method new at src/RESTRICTED.setting line 32 in block <unit> at <tmp> line 1 |
||
timotimo | try with p6: instead | ||
xelak | p6: my $p=Proc::Async.new("/bin/sh echo 42; echo 100 >&2"); $p.Supply.act: { .print }; await $p.start; | 16:00 | |
camelia | Proc::Async is disallowed in restricted setting in sub restricted at src/RESTRICTED.setting line 1 in method new at src/RESTRICTED.setting line 32 in block <unit> at <tmp> line 1 |
||
AlexDaniel | you mean e: ? | ||
e: my $p=Proc::Async.new("/bin/sh echo 42; echo 100 >&2"); $p.Supply.act: { .print }; await $p.start; | |||
evalable6 | (exit code 1) Unhandled exception in code scheduled on thread 4 Cannot invoke this object (REPR: Null; VMNull) |
||
16:01
pochi left
|
|||
xelak | e: my $p=Proc::Async.new("xxxx"); $p.Supply.act: { .print }; await $p.start; CATCH { default {say "caught!"}} | 16:01 | |
evalable6 | (exit code 1) Unhandled exception in code scheduled on thread 4 Cannot invoke this object (REPR: Null; VMNull) |
||
xelak | e: my $p=Proc::Async.new("xxxx"); await $p.start; CATCH { default {say "caught!"}} | 16:02 | |
evalable6 | caught! | ||
xelak | e: my $p=Proc::Async.new("xxxx"); $p.Supply.act: { .print }; await $p.start; CATCH { default {say "caught!"}} | ||
evalable6 | (exit code 1) Unhandled exception in code scheduled on thread 4 Cannot invoke this object (REPR: Null; VMNull) |
||
AlexDaniel | well, hmm… the shell example should be like this | ||
e: my $p=Proc::Async.new("/bin/sh", "-c", "echo 42; echo 100 >&2"); $p.Supply.act: { .print }; await $p.start | 16:03 | ||
evalable6 | 42 100 |
||
xelak | But how can I catch the exception? | ||
AlexDaniel | and it dies correctly in this case: | ||
m: $p=Proc::Async.new("xxxxxxx"); await $p.start | |||
camelia | Proc::Async is disallowed in restricted setting in sub restricted at src/RESTRICTED.setting line 1 in method new at src/RESTRICTED.setting line 32 in block <unit> at <tmp> line 1 |
||
AlexDaniel | e: $p=Proc::Async.new("xxxxxxx"); await $p.start | ||
evalable6 | (exit code 1) Cannot assign to an immutable value in block <unit> at /tmp/W_zAK07tga line 1 |
||
AlexDaniel | e: my $p=Proc::Async.new("xxxxxxx"); await $p.start | ||
evalable6 | (exit code 1) An operation first awaited: in block <unit> at /tmp/x3QaCgKJXR line 1 Died with the exception: no such file or directory |
16:04 | |
AlexDaniel | ↑ that's correct | ||
xelak | e: $p=Proc::Async.new("xxxxxxx"); await $p.start; CATCH { default {say "caught!"}} | ||
evalable6 | caught! | ||
AlexDaniel | e: my $p=Proc::Async.new("xxxxxxx"); react { whenever $p.stdout { .print }; whenever $p.start { say "proc finished" } } | ||
evalable6 | (exit code 1) An operation first awaited: in block <unit> at /tmp/U37WgiZjPk line 1 Died with the exception: no such file or directory in block <unit> at /tmp/U37WgiZjPk line 1 |
||
AlexDaniel | this is also fine ↑ | 16:05 | |
xelak | e: $p=Proc::Async.new("xxxxxxx"); $p.Supply.act: { .print }; await $p.start; CATCH { default {say "caught!"}} | ||
evalable6 | caught! | ||
AlexDaniel | e: my $p=Proc::Async.new("xxxxxxx"); react { whenever $p.stdout { .print }; whenever $p.start { say "proc finished" } }; CATCH { default { say "caught!" } } | 16:06 | |
evalable6 | caught! | ||
AlexDaniel | isn't it a bit weird that the exception is thrown outside the react block? | ||
xelak | e: my $p=Proc::Async.new("xxxx"); $p.Supply.act: { .print }; await $p.start; CATCH { default {say "caught!"}} | ||
evalable6 | (exit code 1) Unhandled exception in code scheduled on thread 4 Cannot invoke this object (REPR: Null; VMNull) |
||
xelak | e: $p=Proc::Async.new("xxxxxxx"); $p.Supply.act: { .print }; await $p.start; CATCH { default {say "caught!"}} | 16:07 | |
evalable6 | caught! | ||
xelak | e: $p=Proc::Async.new("xxxx"); $p.Supply.act: { .print }; await $p.start; CATCH { default {say "caught!"}} | 16:08 | |
evalable6 | caught! | ||
jnthn | Hm, that "cannot invoke this object" is a bit odd | 16:10 | |
Geth | perl6.org: de50d50978 | (Steve Mynott)++ | source/downloads/index.html mention 2018.06.1 released to fix Windows/Linenoise |
||
jnthn | e: $p=Proc::Async.new("xxxx"); $p.Supply.act: { .print }; await $p.start; CATCH { default {say "caught!"; sleep 1}} | 16:11 | |
evalable6 | caught! | ||
jnthn | e: $p=Proc::Async.new("xxxx"); $p.stdout.act: { .print }; await $p.start; CATCH { default {say "caught!"; sleep 1}} | 16:12 | |
evalable6 | caught! | ||
xelak | e: my $p=Proc::Async.new("xxxx"); $p.Supply.act: { .print }; await $p.start; CATCH { default {say "caught!"}} | ||
evalable6 | (exit code 1) Unhandled exception in code scheduled on thread 4 Cannot invoke this object (REPR: Null; VMNull) |
16:13 | |
xelak | So, what happend here? | 16:14 | |
jnthn | It's not entirely clear, but --ll-exception makes it look like a null code object was stuffed into the scheduler's queue | 16:15 | |
samcv | AlexDaniel: fixing some issues with join as well with regional indicators I discovered | 16:16 | |
xelak | e: my $p=Proc::Async.new("/bin/sh", "-c", "echo '42'; echo '100' >&2"); $proc.Supply.act: { .print }; await $proc.start; | 16:20 | |
evalable6 | (exit code 1) 04===SORRY!04=== Error while compiling /tmp/FTtAXOBXNb Variabl… |
||
xelak, Full output: gist.github.com/d1d8f3ebe279654b2f...4482ca929e | |||
xelak | my $p=Proc::Async.new("/bin/sh", "-c", "echo '42'; echo '100' >&2"); $p.Supply.act: { .print }; await $p.start; | 16:21 | |
evalable6 | 42 100 |
||
16:25
Herby left
16:29
breitenj25 joined,
[particle] left,
p6bannerbot sets mode: +v breitenj25
16:30
breitenj25 left
16:34
MasterDuke left
16:35
plutes joined
16:36
p6bannerbot sets mode: +v plutes
|
|||
plutes | thanks | 16:36 | |
16:38
scimon joined
16:39
p6bannerbot sets mode: +v scimon
|
|||
jdv79 | why'd i just get "subscribed" to 10 seemingly random "perl6 repos"? | 16:39 | |
16:40
Ven` joined
16:41
p6bannerbot sets mode: +v Ven`
|
|||
stmuk | I think there have been admin changes to "perl6" repos | 16:42 | |
timotimo | access for nqp repos has been shuffled around, so you probably got removed in one step and added in another | ||
16:43
abraxxa joined
16:44
p6bannerbot sets mode: +v abraxxa,
Ven` left
16:47
abraxxa left
|
|||
xelak | e: for ^10 -> $i { my $p = Proc::Async.new(<<"$*EXECUTABLE" -e "say 42; note 100">>); my $s = $p.Supply(:bin); my $c = $s.Channel; my $o = IO::Pipe.new(:on-read({(try $c.receive) // buf8}), :on-close({$c.close})); await $p.start; say "Failed ($i)" if set($o.lines) !eqv set('42', '100'); } | 16:51 | |
evalable6 | |||
xelak | e: for ^20 -> $i { my $p = Proc::Async.new(<<"$*EXECUTABLE" -e "say 42; note 100">>); my $s = $p.Supply(:bin); my $c = $s.Channel; my $o = IO::Pipe.new(:on-read({(try $c.receive) // buf8}), :on-close({$c.close})); await $p.start; say "Failed ($i)" if set($o.lines) !eqv set('42', '100'); } | 16:52 | |
evalable6 | |||
xelak | e: for ^50 -> $i { my $p = Proc::Async.new(<<"$*EXECUTABLE" -e "say 42; note 100">>); my $s = $p.Supply(:bin); my $c = $s.Channel; my $o = IO::Pipe.new(:on-read({(try $c.receive) // buf8}), :on-close({$c.close})); await $p.start; say "Failed ($i)" if set($o.lines) !eqv set('42', '100'); } | 16:53 | |
evalable6 | |||
16:53
Zoffix joined,
p6bannerbot sets mode: +v Zoffix
|
|||
Zoffix | . | 16:53 | |
yoleaux | 16:15Z <stmuk> Zoffix: can you please fix rakudo.org to point to R* source/windows 2018.06.1 (note Mac DMG version unchanged). I don't seem to have access anymore | ||
Zoffix | AlexDaniel: so looks like a bunch of repos didn't have any teams assigned to them and now people ain't got access to them. Any tips to get perl6 team assigned to all(?) repos (except for nqp)? | 16:54 | |
Geth | rakudo.org: 0ad12624a6 | (Zoffix Znet)++ (committed using GitHub Web editor) | templates/files.html.ep List 2018.06.1 for Windows |
16:56 | |
rakudo.org: 373d08f1f5 | (Zoffix Znet)++ (committed using GitHub Web editor) | templates/files.html.ep List 2018.06.1 for source |
16:57 | ||
AlexDaniel | Zoffix: there are 69 repos in total and 54 are configured for write access | 16:58 | |
so we just have to configure the remaining 15… | |||
how do we find them though :) | |||
xelak | e: for ^100 -> $i { my $p = Proc::Async.new(<<"$*EXECUTABLE" -e "say 42; note 100">>); my $s = $p.Supply(:bin); my $c = $s.Channel; my $o = IO::Pipe.new(:on-read({(try $c.receive) // buf8}), :on-close({$c.close})); await $p.start; say "Failed ($i)" if set($o.lines) !eqv set('42', '100'); } | 17:00 | |
AlexDaniel | and how much faster would it be to check them one by one, heh… | ||
evalable6 | (signal SIGHUP) «timed out after 10 seconds» | ||
xelak | e: for ^50 -> $i { my $p = Proc::Async.new(<<"$*EXECUTABLE" -e "say 42; note 100">>); my $s = $p.Supply(:bin); my $c = $s.Channel; my $o = IO::Pipe.new(:on-read({(try $c.receive) // buf8}), :on-close({$c.close})); await $p.start; say "Failed ($i)" if set($o.lines) !eqv set('42', '100'); } | ||
evalable6 | |||
stmuk | BTW if anyone chocolatey related is here .. the choco star needs bumping too .. (I just tweeted at briandfoy anyway) | ||
17:02
plutes left
|
|||
timotimo | could bdf have something to do with that? | 17:02 | |
stmuk | yes its the three at the bottom of chocolatey.org/packages/rakudostar | 17:03 | |
AlexDaniel | Zoffix: ok I'm doing it manually and I'll probably finish in 5 mins | ||
Zoffix | AlexDaniel++ # thanks | ||
17:04
plutes joined
17:05
p6bannerbot sets mode: +v plutes
17:06
pochi joined
17:07
p6bannerbot sets mode: +v pochi
|
|||
AlexDaniel | dammit, 68 out of 69 | 17:08 | |
17:08
zakharyas left
|
|||
AlexDaniel | I missed one :D | 17:08 | |
ah, I know which one | |||
Zoffix: done, 69 out of 69 | 17:09 | ||
Zoffix | sweet | ||
AlexDaniel | I wonder how many email notifications I generated this time | ||
Zoffix | #yolo | 17:10 | |
AlexDaniel | Zoffix: fwiw github.com/rakudo/rakudo/issues/21...-412356255 | ||
let me know if you can run it | |||
17:10
[particle] joined
|
|||
AlexDaniel | if not I can do it too of course, but maybe not today | 17:10 | |
17:11
p6bannerbot sets mode: +v [particle]
|
|||
Zoffix | AlexDaniel: yeah, I can run it | 17:11 | |
AlexDaniel | “[GitHub] Subscribed to 7 perl6 repositories” whew | ||
it was smart enough not to send 7 emails | 17:12 | ||
although it feels like soon I'll get another one about the remaining 8 repos | |||
17:12
plutes left,
MasterDuke joined,
p6bannerbot sets mode: +v MasterDuke
17:13
MasterDuke left,
MasterDuke joined,
herbert.freenode.net sets mode: +v MasterDuke,
p6bannerbot sets mode: +v MasterDuke
|
|||
Zoffix | MUAHAHA | 17:13 | |
Zoffix waits for ssh actually to connect | |||
c'mon, don't hold out on me bruh | 17:14 | ||
I'm in :D | 17:15 | ||
AlexDaniel: look what I'm gonna toast on :D i.imgur.com/vzdyEap.png | 17:16 | ||
160 cores 3.8 Terra byte sof RAM | |||
AlexDaniel | Zoffix: omg… so how can I get that? I mean, I think I'm even running out of the initial google cloud bonus… | ||
which is a good motivation for me to optimize toaster, right :) | 17:17 | ||
17:17
[particle] left
|
|||
Zoffix | I dunno, I had to request quota increase to even boot this thing | 17:17 | |
AlexDaniel | also, I'm thinking about integrating some bisection logic right into toaster | ||
Zoffix | And it's expensive AF... like $17/h or something | ||
AlexDaniel | Zoffix: but they didn't give you any extra free credit? | ||
Zoffix | I already used it up long time ago | 17:18 | |
Well, it lasts only X months I think and I already past that point | |||
AlexDaniel | it's my last month I think and I have like 30€ left | ||
17:24
kylese joined
17:25
p6bannerbot sets mode: +v kylese
17:32
petercommand joined,
p6bannerbot sets mode: +v petercommand
|
|||
Zoffix | uhhh | 17:37 | |
oh ok, toaster crashed 'cause the disk is just full *phew* | 17:38 | ||
17:45
erasmus20 joined,
erasmus20 left
17:54
quester joined,
p6bannerbot sets mode: +v quester
|
|||
Geth | perl6.org: a237d2d5ea | (Steve Mynott)++ | source/downloads/index.html Revert "mention 2018.06.1 released to fix Windows/Linenoise" This reverts commit de50d50978a7c19aaea2e1e35970dff2dec037e5. |
17:54 | |
rakudo.org: e399d54ae8 | (Steve Mynott)++ | templates/files.html.ep Revert "List 2018.06.1 for Windows" This reverts commit 0ad12624a6735e5507b97929a5fcc6409c1b5ba5. |
17:56 | ||
rakudo.org: a5b036377d | (Steve Mynott)++ | templates/files.html.ep Revert "List 2018.06.1 for source" This reverts commit 373d08f1f574c611ab623ade37751dee01cf10be. |
|||
Zoffix | fuksake "Command terminated by signal 11" | 18:10 | |
may as well have run it on my 24-core box *eyeroll* | 18:12 | ||
Xliff | Don't you mean 24-thread? | 18:24 | |
:) | |||
When did you get THAT beast? I assembled a 20-core machine back in late May | 18:25 | ||
18:26
regreg joined
18:27
p6bannerbot sets mode: +v regreg
|
|||
Xliff | i.imgur.com/vzdyEap.png :-O | 18:27 | |
Zoffy. Share tha luv, bruv! Where can I get access to one of those? | 18:28 | ||
m: sub a { say "A" }; &("a"); | 18:29 | ||
camelia | ( no output ) | ||
Xliff | m: sub a { say "A" }; &{"a"}; | ||
camelia | ( no output ) | ||
Xliff | m: sub a { say "A" }; &"a"; | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Name must begin with alphabetic character at <tmp>:1 ------> 3sub a { say "A" }; &7⏏5"a"; expecting any of: infix infix stopper statement end stat… |
||
Xliff | m: sub a { say "A" }; my $a = "a"; &($a) | 18:30 | |
camelia | ( no output ) | ||
Xliff | m: sub a { say "A" }; my $a = "a"; &($a)() | ||
camelia | No such method 'CALL-ME' for invocant of type 'Str' in block <unit> at <tmp> line 1 |
||
Xliff | m: sub a { say "A" }; my $a = "a"; &{$a}() | ||
camelia | ( no output ) | ||
Xliff | ?!? | ||
&::("a") | |||
m: sub a { say "A" }; my $a = "a"; &::("a") | |||
camelia | ( no output ) | ||
Xliff | m: sub a { say "A" }; my $a = "a"; say &::("a") | ||
camelia | &a | ||
Xliff | m: sub a { say "A" }; my $a = "a"; &a; | 18:31 | |
camelia | WARNINGS for <tmp>: Useless use of &a in sink context (line 1) |
||
Xliff | m: sub a { say "A" }; my $a = "a"; a; | ||
camelia | A | ||
18:32
regreg left
|
|||
Xliff | m: sub a { say "A" }; my $a = "a"; ::("a") | 18:32 | |
camelia | No such symbol 'a' in block <unit> at <tmp> line 1 |
||
Xliff | m: sub a { say "A" }; my $a = "a"; ::("&a") | ||
camelia | ( no output ) | ||
18:32
regreg joined
|
|||
Xliff | m: sub a { say "A" }; my $a = "a"; "&a"; | 18:32 | |
camelia | WARNINGS for <tmp>: Useless use of constant string "&a" in sink context (line 1) |
||
18:32
scimon left
18:33
p6bannerbot sets mode: +v regreg
|
|||
MasterDuke | Xliff: he's using google compute engine (or whatever it's called) | 18:33 | |
Xliff | Ooo | 18:34 | |
MasterDuke++ | |||
OK, so if I have $a = "a" and sub a(); how can I call sub a() using $a? | |||
moritz | &::($a)() | 18:35 | |
Xliff | I could have sworn I tried that. | ||
m: sub a { say "A" }; my $a = "a"; &::($a)() | |||
camelia | A | ||
Xliff | Oh fizzlesticks. | ||
Zoffix | Xliff: no, 24-core | 18:36 | |
Xliff: you can get access to Google Compute Engine | |||
regreg | hello, i want to learn a scripting language (but not python), what should i learn? perl5 or perl6? | ||
Zoffix | regreg: perl6 | ||
regreg | is perl6 more future-proof? | 18:37 | |
Zoffix | regreg: yup: marketing.perl6.org/id/1531540189/any | ||
regreg | i'm a C programmer if matters | ||
Zoffix | We got NativeCall too. Lets you use C libraries fairly easily: docs.perl6.org/language/nativecall | 18:38 | |
Just had a program running on 160 cores: pbs.twimg.com/media/Dkaoat3WwAAjRyM.jpg | 18:39 | ||
Sounds like what a future-proof lang would do to me :) | |||
regreg | i'm interested in a side-project using llvm to write a JIT, or is the default moar perl6 jit good enough and would be a waste of time on my side? | ||
Zoffix | regreg: dunno, I think #moarvm folks would be more capable to answer that. | 18:40 | |
regreg | i see, there is a moarvm channel | ||
Zoffix | regreg: person named brrt in particular. They're the moarvm JIT expert | 18:41 | |
18:41
reportable6 left
|
|||
regreg | i see.. thanks | 18:41 | |
Ulti | regreg: there are a couple of projects targetting other VMs/langs like graalvm and javascript | 18:43 | |
regreg | i'm interested into writing a linux kernel replacement in a more productive language even if that means less performance | 18:44 | |
so i need a good jit | |||
Zoffix | .tell AlexDaniel well, I tried toasting twice but looks like the 160-core toaster segfaults after some time (toaster itself runs on an older rakudo, not on HEAD). Kinda annoyed with it now and don't wanna re-toast on my 64-core box. Here are the partial results: toaster.perl6.party/ | ||
yoleaux | Zoffix: I'll pass your message to AlexDaniel. | ||
AlexDaniel | . | ||
yoleaux | 18:44Z <Zoffix> AlexDaniel: well, I tried toasting twice but looks like the 160-core toaster segfaults after some time (toaster itself runs on an older rakudo, not on HEAD). Kinda annoyed with it now and don't wanna re-toast on my 64-core box. Here are the partial results: toaster.perl6.party/ | ||
Zoffix | regreg: in that case perl6 might be a bad choice. First stable release was like 2.5 years ago and performance currently ain't that great. Still tons of work to do. | 18:45 | |
Unless of course you want to help us out make MoarVM faster in the process of writing the linux thing :D | |||
regreg | Zoffix, is perl6 the hightest level language around? i don't care that much about performance | 18:46 | |
Zoffix | regreg: no idea. Not really a conosseiur of languages. | ||
regreg | hmm | ||
i like that perl6 has multimethods | |||
Zoffix | :) | 18:47 | |
AlexDaniel: maybe partial results ain't useful at all actually, because normally it re-toasts failures once, but in those results it didn't get to that stage | 18:48 | ||
AlexDaniel | Zoffix: I know… I hope I'll get some time next month to make toaster even fancier | ||
Zoffix: because, for example, is there really any need to install any module more than once? | |||
Zoffix | mhm | 18:49 | |
AlexDaniel | that could cut most of the run time, I think | ||
I mean, if n-installing is eliminated :) | |||
and then, there's github.com/perl6/whateverable/wiki/Shareable | |||
so we don't necessarily have to build rakudo at all, just take the tar. And if the module fails, take another one… and keep doing until bisected :) | 18:50 | ||
also, if that eliminates toaster flops (it should), then we can run tests of each module more than once | 18:51 | ||
and give them “flopper” status if we find that | |||
but yeah… I'm slightly overloaded with all kinds of project… mmm… I wish somebody else contributed that :) | 18:52 | ||
projects* | |||
*hint-hint* #perl6 :) | |||
Zoffix | That reminds me | ||
18:52
Zoffix left
|
|||
AlexDaniel | right | 18:53 | |
also I'd be glad to give away pretty much any project of mine. Squashathons are up for grabs, whateverable too | 18:58 | ||
18:58
HaraldJoerg joined
|
|||
AlexDaniel | not because I don't want to work on these perl6-related things, it's just because I want to work on *other* perl6-related stuff :) | 18:58 | |
18:58
p6bannerbot sets mode: +v HaraldJoerg
19:08
Ven` joined,
xelak left,
p6bannerbot sets mode: +v Ven`
|
|||
lizmat | . | 19:10 | |
19:10
Khisanth left
19:12
Ven` left
19:16
Hoosilon25 joined
19:17
p6bannerbot sets mode: +v Hoosilon25,
Hoosilon25 left
19:23
Khisanth joined
19:24
p6bannerbot sets mode: +v Khisanth
19:44
Ven` joined
19:45
p6bannerbot sets mode: +v Ven`
|
|||
xinming | If an @array is iterable, After we use for @array -> $item { } Will the @array result be cached the second time we call for @array -> $item { } ??? | 19:49 | |
19:49
Ven` left
|
|||
moritz | xinming: yes | 19:50 | |
arrays can be lazy, but they store once-evaluated values | |||
m: my @a = 1, 1, -> $a, $b { my $r = $a + $b; say "calculating $r" } ... *; say @a[5]; say @a[4] | 19:51 | ||
camelia | calculating 2 calculating 2 calculating 2 calculating 2 True True |
||
moritz | m: my @a = 1, 1, -> $a, $b { my $r = $a + $b; say "calculating $r"; $r } ... *; say @a[5]; say @a[4] | 19:52 | |
camelia | calculating 2 calculating 3 calculating 5 calculating 8 8 5 |
||
xinming | Thanks | ||
19:53
Alucard4200 joined
19:54
p6bannerbot sets mode: +v Alucard4200
19:56
robertle left
19:58
Alucard4200 left
|
|||
xinming | m: (15.4 % 2).perl.say; | 20:04 | |
camelia | 1.4 | ||
xinming | What is the operator called to return the 14 instead of remainder? | 20:05 | |
20:08
MilkmanDan left
20:09
MilkmanDan joined,
p6bannerbot sets mode: +v MilkmanDan
|
|||
jnthn | m: (15.4 div 2).perl.say | 20:10 | |
camelia | Cannot resolve caller infix:<div>(Rat, Int); none of these signatures match: (Int:D \a, Int:D \b) (int $a, int $b --> int) in block <unit> at <tmp> line 1 |
||
jnthn | oh, wait, not that one :) | ||
m: (15.4 / 2).floor.perl.say | |||
camelia | 7 | ||
jnthn | Oh, gah, that isn't it either | ||
hah :) | |||
jnthn wonders if there is an operator for that... | |||
tobs | I don't think so, been looking at the table | 20:11 | |
xinming | There is one IIRC | ||
because I read the doc a month ago, I have the impression for that, I just forgot | |||
I'll look again. | |||
timotimo | m: say 15.4.round(2) | 20:12 | |
camelia | 16 | ||
timotimo | m: say 15.4.floor(2) | ||
camelia | Too many positionals passed; expected 1 argument but got 2 in block <unit> at <tmp> line 1 |
||
timotimo | hm, that could conceivably have that parameter | ||
20:20
Ven` joined
20:21
p6bannerbot sets mode: +v Ven`
|
|||
b2gills | regreg: With the SLang feature, Perl 6 is the superset of all programming languages. (It is not part of the spec yet, but does work in Rakudo) | 20:22 | |
regreg | b2gills, what does SLang do? | ||
timotimo | basically lets you change or completely replace the parser for a given scope | 20:23 | |
20:25
espadrine left,
kylese left
20:26
Ven` left
|
|||
xinming | I know when can have something like, my @a; my $iter = sub { @a[$++]; }; for @b { my $item = $iter(); ... }; | 20:29 | |
Is there something better idiom in perl6 for this? | |||
timotimo | you can @a[$++] xx 10 | 20:30 | |
m: my @a = <a b c x y z g h i>; .say for @a[$++] xx @a; | |||
camelia | a b c x y z g h i |
||
timotimo | ^- using @a as the RHS of xx will use its length | 20:31 | |
xinming | I mean the $iter thing | ||
timotimo | but there's also .iterator and .pull-one | ||
xinming | not the xx thing. | ||
I'll check about .iterator | |||
timotimo | m: my @a = <1 2 3 4 5>; my $iter = @a.iterator; for ^10 { say $iter.pull-one } | ||
camelia | 1 2 3 4 5 |
||
jnthn | Maybe see also gather/take | ||
xinming | pull-one is what I want. | 20:32 | |
b2gills | It seems as if you are trying to do iterators like you would in Python. | 20:33 | |
xinming | I never used python :-) | ||
This is how I do something in perl5 | 20:34 | ||
timotimo | fwiw, your code also works as you wrote it, doesn't it? | ||
you may want to have a make-iter sub that returns that sub you have in your code | |||
so that you can "start from the beginning" if you want | |||
xinming | timotimo: I know that'll work, Just try to do it the perl6 way. | 20:35 | |
jnthn | The Perl 6 ways is almost never to call pull-one yourself :) | ||
timotimo | you can use Seq, either @a.Seq or Seq.from-iterator | 20:36 | |
jnthn | I can think of like 1 or 2 times in all the (non-core) Perl 6 I've written when it was the best way to do something :) | ||
timotimo | and loop over that | ||
jnthn | Indeed, typically one has a Seq or some other iterable data source and just does a `for` or `map` or one of the numerous other list processing methods | ||
xinming | timotimo: Can you please give an example of @a.Seq? | 20:39 | |
b2gills | A Seq is just a wrapper around an Iterator | ||
m: my @a = 1,2,3,4; for @a.Seq { .say } | 20:40 | ||
camelia | 1 2 3 4 |
||
b2gills | m: my @a = 1,2,3,4; {my \iterator = @a.Seq.iterator; loop {m\ } } | 20:41 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Use of a closing delimiter for an opener is reserved at <tmp>:1 ------> 3y \iterator = @a.Seq.iterator; loop {m\ 7⏏5} } |
||
b2gills | m: my @a = 1,2,3,4; {my \iterator = @a.Seq.iterator; loop {my \pulled = iterator.pull-one; last if pulled =:= IterationEnd; pulled.say } } | 20:42 | |
camelia | 1 2 3 4 |
||
b2gills | I prefer `for @a.Seq { .say }` over that last one, there is a lot less to get wrong | 20:43 | |
Also there is `.grep` and `.map` that works on Seq | 20:44 | ||
jnthn | for @a.Seq { } is just a longer way to write for @a { } though :) | ||
xinming | m: say 15.4.floor(2) | 20:45 | |
camelia | Too many positionals passed; expected 1 argument but got 2 in block <unit> at <tmp> line 1 |
||
xinming | m: say 15.4.floor; | ||
camelia | 15 | ||
timotimo | fwiw | ||
m: say (15.4 - 1).round(2) | |||
camelia | 14 | ||
timotimo | ^- that's just like how you can turn round into floor by subtracting 0.5 from anything | ||
xinming | actually, I'm trying to get 15.4 ? 3 return's 15 | 20:46 | |
timotimo | m: say (15.4 - 1.5).round(3) | ||
camelia | 15 | ||
xinming | 15.4 - (15.4 % 3) | ||
m: 15.4 - (15.4 % 3) | |||
camelia | WARNINGS for <tmp>: Useless use of "-" in expression "15.4 - (15.4 % 3)" in sink context (line 1) |
||
xinming | m: (15.4 - (15.4 % 3)).say; | ||
camelia | 15 | 20:47 | |
xinming | m: (15.4 - (15.4 % 2)).say | ||
camelia | 14 | ||
xinming | I'm thinking wether there is op for this. | ||
:-) | |||
IIRC, there is one already. | |||
b2gills | m: say pi.round( 0.0001 ) | ||
camelia | 3.1416 | ||
b2gills | m: say 15.round(7) | 20:49 | |
camelia | 14 | ||
20:55
phogg joined,
phogg left,
phogg joined,
p6bannerbot sets mode: +v phogg
20:57
Ven` joined,
p6bannerbot sets mode: +v Ven`
21:01
Ven` left
21:08
HaraldJoerg left
21:12
kerframil joined,
p6bannerbot sets mode: +v kerframil
21:15
Kaiepi left,
Kaiepi joined
21:16
p6bannerbot sets mode: +v Kaiepi
21:33
Ven` joined
21:34
p6bannerbot sets mode: +v Ven`
21:38
Ven` left
22:03
gurmble joined,
p6bannerbot sets mode: +v gurmble
22:04
grumble left,
gurmble is now known as grumble
22:09
Ven` joined
22:10
p6bannerbot sets mode: +v Ven`
22:14
Ven` left
|
|||
Xliff | m: my $a = 15.4; say ($a - ($a % 3)).round(3) | 22:15 | |
camelia | 15 | ||
Xliff | That way you don't need the naked 1.4 | ||
m: my $a = 16.6; say ($a - ($a % 3)).round(3) | |||
camelia | 15 | ||
Xliff | xinming ^^ | ||
You can turn that into a sub fairly easily. | 22:16 | ||
m: sub infix:<div2> ($a, $b) { ($a - ($a % $b)).round($b) }; (16.6 div2 3).say | 22:17 | ||
camelia | 15 | ||
Summertime | m: say ('x-0'..*)[20]; say ('x0'..*)[20]; | 22:18 | |
camelia | x-20 z0 |
||
Geth | doc: 3859d61375 | Coke++ | doc/Language/101-basics.pod6 whitespace |
22:32 | |
synopsebot | Link: doc.perl6.org/language/101-basics | ||
22:46
Ven` joined,
p6bannerbot sets mode: +v Ven`,
developers joined,
developers left
22:49
CGML7 joined
22:50
p6bannerbot sets mode: +v CGML7
|
|||
CGML7 | 8,8 0,0 1,1 0,0 8,8 | 22:50 | |
8,8 0,0 1,1 0,0 1,1 0,0 8,8 | |||
8,8 0,0 12,12 8,8 | |||
8,8 12,12 0,0 12,12 8,8 | |||
22:50
Ven` left
|
|||
CGML7 | 8,8 12,12 0,0 12,12 8,8 | 22:50 | |
8,8 12,12 0,0 12,12 8,8 | |||
8,8 12,12 1,1 12,12 0,0 12,12 8,8 | |||
8,8 12,12 1,1 12,12 0,0 12,12 8,8 | |||
8,8 12,12 0,0 12,12 8,8 | |||
8,8 12,12 11,11 12,12 1,1 12,12 8,8 | |||
8,8 12,12 1,1 12,12 11,11 0,0 11,11 12,12 1,1 12,12 8,8 | |||
8,8 12,12 1,1 12,12 11,11 12,12 1,1 12,12 | 22:51 | ||
8,8 12,12 1,1 12,12 11,11 0,0 11,11 12,12 1,1 12,12 | |||
8,8 12,12 1,1 12,12 11,11 12,12 1,1 12,12 | |||
1,0 kloeri: and I'm tired of you guys | |||
1,0 thinking you can ban staff | |||
1,0 when we complain about your spam | |||
Xliff | m: say ('x0'..*)[^5]; | 22:55 | |
camelia | (x0 x1 x2 x3 x4) | ||
Xliff | m: say ('x0'..*)[^14]; | ||
camelia | (x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 y0 y1 y2 y3) | ||
Xliff | m: say 16.6 div 3 | 22:56 | |
camelia | Cannot resolve caller infix:<div>(Rat, Int); none of these signatures match: (Int:D \a, Int:D \b) (int $a, int $b --> int) in block <unit> at <tmp> line 1 |
||
22:56
CGML7 left
|
|||
Xliff | m: say (16.6 div 3) | 22:56 | |
camelia | Cannot resolve caller infix:<div>(Rat, Int); none of these signatures match: (Int:D \a, Int:D \b) (int $a, int $b --> int) in block <unit> at <tmp> line 1 |
||
Xliff | m: say (16.6 / 3) | ||
camelia | 5.533333 | ||
Xliff | m: say (16.6 / 3).floor | ||
camelia | 5 | ||
Xliff | m: say (16.6 % 3) | ||
camelia | 1.6 | ||
Xliff | m: say (16.6 % 3.0) | 22:57 | |
camelia | 1.6 | ||
Xliff | m: say (16.6 div 3.0) | ||
camelia | Cannot resolve caller infix:<div>(Rat, Rat); none of these signatures match: (Int:D \a, Int:D \b) (int $a, int $b --> int) in block <unit> at <tmp> line 1 |
||
22:57
lizmat_ joined
|
|||
Xliff | m: say ((16.6).Rat div 3.Rat) | 22:58 | |
camelia | Cannot resolve caller infix:<div>(Rat, Rat); none of these signatures match: (Int:D \a, Int:D \b) (int $a, int $b --> int) in block <unit> at <tmp> line 1 |
||
22:58
p6bannerbot sets mode: +v lizmat_
|
|||
Xliff | m: my Rat $a = 16.6; my Rat $b = 3; say ($a div $b) | 22:58 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Cannot assign a literal of type Int (3) to a variable of type Rat. You can declare the variable to be of type Real, or try to coerce the value with 3.Rat or Rat(3), or just write the value as 3.0 at <… |
||
Xliff | m: my Rat $a = 16.6; my Rat $b = 3.0; say ($a div $b) | ||
camelia | Cannot resolve caller infix:<div>(Rat, Rat); none of these signatures match: (Int:D \a, Int:D \b) (int $a, int $b --> int) in block <unit> at <tmp> line 1 |
||
Xliff | m: say 15 div 3; | ||
camelia | 5 | ||
Xliff | Why doesn't div coerce FP types to Init? | 22:59 | |
s/Init/Int | |||
23:01
lizmat left
23:22
Ven` joined
23:23
p6bannerbot sets mode: +v Ven`
23:27
Ven` left
23:33
benjikun joined,
Kaiepi left,
p6bannerbot sets mode: +v benjikun
23:38
Kaiepi joined,
p6bannerbot sets mode: +v Kaiepi
23:45
Actualeyes left
23:52
ldunn14 joined,
ldunn14 left
23:58
Ven` joined
23:59
p6bannerbot sets mode: +v Ven`
|