🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku Set by ChanServ on 14 October 2019. |
|||
00:07
patrickz joined
00:11
patrickb left
|
|||
cpan-raku | New module released to CPAN! Red (0.1.4) by 03FCO | 00:20 | |
00:42
sena_kun left
00:43
lucasb left
00:44
patrickz left
00:45
brass left
00:47
johnjohn101 left
00:57
sena_kun joined
01:00
brass joined
|
|||
AlexDaniel | .tell sergot Sorry, I was in the middle of something, not sure if you received my late answer. Basically, you are free to do it if you think it's going to be better, but there's no guarantee that it will in fact be better this way. Now with more people with privs contributing should be easier, but again I can't promise anything :) | 01:01 | |
tellable6 | AlexDaniel, I'll pass your message to sergot | ||
02:01
unicodable6 left,
sourceable6 left,
statisfiable6 left,
reportable6 left,
coverable6 left,
notable6 left,
quotable6 left,
bloatable6 left,
benchable6 left,
releasable6 left,
greppable6 left,
squashable6 left,
nativecallable6 left,
bisectable6 left,
shareable6 left,
committable6 left
02:02
reportable6 joined,
bisectable6 joined,
sourceable6 joined,
coverable6 joined,
shareable6 joined,
nativecallable6 joined
02:03
squashable6 joined,
committable6 joined,
notable6 joined
02:04
benchable6 joined,
greppable6 joined,
statisfiable6 joined,
bloatable6 joined,
unicodable6 joined,
quotable6 joined,
releasable6 joined
02:05
Doc_Holliwood left
02:42
sena_kun left
02:57
sena_kun joined
03:57
evalable6 left,
evalable6 joined
04:25
mahmudov left
04:42
sena_kun left
04:55
sena_kun joined
05:55
sourceable6 left,
coverable6 left,
nativecallable6 left,
quotable6 left,
squashable6 left,
notable6 left,
bloatable6 left,
committable6 left,
releasable6 left,
reportable6 left,
benchable6 left,
shareable6 left,
greppable6 left,
statisfiable6 left,
unicodable6 left
05:56
bisectable6 left,
nativecallable6 joined,
squashable6 joined,
sourceable6 joined
05:57
greppable6 joined,
bisectable6 joined,
notable6 joined,
benchable6 joined,
reportable6 joined,
shareable6 joined,
bloatable6 joined,
statisfiable6 joined
05:58
coverable6 joined,
releasable6 joined,
committable6 joined
05:59
quotable6 joined,
unicodable6 joined
06:25
sauvin joined
06:41
sena_kun left
06:57
sena_kun joined
07:02
epony left
07:05
epony joined
07:19
horsepatat joined
07:45
jmerelo joined
07:50
veesh_ joined
07:52
veesh left,
veesh_ is now known as veesh
|
|||
squashable6 | 🍕 JJ++ submitted a review on pull request “Clarification of item an…”: github.com/Raku/doc/pull/3137#pull...-337975710 | 07:57 | |
🍕🍕🍕 First contribution by JJ++! ♥ | |||
🍕 JJ++ merged pull request “Clarification of item an…”: github.com/Raku/doc/pull/3137 | |||
Geth | doc/master: 4 commits pushed by threadless-screw++, (Juan Julián Merelo Guervós)++ | ||
07:58
Doc_Holliwood joined
|
|||
squashable6 | 🍕 JJ++ wrote a comment on “Cache generated documentation”: github.com/Raku/doc/issues/717#iss...-570495321 | 08:00 | |
Xliff | squashable6: status | 08:11 | |
squashable6 | Xliff, 🍕🍕 SQUASHathon is in progress! The end of the event in 2 days and ≈3 hours. See github.com/rakudo/rakudo/wiki/Mont...Squash-Day | ||
Xliff, Log and stats: gist.github.com/108474be1333314431...d5d36bf800 | |||
tellable6 | hey Xliff, you have a message: gist.github.com/00a174a73f96cac796...92cb67d9d4 | ||
jmerelo | Hum | ||
tellable6 | 2020-01-01T21:40:38Z #raku <tbrowder> jmerelo: ^^^ | 08:12 | |
jmerelo | I think this is just squashable working on autopilot | ||
Xliff | Doesn't look to be a squashathon for this month. | ||
jmerelo: Yep. | |||
jmerelo | .tell tbrowder raku-advent.blog is cool. | 08:14 | |
tellable6 | jmerelo, I'll pass your message to tbrowder | ||
08:17
wamba joined
08:35
wamba left
08:38
xinming_ joined
|
|||
Geth | doc: 107da69ab6 | (JJ Merelo)++ | README.md Clarifies cache closes #717 |
08:39 | |
squashable6 | 🍕 JJ++ closed issue “Cache generated documentation”: github.com/Raku/doc/issues/717 | ||
08:41
xinming left
|
|||
Geth | doc: bdae66fbfe | (JJ Merelo)++ | README.md Some reflow and rewriting |
08:41 | |
08:42
sena_kun left
08:56
sena_kun joined
08:57
scimon joined
|
|||
stoned75 | jmerelo ? | 08:57 | |
jmerelo | yep | ||
stoned75 | an example in doc/language/typesystem had me wondering for a couple of minutes, until I found in this file history a commit from you that now is making me wondering :) | 08:58 | |
jmerelo | stoned75: which one? | 08:59 | |
stoned75 | so if I may disturb you, I would like to have your comments on commit c9539cf2230f45fda3be25637ffa5c8ad469f5da about the enum exemple starting with enum E(<one two>) | ||
jmerelo | m: enum E(<one two>); my @keys = E::.values; say @keys.map: *.enums; | 09:00 | |
camelia | (Map.new((one => 0, two => 1)) Map.new((one => 0, two => 1))) | ||
stoned75 | see how the 'map: *.perl' was rewritten as 'map: *enums' ? | ||
jmerelo | right | 09:01 | |
stoned75 | it seems a bit odd to me. or at least I do not understand the purpose of the example | 09:02 | |
09:02
chloekek joined
|
|||
jmerelo | stoned75: that was more than a year ago. And I should have done that example separately, but I would say that since the example talks about keys _and_ values, the original one just returned keys | 09:02 | |
stoned75 | IC | 09:03 | |
jmerelo | But then it repeats the key-value mapping twice, so... | ||
stoned75 | hum I suppose I don't quite get the 'All of them turn the values into C<Str>' part | 09:04 | |
jmerelo | m: enum E(<one two>); say = E::.values; | 09:05 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Preceding context expects a term, but found infix = instead. Did you make a mistake in Pod syntax? at <tmp>:1 ------> 3enum E(<one two>); say =7⏏5 E::.values; |
||
jmerelo | m: enum E(<one two>); say E::.values; | ||
camelia | (one two) | ||
jmerelo | stoned75: I didn't write that part myself... But I guess it's because what you want is the enum object, not the string equivalent. | ||
m: enum E(<one two>); say E::.values[0] | |||
camelia | two | ||
jmerelo | m: enum E(<one two>); say E::.values[0].enums | ||
camelia | Map.new((one => 0, two => 1)) | ||
jmerelo | m: enum E(<one two>); say E::.values[0].^name | 09:06 | |
camelia | E | ||
jmerelo | m: enum E(<one two>); say E::.values[0].^mro | ||
camelia | ((E) (Int) (Cool) (Any) (Mu)) | ||
stoned75 | oh and btw, do you agree that the () serve no purpose in E(<one two>) ? | 09:07 | |
jmerelo | stoned75: I think that's the thing. E::.values returns the actual objects, of the actual type, E in this case. enums works on the type as well as the instances, so I guess that's the intention docs.raku.org/routine/enums | 09:08 | |
stoned75: right-on, yes. | |||
m: enum E <one two>; say E::.values | 09:09 | ||
camelia | (two one) | ||
jmerelo | stoned75: the thing is that, looking at the context, enums returns key and values for an enum. It's probably a bit misguided to modify the original instead of rewriting from scratch | 09:10 | |
m: enum E <one two>; say E.enums | |||
camelia | Map.new((one => 0, two => 1)) | ||
chloekek | Is there a reliable way to check (mechanically) whether a distribution allows redistribution? There’s of course the license field in META6.json but how reliable is it? | 09:11 | |
I want to mirror all versions of all distributions provided they are free software. | |||
But I’m going through each manually. :þ | 09:12 | ||
stoned75 | jmerelo: ok, thanks for your comments. I'll ponder this a bit more :) | ||
jmerelo | chloekek: I don't think it's even compared with the actual LICENSE file. | ||
chloekek | not going through each manually* | ||
Ah yeah, license files. | 09:13 | ||
jmerelo | stoned75: any time :-) | ||
chloekek | There is probably a Perl or Node.js library that has a function that takes a tarball and returns a license name. | ||
That implements all of the heuristics. | |||
jmerelo | chloekek: github does that. They might have released that thing... | 09:14 | |
chloekek | I’ll give that a try and then fall back to the license field in META6.json. | ||
Thanks. | |||
jmerelo | chloekek: sure :-) | ||
chloekek | I also want to extrac readmes and render them with pandoc. :) | 09:17 | |
stoned75 | hum. how can I get the origin of a method ? | 09:22 | |
lizmat | what do you mean by "the origin of a method| | 09:23 | |
"? | |||
the class it is actually defined in? | |||
stoned75 | I mean which class/role defines it | ||
lizmat | hmmm... | 09:24 | |
m: dd Str.^find_method("Int").package | 09:25 | ||
camelia | Str | ||
lizmat | m: dd Str.^find_method("elems").package | ||
camelia | Any | ||
stoned75 | cool. thanks ! | ||
jmerelo | chloekek: cool! | 09:31 | |
09:33
rindolf joined
09:44
jmerelo left
|
|||
Xliff | m: my @a = <1 2 3 4 5>; @a.splice(0, *, ()); @a.say; | 09:57 | |
camelia | [] | ||
Xliff | m: my @a = <1 2 3 4 5>; @a.WHERE.say; @a.splice(0, *, ()); @a.say; @a.WHERE.say | 10:14 | |
camelia | 140440692970344 [] 140440692970344 |
||
Xliff | m: my @a = <1 2 3 4 5>; @a.WHERE.say; @a.splice(0, *, ()); @a.say; @a.WHERE.say; @a = (); @a.WHERE.say | ||
camelia | 139683972896872 [] 139683972896872 139683972896872 |
||
Xliff | m: my @a = <1 2 3 4 5>; @a.WHERE.say; @a.splice(0, *); @a.say; @a.WHERE.say; @a = (); @a.WHERE.say | 10:15 | |
camelia | 140691319903136 [] 140691319903136 140691319903136 |
||
stoned75 | m: enum E <one two>; say (E.elems, E.^elems) | 10:19 | |
camelia | (1 2) | ||
stoned75 | even if I understand the result, I can't help being a bit troubled by this result :-} | 10:20 | |
E.elems returning 2 would make sense to me. what would break if it was ? | 10:21 | ||
m: enum E <one two>; say (one.^name, one.^elems, E.elems, E.^elems) | 10:24 | ||
camelia | (E 2 1 2) | ||
stoned75 | I'm even more wondering ;-) | ||
ahah. the thing is one and E are of the same type. | 10:25 | ||
chloekek | p6: enum E <one two>; .say for (E:U, E:D) X~~ (E, one) | 10:26 | |
camelia | True False True False |
||
chloekek | p6: enum E <one two>; for (E:U, E:D) X (E, one) -> ($t, $x) { say $t.perl, $x.perl, $t ~~ $x } | ||
camelia | E:UETrue E:UE::oneFalse E:DETrue E:DE::oneFalse |
||
chloekek | Ayy lmao. | 10:27 | |
p6: say 1 ~~ Int:U | |||
camelia | False | ||
chloekek | p6: enum E <one two>; say one ~~ E:U | ||
camelia | False | ||
chloekek | p6: say 1 ~~ Int:D | ||
camelia | True | ||
chloekek | p6: enum E <one two>; say one ~~ E:D | ||
camelia | True | ||
chloekek | I’m confused. | ||
p6: enum E <one two>; say E ~~ E:D | 10:28 | ||
camelia | False | ||
chloekek | p6: enum E <one two>; for (E:U, E:D) X (E, one) -> ($t, $x) { say $t.perl, ' ~~ ', $x.perl, ' = ', $t ~~ $x } | 10:30 | |
camelia | E:U ~~ E = True E:U ~~ E::one = False E:D ~~ E = True E:D ~~ E::one = False |
||
chloekek | p6: enum E <one two>; for (E:U, E:D) X (E, one) -> ($t, $x) { say $t.perl, ' ~~ ', $x.perl, ' = ', $x ~~ $t } | ||
camelia | E:U ~~ E = True E:U ~~ E::one = False E:D ~~ E = False E:D ~~ E::one = True |
||
chloekek | Ah, the order matters. ~~ is not commutative. | ||
moritz | indeed | ||
tellable6 | 2020-01-02T20:24:14Z #raku-dev <lizmat> moritz I thought old ircloge.perlgeek links would be redirected to colabti? | ||
moritz | the matcher/pattern is on the right | ||
chloekek | Which makes perfect sense. | ||
moritz | lizmat: I know of no such plans. But if anybody wants to invest more energy into it, I'm happy to have the irclog.perlgeek.de subdomain be a CNAME to wherver | 10:31 | |
stoned75 | so back to E.elems being 1 and not 2. am I the only one troubled by this ? ;-) | 10:33 | |
or even by the following ? ;-) | 10:34 | ||
m: enum E <one two>; E::.values == E::.keys | |||
camelia | WARNINGS for <tmp>: Useless use of "==" in expression ".values == E::.keys" in sink context (line 1) |
||
stoned75 | m: enum E <one two>; say E::.values == E::.keys | 10:35 | |
camelia | True | ||
chloekek | m: enum E <one two>; say E::.values.perl; say E::.keys.perl | ||
camelia | (E::one, E::two).Seq ("one", "two").Seq |
||
chloekek | With == you check if there are equally many of them. | ||
stoned75 | ah damned. | ||
chloekek | m: enum E <one two>; say E::.values == 2; | 10:36 | |
camelia | True | ||
chloekek | m: enum E <one two>; say E::.values eqv E::.keys; | 10:37 | |
camelia | False | ||
Xliff | m: enum E <one two>; say E::one ~~ E:D | 10:38 | |
camelia | True | ||
Xliff | m: enum E <one two>; say E:D ~~ E::one | ||
camelia | False | ||
Xliff | m: enum E <one two>; say E::one ~~ E::one | ||
camelia | True | ||
Xliff | m: enum E <one two>; say E::two ~~ E::one | ||
camelia | False | ||
stoned75 | m: enum E <one two>; E::.values.values == E::.keys.values | ||
camelia | WARNINGS for <tmp>: Useless use of "==" in expression ".values == E::.keys.values" in sink context (line 1) |
||
stoned75 | m: enum E <one two>; say E::.values.values == E::.keys.values | ||
camelia | True | ||
chloekek | cmp :p | 10:39 | |
or eqv | |||
stoned75 | m: enum E <one two>; say E::.values.values cmp E::.keys.values | ||
camelia | Same | ||
stoned75 | fun with enum | ||
chloekek | m: enum E <one two>; dd E::.values.values, E::.keys.values; | 10:40 | |
camelia | (E::one, E::two) ("one", "two") |
||
chloekek | Oh yeah cmp does string comparison. | ||
m: enum E <one two>; say E::.values.values eqv E::.keys.values; | |||
camelia | False | ||
10:41
sena_kun left
|
|||
chloekek | Oh no it doesn’t. | 10:41 | |
Oh it does sometimes. | 10:42 | ||
“cmp will first try to compare operands as strings (via coercion to Stringy), and, failing that, will try to compare numerically via the <=> operator or any other type-appropriate comparison operator. See also the documentation for the cmp operator.” | |||
It’s leg that does string comparison in every case. | |||
stoned75 | ahah I'm back to my original question ! | 10:43 | |
m: enum E <one two>; say E::.keys.values.map({.perl}) | |||
camelia | ("one" "two") | ||
stoned75 | m: enum E <one two>; say E::.values.values.map({.perl}) | ||
camelia | (E::one E::two) | ||
10:57
sena_kun joined
11:15
wamba joined
|
|||
xinming_ | termbin.com/63e7 <--- In this example, the whenever will always try to wait for result of @channel[0], so we don't need the final `await |@channel` statement. But when I changed `whenever @channel[0]` to `whenever @channel` I'll have to add the final `await @chanenl` thing. Anyone here would clarify this for me please? | 11:16 | |
And also, What is the right way to wait result for multiple channels in an array in this case please? | 11:17 | ||
Also, with `whenever @channel.map(*.receive) {... }` It'll also quite after we receive things once. | |||
So, what is the correct way to listen to multiple channels? I don't think something like for @channel -> $channel { whenever $channel { ... } } is the right perlish way to do this anyway. | 11:18 | ||
s/ 'await |@p' / 'await |@channel' / | 11:20 | ||
the reason I don't think the sollution right is: for @channel -> $channel { ... } This may cause problem when there are too many channels IMHO | 11:22 | ||
11:32
jmerelo joined
11:34
kensanata joined
|
|||
jmerelo | What's the deal with autowatch-test-repo? | 11:39 | |
11:52
mscha joined
|
|||
mscha | m: race for ^10 -> $i { sleep .5-$i/20; say $i } # Any way to pass batch and degree? | 11:53 | |
camelia | 0 1 2 3 4 5 6 7 8 9 |
||
mscha | m: (^10).race(:1batch, :10degree).map(-> $i { sleep .5-$i/20; say $i }); | ||
camelia | 9 8 7 6 5 4 3 2 1 0 |
||
mscha | Is there any way to supply batch size and degree when using race/hyper as a statement prefix? | 11:54 | |
xinming_ | mscha: I don't think so. Maybe someone will give some adverbs to statement prefix. :-) | 11:56 | |
mscha | m: for (^10).race(:1batch, :10degree) -> $i { sleep .5-$i/20; say $i } # doesn't DWIM | 11:58 | |
camelia | 0 1 2 3 4 5 6 7 8 9 |
||
mscha | m: race for (^10).race(:1batch, :10degree) -> $i { sleep .5-$i/20; say $i } # This works for some reason I don't understand | ||
camelia | 9 8 7 6 5 4 3 2 1 0 |
||
xinming_ | mscha: the (^10).race returns discorded result already | 12:00 | |
yea, statement prefix should have someway to be tunnable | 12:01 | ||
mscha | But why do I need `race for (^10).race ...`? | 12:02 | |
xinming_ | We need race for ... | ||
No need the (^10).race | |||
chloekek | m: (^10).race(:1batch, :10degree).map: -> $i { sleep .5-$i/20; say $i } | 12:04 | |
camelia | 9 8 7 6 5 4 3 2 1 0 |
||
chloekek | p6: sub hyperlöb(*@f) { my @r = @f.hyper.map({ &^f(@r) }).lazy }; say hyperlöb({ 1 }, { 2 }, { [+] @^s[0, 1] }) | 12:10 | |
camelia | [...] | ||
chloekek | p6: sub hyperlöb(*@f) { my @r = @f.hyper.map({ &^f(@r) }).lazy }; .say for hyperlöb({ 1 }, { 2 }, { [+] @^s[0, 1] }) | ||
Interesting, recursive lazy hyper seq is not happy. | |||
And camelia doesn’t respond with a timeout either. | 12:12 | ||
p6: sub löb(*@f) { my @r = @f.map({ &^f(@r) }).lazy }; .say for löb({ 1 }, { 2 }, { [+] @^s[0, 1] }) | |||
Ah camelia seems to be stuck. | 12:13 | ||
12:15
camelia left
|
|||
lizmat | info.jetbrains.com/idea-webinar-ja...-2020.html | 12:17 | |
weekly: info.jetbrains.com/idea-webinar-ja...-2020.html | |||
notable6 | lizmat, Noted! (weekly) | ||
lizmat | weekly: news.ycombinator.com/item?id=21943565 | 12:18 | |
notable6 | lizmat, Noted! (weekly) | ||
Xliff | chloekek: You killed camelia! <Insert obligatory South Park response, here> | 12:39 | |
Geth | doc: 1a6e507cca | (Stoned Elipot)++ | doc/Language/typesystem.pod6 Sync enum example with its (original?) intent ... At least as far as I understood it. Also, while here, drop unneeded parentheses in enum construction. |
||
squashable6 | 🍕🍕🍕 First contribution by stoned++! ♥ | ||
jmerelo | stoned75: hum. You have simply restored it to the state before correction. | 12:40 | |
stoned75: see below vvvvv | |||
12:41
wamba left
|
|||
jmerelo | m: enum E <one two>; say E.enums | 12:41 | |
evalable6 | Map.new((one => 0, two => 1)) | ||
jmerelo | I would say that was the original intent... | ||
Or maybe | |||
m: enum E <one two>; say E::.kv | 12:42 | ||
evalable6 | (two two one one) | ||
stoned75 | oh really ? sorry I misunderstood our earlier conversation then | ||
jmerelo | m: enum E <one two>; say E::.keys | ||
evalable6 | (two one) | ||
jmerelo | m: enum E <one two>; say E::.values | ||
evalable6 | (two one) | ||
jmerelo | No, what will not work | ||
this is the one: | |||
m: enum E <one two>; say E.enums | |||
evalable6 | Map.new((one => 0, two => 1)) | ||
12:42
sena_kun left
|
|||
jmerelo | Hum, not that either | 12:43 | |
It's probably OK, stoned. | |||
Forget it. | |||
stoned75 | jmerelo: hum... :-} | ||
jmerelo | If "get a list of types for the keys" means something, I guess the original, or your restored form, is it. | 12:44 | |
E::one is the actual type, so we're good. | |||
stoned75: thanks! | |||
stoned75 | ok great! what I took away is... enum are a bit strange :-} | 12:45 | |
jmerelo | stoned75: the thing is that the first sentence in that paragraph is kind of misleading. | ||
stoned75 | exactly! | ||
also the second sentence says 'values' and the 'third' is about the keys ! | 12:46 | ||
jmerelo | stoned75: maybe it would be better if we completed it with another example that actually returned the values | ||
although that's kinda easy | |||
xinming_ | jmerelo: Do you have time to check about my question? :-) | ||
The whenever @channel { ... } thing | 12:47 | ||
stoned75 | but to get the keys as type we do have to use E::.values :-} | ||
jmerelo | m: enum E <one two>; say ~E::.values[0] | ||
evalable6 | one | ||
jmerelo | xinming_: no, sorry, I didn't | ||
I can add some urgency as a label if it's critical, xinming_ | |||
m: enum E <one two>; say ~E::.values | 12:48 | ||
evalable6 | two one | ||
jmerelo | m: enum E <one two>; say E::.values | ||
evalable6 | (one two) | ||
12:48
camelia joined
|
|||
jmerelo | m: enum E <one two>; say E::.values[0].value | 12:48 | |
well... | |||
camelia | 1 | 12:49 | |
jmerelo | camelia++ | ||
But I don't know what took so long... | 12:50 | ||
stoned75: anyway, maybe I'll add something like the stuff above to clarify | |||
stoned75 | sure ! I admit I'm a bit skeptical, so I look forward to what you'll add :-) | 12:52 | |
jmerelo | stoned75: thanks anyway and as usual, great work :-) | 12:54 | |
stoned75 | my pleasure! | 12:55 | |
12:55
kensanata left
|
|||
xinming_ | jmerelo: not critical, If you are in channel, You can just backlog. I posted not long ago. | 12:55 | |
Maybe 3 or 4 screens | 12:56 | ||
jmerelo | xinming_: you mean this issue, right? github.com/Raku/doc/issues/3136 | ||
xinming_ | Nope | ||
that is the doc issue. | 12:57 | ||
jmerelo | xinming_: OK, let me check then | ||
12:57
sena_kun joined
|
|||
jmerelo | xinming_: you mean this? termbin.com/63e7 | 12:58 | |
xinming_: I'm no expert in concurrency, but I see several things there | 13:01 | ||
13:01
xinming_ left
|
|||
jmerelo | xinming_: (also it would be maybe better if you ask in StackOverflow, where all the experts are) | 13:01 | |
tellable6 | jmerelo, I'll pass your message to xinming_ | ||
13:01
xinming_ joined
|
|||
jmerelo | xinming_: await is here: docs.raku.org/routine/await it waits until a value is available on a channel | 13:02 | |
If you want to listen on several channels, it's better to start several promises that listen to it using whenever | 13:03 | ||
xinming_: the await at the end of the script will actually wait on channel items, not on the promises. You are effectively starting a promise for every element of the channel, when you use start | 13:04 | ||
xinming_: why don't you send stuff to the channel, and process it (using whenever) in a different statement? It will clarify what's going on. | 13:05 | ||
xinming_ | jmerelo: When I use my @p = @channel.map({ start { } }); await |@p await here still await on @channel instead of Promise returned by start ? | 13:07 | |
tellable6 | 2020-01-03T13:01:30Z #raku <jmerelo> xinming_: (also it would be maybe better if you ask in StackOverflow, where all the experts are) | ||
jmerelo | xinming_: in that case, you're mapping channel _items_ to promises, if I'm not wrong. | 13:08 | |
xinming_: let me check | |||
xinming_ | I didn't receive that. | ||
scimon | I'd advise taking a look at react blocks. React blocks are awesome. | ||
docs.raku.org/language/concurrency...ntry-react | 13:09 | ||
xinming_ | scimon: I do read that, and several times. I just now practise to get the idea of it. | ||
jmerelo | xinming_: Channel is an Any, so it's got map. Channel.map will eagerly read the Channel and then map every element to the block, in this case, a promise. | 13:10 | |
xinming_: but scimon is right, react blocks are the way to go... | |||
xinming_ | jmerelo: Actually, What I asked is the differences between whenever @channel and whenever @channel[0] | ||
I do have whenever block in my example. | |||
termbin.com/63e7 | |||
jmerelo | xinming_: whenever is used for react or supply blocks, not for channels. You need to put a react block around that channel to read from it. | 13:12 | |
xinming_: something like react { whenever @channel[0].receive { ... } } | |||
xinming_ | jmerelo: Yea, actually, react { whenever @channel[0] { } } work as `whenever @channel[0].receive` | 13:13 | |
eiro | hello people. | ||
lizmat | eiro o/ | ||
jmerelo | xinming_: ah, OK. | ||
xinming_ | jmerelo: But how do we monitor multiple channels in this case then? | ||
eiro | hug lizmat ! | 13:14 | |
jmerelo | xinming_: do a loop within the react block | ||
xinming_ | I know we can do react { for @channel -> $x { whenever $x { ... } } | ||
jmerelo | xinming_: exactly | ||
xinming_ | jmerelo: But I thought that might not be right to do. as if the @channel is large | ||
scimon | m: my $c = Channel.new;my $p = start react { whenever $c { .say } };$c.send("test");$c.close;await $p;say "done" | ||
camelia | test done |
||
xinming_ | too many subscriptions. | ||
scimon | React blocks totally work on Channels ;) | ||
chloekek | p6: react { for ^10 { whenever Promise.in($_) { .say } } } | ||
camelia | True True True True True True True True True True |
13:15 | |
xinming_ | I thought there maybe a way to whenever on an @array activity | ||
jmerelo | xinming_: you're creating an asynchronous event. It should be really fast, just setting the hook. | ||
xinming_ | I mean a single whenever to react to that @array. | ||
If the for loop is the only, Then, I know that. :-) | |||
jmerelo | xinming_: you can use map if you don't like for... :-) Actually, you should use map always :-) | 13:16 | |
chloekek | Why use map always if TIMTOWTDI? | ||
Xliff | chloekek++ | 13:17 | |
xinming_ | just now, I start to realize that the difference between react { whenever @channel.map(*.receive) { ... } } and react { whenever @channel[0] { ... } } | ||
The *.receive wait every channel returns a single thing, then quit. | |||
jmerelo | chloekek: TIMTOWTDI .. with maps :-) You can use the feed operator, you can use map/reduce, you can use it with grep... | ||
xinming_ | While @channel[0] means whenever will loop on @channel[0].received | 13:18 | |
chloekek | I wish the feed operator let me write ==> map { … } but it crashes. | ||
({ ... }) is ugly. :( | |||
jmerelo | chloekek: right. You need the parenthesis... | ||
chloekek: and reminds us of JavaScript | |||
Xliff | chloekek: why not map: { … }? | 13:19 | |
xinming_ | after I saw so many features builtin in the syntax level, That really makes me feel so happy about using perl. | ||
jmerelo | Xliff: doesn't work well with ==> | ||
13:20
mscha left
|
|||
xinming_ | raku* | 13:20 | |
Xliff | m: @a = <1 2 3>; @a ==> map: { $_ + 2 } ==> @b; @b.say; | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '@a' is not declared at <tmp>:1 ------> 3<BOL>7⏏5@a = <1 2 3>; @a ==> map: { $_ + 2 } ==> |
||
Xliff | m: my @a = <1 2 3>; @a ==> map: { $_ + 2 } ==> @b; @b.say; | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Confused at <tmp>:1 ------> 3my @a = <1 2 3>; @a ==> map:7⏏5 { $_ + 2 } ==> @b; @b.say; expecting any of: colon pair |
||
Xliff | m: my @a = <1 2 3>; @a ==> map: @a, { $_ + 2 } ==> @b; @b.say; | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Confused at <tmp>:1 ------> 3my @a = <1 2 3>; @a ==> map:7⏏5 @a, { $_ + 2 } ==> @b; @b.say; expecting any of: colon pair |
||
Xliff | m: my @a = <1 2 3>; @a.map: { $_ + 2 } ==> @b; @b.say; | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '@b' is not declared at <tmp>:1 ------> 3my @a = <1 2 3>; @a.map: { $_ + 2 } ==> 7⏏5@b; @b.say; |
||
Xliff | m: my @b; my @a = <1 2 3>; @a.map: { $_ + 2 } ==> @b; @b.say; | ||
camelia | [3 4 5] | ||
Xliff | Hrm. | ||
m: my @a = <1 2 3>; @a ==> $_ + 2 ==> @b; @b.say; | 13:21 | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '@b' is not declared at <tmp>:1 ------> 3my @a = <1 2 3>; @a ==> $_ + 2 ==> 7⏏5@b; @b.say; |
||
Xliff | m: my @b; my @a = <1 2 3>; @a ==> $_ + 2 ==> @b; @b.say; | ||
camelia | Too many positionals passed; expected 0 to 2 arguments but got 3 in block <unit> at <tmp> line 1 |
||
jmerelo | Xliff: in some cases precedence will DWIM, but not always. | ||
Xliff | m: my @b; my @a = <1 2 3>; @a ==> { $_ + 2 } ==> @b; @b.say; | 13:22 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Only routine calls or variables that can '.push' may appear on either side of feed operators. at <tmp>:1 ------> 3my @b; my @a = <1 2 3>; @a ==> 7⏏5{ $_ + 2 } ==> @b; @b.say; |
||
Xliff | m: my @b; my @a = <1 2 3>; @a ==> -> $_ { $_ + 2 } ==> @b; @b.say; | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Only routine calls or variables that can '.push' may appear on either side of feed operators. at <tmp>:1 ------> 3my @b; my @a = <1 2 3>; @a ==> 7⏏5-> $_ { $_ + 2 } ==> @b; @b.say; |
||
13:22
Tirifto joined
|
|||
Xliff | Well, I never grok'd the feed op. | 13:22 | |
Something for the future. | |||
jmerelo | Xliff: let's call it rocket | ||
Xliff | Heh. | ||
13:29
lucasb joined
13:34
jmerelo left
|
|||
sarna | hey, how to bind $*IN and $*OUT to something else for testing? I want to have a string in $*IN and read a string from $*OUT | 13:46 | |
(I want to emulate input to `prompt` and check what a function prints) | |||
sena_kun | sarna: can't you just assign it? | ||
sarna | sena_kun: I can! but to what? I can't find that in the docs | 13:47 | |
chloekek | No, you must define it with my: my $*IN = ... or my $*IN := ...; | ||
If you assign it then it will remain that value after returning. | |||
sarna | m: my $*IN = "foo"; $foo = prompt | 13:48 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '$foo' is not declared at <tmp>:1 ------> 3my $*IN = "foo"; 7⏏5$foo = prompt |
||
sarna | "foo".IO wants to get a file called foo :^( | ||
I haven't found a way of making a handle without a file on disk | |||
chloekek | github.com/hoelzro/p6-io-string/ | ||
eiro | my @doubles = * * 2 for 4..8; should rise a warning. worth a gh issue ? | 13:49 | |
chloekek | p6: my $*IN := "A\nB\nC\n"; .say for lines; | ||
camelia | No such method 'nl-in' for invocant of type 'Str' in block <unit> at <tmp> line 1 |
||
chloekek | p6: my $*IN := "A\nB\nC\n" but role { method nl-in { "\n" } }; .say for lines; | ||
camelia | No such method 'encoding' for invocant of type 'Str+{<anon|1>}' in block <unit> at <tmp> line 1 |
||
eiro | camelia: my @doubles = * * 2 for 4..8; @doubles.elems.say | 13:50 | |
sarna | chloekek: thanks, bookmarked! :D |