»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
Set by moritz on 22 December 2015.
00:00 kst left, kst joined 00:01 Guest76823 left 00:02 Guest76823 joined 00:06 skids joined 00:11 mcmillhj joined 00:15 mcmillhj left 00:18 cyphase left 00:20 Guest76823 left 00:21 perlawhirl joined 00:38 rpburkholder left 00:41 gdonald left 00:42 gdonald joined 00:49 TEttinger left 00:51 TEttinger joined, Actualeyes joined 00:59 perlawhirl left, perlawhirl joined 01:00 perlawhirl left, shdb left 01:05 Guest76823 joined 01:12 vendethiel left 01:13 shdb joined 01:14 vendethiel joined 01:19 astj joined 01:20 perlawhirl joined 01:21 kyan joined, astj left 01:22 astj joined 01:28 jeek joined 01:37 agentzh left 01:38 AlexDaniel left 01:40 cyphase joined 01:46 ilbot3 left 01:47 ilbot3 joined, ChanServ sets mode: +v ilbot3 01:53 Cabanossi left 01:55 Cabanossi joined 02:09 kyan left 02:16 cibs left 02:18 cibs joined 02:23 kyan joined 02:28 Cabanossi left 02:29 Cabanossi joined, noganex joined 02:31 mcmillhj joined 02:32 noganex_ left 02:40 mcmillhj left 02:41 agentzh joined 02:44 labster left 02:45 labster joined 02:48 xtreak joined 03:09 astj_ joined, astj left, xtreak left 03:10 xtreak joined 03:13 khw left, vendethiel left 03:14 xtreak left 03:15 vendethiel joined
u-ou is sleep() thread-safe? 03:24
03:27 xtreak joined 03:28 Cabanossi left 03:29 Cabanossi joined
llfourn m: my $foo = "foo"; my \t = (* =:= $foo); say $foo ~~ t; say t.($foo) # bug? 03:36
camelia False
True
03:38 mxco86 left, andrzejku joined 03:39 BenGoldberg left
andrzejku hello! 03:40
u-ou hi 03:41
03:43 tempuser75545888 joined, tempuser75545888 left 03:44 tempuser6435457 joined, Cabanossi left 03:46 Cabanossi joined 03:53 tempuser6435457 left 04:05 cibs_ joined 04:06 mr-fooba_ joined 04:10 Grauwolf left, Grauwolf_ joined, cibs left, shdb left, synopsebot6 left, lowbro left, mr-foobar left, dalek left 04:17 shdb joined 04:19 lowbro joined 04:25 astj_ left 04:26 wamba joined 04:39 skids left 04:42 hobbs left 04:48 hobbs joined 04:49 curan joined 04:54 astj joined 05:00 Cabanossi left, rurban joined, rurban left 05:02 Cabanossi joined
andrzejku john51_ hey 05:05
05:09 gdonald left 05:10 cpage_ left 05:16 gdonald joined 05:42 cpage_ joined 05:46 wamba left, RabidGravy joined 05:47 Grauwolf_ is now known as Grauwolf 05:53 domidumont joined
andrzejku :) 05:55
05:58 domidumont left, Cabanossi left 05:59 domidumont joined, domidumont left 06:00 domidumont joined 06:01 Cabanossi joined 06:09 someone__ joined 06:11 Actualeyes left 06:13 someone__ left 06:19 perlawhirl left 06:21 notbenh left, perlawhirl joined 06:23 Actualeyes joined 06:26 gdonald left, notbenh joined 06:27 gdonald joined, ChoHag joined 06:28 domidumont left, Guest76823 left 06:32 wamba joined 06:33 japh__ joined 06:35 geekosaur left 06:36 geekosaur joined 06:40 lowbro left 06:41 perlawhirl left 06:42 eater left 06:43 Cabanossi left 06:45 eater joined 06:47 Cabanossi joined, cibs_ is now known as cibs 06:48 darutoko joined 06:55 rurban joined
andrzejku hello?;) 07:01
07:01 dh7320 left
japh__ in perl6 REPL, how would we do something like ruby's object.methods to list available methods/functions? 07:05
huf .^methods? 07:08
07:13 andrzejku left 07:16 movl joined
moritz or .^methods(:all) if you also want to include methods from Cool, Any and Mu 07:19
07:20 parv joined 07:23 rindolf joined 07:26 kyan left
japh__ is rakudo-star 2017-03 coming soon or should we build rakudo without using the rakudo-star pack? 07:29
07:36 domidumont joined 07:37 dh7320 joined, dakkar joined 07:41 zakharyas joined 07:44 wamba left 08:02 jonas1 joined 08:03 duncan_dmg joined, dh7320 left 08:05 domidumont left
lizmat japh__: atm I don't think there are immediate plans for a Rakudo Star 2017.03 08:08
08:13 wamba joined 08:17 xtreak left 08:18 xtreak joined 08:22 xtreak left 08:27 dh7320 joined, salva joined 08:38 xtreak joined 08:43 Cabanossi left 08:46 Cabanossi joined 08:49 lowbro joined, lowbro left, lowbro joined
Ulti my bioinformatics tests are at around 0.8-0.85s so 20% speed up since the 1s mark about 9 months ago 08:50
08:51 ccntrq joined 08:52 Guest17930 joined 08:55 japh__ left
Ulti hoelzro the Docker example where you have: $ docker run -it rakudo-star -e 'say "Hello!"' doesn't work for me I get an error there is no container command -e 09:02
09:04 Guest17930 left 09:05 domidumont joined 09:08 xtreak left
hobbs Ulti: yeah, actually needs to be docker run -it rakudo-star perl6 -e 'say "Hello!"' 09:20
default command only applies when there are no args
09:24 japh__ joined 09:25 kurahaupo joined
El_Che add --rm 09:29
so it does not keep the container around 09:30
09:35 xtreak joined 09:38 japh__ left 09:43 Cabanossi left 09:45 kurahaupo_ joined, kurahaupo left 09:47 kurahaupo joined, Cabanossi joined 09:49 kurahaupo_ left 09:51 kurahaupo left 09:56 ribasushi left, xtreak left 09:57 ribasushi joined 09:59 dh7320 left 10:07 grondilu joined
grondilu how do I check that all elements of a list are unique? Can I do all(@a) == one(@a)? 10:07
I guess I could do [&&] sort(@a) Z== sort(@a).unique but that's no fun 10:08
or @a.unique == @a
jnthn The latter probably makes more sense 10:10
Maybe @a.Set == @a is also an option
grondilu m: for ^100 { my @a = (^100).pick(5); say "oops" unless all(@a) == one(@a) } 10:11
camelia ( no output )
grondilu m: for ^100 { my @a = (^100).roll(5); say "oops" unless all(@a) == one(@a) }
camelia oops
oops
oops
oops
oops
oops
oops
oops
oops
jnthn Thing is, I know the ones involving set and unique are O(n). I've no clue what the junction one might be :) 10:12
Though I suspect quadratic. 10:13
lizmat grondilu: .repeated 10:21
m: my @a = ^10; dd +@a.repeated
camelia 0
lizmat m: my @a = 1,1,2,2,3; dd +@a.repeated
camelia 2
lizmat m: my @a = 1,1,2,2,3; say "does not contain just unique values" if @a.repeated 10:22
camelia does not contain just unique values
10:29 Cabanossi left 10:31 Cabanossi joined
lizmat grondilu: .repeated.Bool will return True as soon as it sees 1 element 10:32
so worst case is that the whole list needs to be examined (and returning False) 10:33
best case you'd know after examining 2 elements
Ulti: good news! :-) 10:34
10:37 wamba left, AndyDee left 10:40 rurban left 10:43 vendethiel- joined 10:44 mxco86 joined, vendethiel left 10:48 xtreak joined 10:51 labster left 10:54 mxco86 left 10:59 xtreak left, Cabanossi left 11:02 Cabanossi joined 11:08 rurban joined 11:18 bjz joined 11:22 wamba joined 11:26 dakkar left
sammers hi #perl6 11:33
11:38 mscha joined 11:39 rurban1 joined
mscha m: for 1..10 { say $^i + $i; } # You can leave out the ^ twigil on repeated use?? 11:39
camelia 2
4
6
8
10
12
14
16
18
20
mscha Saw it in twitter.com/zoffix/status/849924459368779776
timotimo yes, you can
mscha I'm fairly sure this isn't documented. 11:40
timotimo the $^i is a declaration
possibly, yeah
11:40 bjz_ joined 11:41 rurban left
lizmat m: my $i = 42; for 1..10 { say $^i + $i } 11:42
camelia 2
4
6
8
10
12
14
16
18
20
lizmat hmmmm
m: my $a = 42; for 1..10 { say $^i + $a }
camelia 43
44
45
46
47
48
49
50
51
52
11:42 astj left
lizmat this feels like a bug to me 11:43
afk&
timotimo definitely not
11:43 astj joined, bjz left
timotimo { say $^i + $i } is equivalent to -> $i { say $i + $i } 11:43
no bug here
it has to be like this because you can't put $^i into nested blocks and mean the outer $i that you declared with $^i already
m: for ^10 { sub use-it { $^i * 2 }; say $use-it + $^i } 11:45
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$use-it' is not declared. Did you mean '&use-it'?
at <tmp>:1
------> 3for ^10 { sub use-it { $^i * 2 }; say 7⏏5$use-it + $^i }
timotimo m: for ^10 { sub use-it { $^i * 2 }; say use-it() + $^i }
camelia 5===SORRY!5=== Error while compiling <tmp>
Calling use-it() will never work with declared signature ($i)
at <tmp>:1
------> 3for ^10 { sub use-it { $^i * 2 }; say 7⏏5use-it() + $^i }
timotimo m: for ^10 { sub use-it { $i * 2 }; say use-it() + $^i } 11:46
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$i' is not declared
at <tmp>:1
------> 3for ^10 { sub use-it { 7⏏5$i * 2 }; say use-it() + $^i }
timotimo er, of course it has to be mentioned aerly
m: for ^10 { use-it() + $^i; sub use-it { $i * 2 }; }
camelia WARNINGS for <tmp>:
Useless use of "+" in expression "use-it() + $^i" in sink context (line 1)
timotimo m: for ^10 { say use-it() + $^i; sub use-it { $i * 2 }; }
camelia 0
3
6
9
12
15
18
21
24
27
timotimo that's teh one that works
m: for ^10 { say use-it() + $^i; sub use-it { $^i * 2 }; }
camelia 5===SORRY!5=== Error while compiling <tmp>
Calling use-it() will never work with declared signature ($i)
at <tmp>:1
------> 3for ^10 { say 7⏏5use-it() + $^i; sub use-it { $^i * 2 };
timotimo that's the one that doesn't, because now use-it gets $^i applied to its own signature
11:48 astj left
Geth ecosystem: 870fd69713 | (Alexey Melezhik)++ | META.list
Add Sparrowdo::Rvm

Sparrowdo module to install RVM and Ruby - github.com/melezhik/perl6-sparrowdo-rvm
11:49
mscha m: for 1..10 { say $i + $^i; } 11:50
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$i' is not declared
at <tmp>:1
------> 3for 1..10 { say 7⏏5$i + $^i; }
11:51 TEttinger left 11:58 parv left
mscha m: my $i = 42; for ^5 { say ($i, $^i, $i) } 11:58
camelia 5===SORRY!5=== Error while compiling <tmp>
$i has already been used as a non-placeholder in the surrounding block,
so you will confuse the reader if you suddenly declare $^i here
at <tmp>:1
------> 3my $i = 42; for ^5 { say ($i, $^i7⏏5…
mscha m: my $i = 42; for ^5 { say ($^i, $i) } 11:59
camelia (0 0)
(1 1)
(2 2)
(3 3)
(4 4)
mscha Shouldn't this give the same error? ($i is used in the surrounding block.)
moritz the surrounding block is a different scope 12:07
so no
lizmat well, it feels like a WAT to me :-)
timotimo m: my $i = 42; for ^5 { my $i; say $i } # same thing
camelia (Any)
(Any)
(Any)
(Any)
(Any)
moritz that's just how lexical scoping works. 12:08
lizmat agree, but this is not about scoping in my view, but on the visual difference between $i and $^i
I mean, we don't expect $i and $*I ever to be the same thing 12:09
neither do we expect $=i to be the same as $i, yet, with $^i this is suddenly the case
which is a WAT to me
timotimo should clearly be documented in any case
12:23 astj joined 12:27 astj left 12:29 Cabanossi left 12:31 Cabanossi joined 12:35 xtreak joined 12:39 abraxxa left, abraxxa joined 12:55 movl left, movl joined 13:07 mcmillhj joined 13:08 curan left
perlpilot that $^i/$i confusion looks like the documentation should say something like "be careful with auto-declared vars in different scopes" or maybe just "be careful with auto-declared vars" :-) 13:13
I mean, conceivably the same problem exists with $:x and :$x, just not as common. 13:15
lizmat m: { $:x; dd $x }(:666x) # wow, TIL 13:17
camelia Int $x = 666
lizmat perlpilot: yup, same WAT :-) 13:18
having $^i and $:i just as a declaration, and not needing the sigils *later* in the block, feels very much action-at-a-distance to me 13:24
not all blocks are one liners, if your block is quite large, it will be easy to miss a $^i
m: my $i = 42; for ^10 { say $i + $^i } # especially since this *is* caught 13:25
camelia 5===SORRY!5=== Error while compiling <tmp>
$i has already been used as a non-placeholder in the surrounding block,
so you will confuse the reader if you suddenly declare $^i here
at <tmp>:1
------> 3my $i = 42; for ^10 { say $i + $^i7⏏…
lizmat imo, the reader will *always* be confused when these are mixec 13:26
*mixed
13:27 spebern joined 13:38 pmurias joined
perlpilot lizmat: As a small note bolstering your point, when I first started using auto-declared parameters, I thought that's how they were supposed to be used (always with the twigil). It wasn't until I'd been using them for a little while that I realized that $^i was only needed for the declaration and that $i could be used elsewhere. 13:42
13:43 bjz_ left 13:45 Cabanossi left
lizmat m: class A { has $a; method a() { say $!a } } # another confusable 13:47
camelia ( no output )
lizmat m: class A { has $!a; method a() { say $a } } # reverse doesn't work
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$a' is not declared. Did you mean '$!a'?
at <tmp>:1
------> 3class A { has $!a; method a() { say 7⏏5$a } } # reverse doesn't work
13:47 Cabanossi joined 13:53 skids joined 14:01 lucastiagodemora joined
timotimo right. i'm not sure why that feature is in there 14:02
14:05 lucastiagodemora left 14:07 lucastiagodemora joined, lucastiagodemora left, lucastiagodemora joined 14:08 kurahaupo joined, wamba left 14:10 nine_ joined 14:11 Woodi_ joined 14:13 SmokeMachine joined, raschipi joined, sufrostico left, chansen_ joined 14:15 sufrostico joined 14:17 parisba joined, PotatoGim joined, Juerd joined 14:19 sufrostico left 14:21 lowbro left
Ulti are there any docs on the new way to do slangs? 14:23
14:23 salva left
Ulti I want to fix my tests >:3 14:23
Ulti tagged all of his repos today 14:25
MasterDuke Ulti: not sure if there's documentation, but you could look at recent commits for the slangs that have already been fixed; e.g., Slang::Tuxic, Slang::Piersing 14:26
Ulti yeah that counts... use the source etc. 14:27
thanks
14:31 spebern left 14:33 spebern joined 14:39 vike left, spebern left
perlpilot new way to do slangs? 14:41
Do you mean $*LANG.define_slang() or something else?
14:53 raschipi left 15:01 dh7320 joined, dh7320 left, dh7320 joined, mscha left 15:03 itaipu joined 15:06 Nefser joined
hoelzro Ulti: that's really weird - it looks to me like Docker is dropping the ball here 15:11
I'll dig into it
interesting - docker run -it rakudo-star perl6 -e 'say "Hello!"' works fine 15:12
Ulti: ooc, where'd you get that example from? 15:14
15:22 astj joined, cdg joined 15:26 astj left 15:27 st_elmo joined 15:29 Cabanossi left 15:31 Cabanossi joined 15:35 duncan_dmg left 15:37 raschipi joined 15:44 Nefser left 15:46 wamba joined, rindolf left 15:50 sufrostico joined, jonas1 left 16:01 rurban1 left 16:02 sufrostico left 16:05 rindolf joined 16:07 dh7320 left, mcmillhj left 16:09 rurban joined 16:16 domidumont left 16:29 beginner joined
beginner hi 16:30
I would like to write a method that will await for a variable to be set to true.
psuedocode is like this : bool IsSomethingLoading = false SomeData TheData; public async Task<SomeData> GetTheData() { await IsSomethingLoading == true; return TheData; }
how to achieve this in perl6 16:31
raschipi beginner: use a channel
beginner could you detail it 16:32
raschipi Sorry, not a channel, a supply: docs.perl6.org/type/Supply
16:37 dh7320 joined
lizmat isn't this just a promise? 16:37
m: my $p = Promise.new; start { say now; sleep 5; say now; $p.keep }; $p.await; say "done" 16:38
camelia Instant:1491496756.903448
No such method 'await' for invocant of type 'Promise'
in block <unit> at <tmp> line 1
lizmat m: my $p = Promise.new; start { say now; sleep 5; say now; $p.keep }; await $p; say "done"
camelia Instant:1491496769.705420
Instant:1491496774.711416
done
raschipi I understood he wanted that in a loop, passing multiple values. But if it's only once value, yes, returning a promise would do it. 16:39
16:39 domidumont joined
lizmat hmmm... 16:40
I think it can actually be shortened to:
16:41 rurban left
lizmat my @promises = @targets.map: { start { $_.fetch } }; for @promises { .$result } 16:42
raschipi beginner: does it solve your problem? 16:43
Read this: docs.perl6.org/language/concurrency#Promises
beginner while it awaits i dont want the task to sleep.instead it should do some other process 16:44
b2gills Which is the whole point of Promise, Supply, and Channel 16:45
lizmat beginner: the sleep I put in there is just to simulate some load
you don't need that
the start block will schedule to run that code asynchronously 16:46
16:46 raiph left
lizmat whenever it can 16:46
beginner cool...this would help then...Thanks
gfldex melezhik: looks like it's time to move most of META6::bin into a module 16:48
16:54 itaipu left 17:03 mcmillhj joined
lizmat m: say ^10 .pick(*) # beginner 17:07
camelia (4 0 7 3 8 6 1 9 5 2)
lizmat m: await do for ^10 .pick(*) { start { sleep $_; .print } } # sleep sort implementation
camelia 0123456789
17:08 st_elmo left
[Coke] m: await do for ^10 .pick(*) { start { sleep $_ * ⅓ ; .print }} 17:10
camelia 0123456789
[Coke] m: await do for ^10 .pick(*) { start { sleep $_ * ⅓ * ⅓ * ⅓; .print }}
camelia 0123456789 17:11
[Coke] m: await do for ^10 .pick(*) { start { sleep $_ * .0000001; .print }}
camelia 5764310829
[Coke] there we go. :)
Geth doc: b9e692e4da | (Zoffix Znet)++ | doc/Type/IO/Path.pod6
[io grant] Document new IO::Path.extension

  - Now has a means to specify the number of parts in the wanted extension
  - Now has a means to replace an extension with a new one, optionally
   joining it to the filename with a non-'.' joiner
Rakudo impl. github.com/rakudo/rakudo/commit/b1e7a01f87 Tests: github.com/perl6/roast/commit/b23e53eb79
17:14
17:15 st_elmo joined 17:20 espadrine joined 17:21 go|dfish joined 17:22 Alex____ joined 17:23 xtreak left, xtreak joined 17:25 mcmillhj left 17:29 abraxxa left 17:31 zakharyas left 17:37 xtreak left 17:38 Alex____ left, xtreak joined
Geth doc: 34603f7f81 | (Zoffix Znet)++ | doc/Type/IO/Path.pod6
Reformat spacing in code example

To make it a bit more readable and lines a bit shorter, so they look saner on small screen devices
17:40
timotimo META.info has been deprecated(?) for a bit now, right? 17:41
17:41 xtreak left
Geth doc/nom: d463181678 | (Zoffix Znet)++ | doc/Type/IO/Path.pod6
Fix formatting
17:42
17:42 xtreak joined, raschipi left
Geth doc: zoffixznet++ created pull request #1267:
Fix formatting
17:44
doc: d463181678 | (Zoffix Znet)++ | doc/Type/IO/Path.pod6
Fix formatting
doc: bfe3f5a4a9 | (Zoffix Znet)++ | doc/Type/IO/Path.pod6
Merge pull request #1267 from perl6/nom

Fix formatting
doc: bc31a88429 | (Zoffix Znet)++ | doc/Type/IO/Path.pod6
Add missing invocant markers in sig
17:45
17:45 raschipi joined 17:48 xtreak left, lostinfog joined, xtreak joined, robertle joined 17:49 setty1 joined, salva joined 17:56 rurban joined 17:59 andrzejku joined 18:00 rindolf left, mcmillhj joined 18:03 xtreak left 18:04 xtreak joined 18:05 rindolf joined 18:09 cdg left
DrForr o/ 18:10
raschipi \o 18:11
18:11 xtreak left 18:16 AlexDaniel joined 18:17 vike joined 18:27 rurban left
RabidGravy boo! 18:30
DrForr Whah? :)
masak how much of a difference is there really between "undecidable" and "Turing complete"? 18:35
AlexDaniel one is a bot, another one isn't 18:37
geekosaur you can have undecidability without having Turing completeness, but you cannot have Turing completeness without undecidability. 18:38
beginner class A has method A...how to make asynchronous call from class B to method A
geekosaur ...but the systems that model the first tend to be /a priori/ useless
[Coke] masak: en.wikipedia.org/wiki/Turing_degree ? 18:39
masak geekosaur: right, but... anything below Turing complete at least has a shot to be decidable?
DrForr Isn't the former more of a consequence of Turing machines encompassing the Peano postulates?
perlpilot
.oO( I have a BS degree in Turing systems )
masak [Coke]: looks... interesting.
timotimo beginner: how do you mean "asynchronous"? like kick it off into the thread pool?
[Coke] async call: start { do stuff } 18:40
masak m: start say "OH HAI"
camelia ( no output )
masak huh :)
[Coke] m: await start say "oh hai"
camelia oh hai
masak there we go
forgot to be patient :P
m: my $task = start say "OH HAI"; say "waiting"; await $task 18:41
camelia waiting
OH HAI
masak :)
[Coke] so, you declare the async when you call it, not when you declare it, if that helps. 18:42
raschipi m: my $task = start say "OH HAI"; say "waiting"; sleep 3; say "still waiting"; await $task
[Coke] You might want to check out jnthn's awesome sync-safe classes, also:
camelia waiting
OH HAI
still waiting
[Coke] github.com/jnthn/oo-monitors
DrForr briefly considers indent(1.5) to implement GNU's weird half-indent but thinks better of it. 18:43
RabidGravy though doesn't jnthn's OO::Actor do that
18:44 ChoHag left
RabidGravy github.com/jnthn/oo-actors 18:44
beginner class A { method run() { my $i = 0; method generate() { i = 10.rand(); return i; } } } class B{ method run() { my $b = False; my $i = start {.generate()}; await $i; my $x = $i.result; if $x < 10 { $b = True; } } }
[Coke] RabidGravy++
beginner is this correct? 18:45
am getting error "No such method 'generate' for invocant of type 'Any' in block <unit>"...what is the mistake 18:46
18:46 ChoHag joined
[Coke] maybe format it nicely and put it in a gist? 18:46
RabidGravy " my $i = start {.generate()};" 18:47
geekosaur nothing in there says that you want an A
DrForr finally has a real-world test of Perl6::Tidy :)
geekosaur so you get the default which is an Any
RabidGravy calls the method on $_
[Coke] DrForr: what does PT make of that?
DrForr Give me a few seconds :) 18:48
[Coke] kk
DrForr A syntax error :) } class B{.. 18:49
Well, let me put this in a gist :)
beginner gist.github.com/anonymous/3fc0820f...c03ff446ee
DrForr gist.github.com/drforr/794bbe98deb...79ed1d32b3 18:50
That. Rather pleasing actually. 18:51
(that's with default tab settings.)
[Coke] DrForr: ew. 8. :P 18:52
DrForr: why did line 14 get broken?
DrForr: Also, WOO, nifty! :)
DrForr 'my $b =\nFalse;', you mean? 18:53
[Coke] aye. is that preserving part of the original? 18:54
DrForr Preserving in the sense that I'm only changing the whitespace around the scope braces and semicolons, yes. 18:55
I haven't extended it beyond just those, at least for the moment. I wanted to get the looping structure right first. 18:57
18:59 lichtkind joined
beginner is someone looking onto my problem? 18:59
perlpilot beginner: in addition to what RabidGravy and geekosaur said ... if you're just going to immediately await the promise, you're not exactly being asynchronous. 19:00
beginner: oh ... read what those two said above :)
19:02 zakharyas joined
DrForr [Coke]: Thanks. There's actually quite a bit of work going on there. 19:03
beginner yes am aware awaiting immeditely after the promise makes no sense...the point is i need to know how to make a call to the method in another class
lichtkind so much fun
today the prof said prolog is the only language that lets you define your operators
you suspect what followed 19:04
19:04 darutoko left
DrForr I can give you a slide that lets you define Lagrange operators on the Higgs boson :) 19:05
lichtkind im sure prolog doent have that one 19:06
beginner could someone correct the code in gist.github.com/anonymous/3fc0820f...c03ff446ee
perlpilot beginner: you call it either A.generate() or my $a = A.new; $a.generate();
Geth doc: 66382a84ca | (Zoffix Znet)++ | doc/Type/IO/Path.pod6
Fix accidental use of working-name method in example
perlpilot beginner: though, it does look like your generate method is *inside* the run method. You probably don't want that. :-) 19:07
beginner: It looks like you want a state variable (one that retains its value between calls). (And you'll want to add $ as appropriate. you've got a couple of instance where you say i instead of $i) 19:08
19:08 nicq joined 19:10 nicq left
beginner #perlpilot : understood these things...the basic qstn is how to start a asynchrnous call on method A in class A from Class B 19:11
[Coke] if you want to call a method in another class: A.class-method() or A.new.instance-method("an arg") 19:12
so if you want that call to be async: use "start".
skids
.oO(prolog-ing the inevitable?)
[Coke] If you're doing anything remotely complicated, check out OO:Monitors and OO:Actors
perlpilot beginner: and maybe have a look at jnthn.net/papers/2014-apw-objects-c...rrency.pdf 19:14
beginner #coke , #perlpilot : Thanks
19:15 Cabanossi left
beginner and a very silly doubt...how to reply to a particular person in this chat 19:15
perlpilot beginner: usually like this :)
RabidGravy just use their name, most clients highlight :)
beginner Thank u guys 19:16
[Coke] np
perlpilot no worries. That's what #perl6 is here for.
beginner As a beginner am getting enough help here
19:16 darthdeus left 19:17 domidumont left, Cabanossi joined
DrForr beginner: Cool! Where'd you find out about Perl 6? 19:17
19:19 Cabanossi left, Cabanossi joined 19:21 rrauenza joined
RabidGravy I'm having a brain fail, do multi native subs work? 19:21
19:21 pippo joined, Cabanossi left, pippo left
masak beginner: welcome! we strive to be unceasingly helpful in here :) 19:22
19:22 pippo joined
masak (we fail sometimes. but we get up and try again.) :) 19:22
pippo o/ #perl6
RabidGravy I've spent all day being unusually helpful :)
19:23 Cabanossi joined 19:24 TEttinger joined
DrForr And there we go, tidying statements done in one helper method and adding two cursor move commands I'd forgotten about. 19:24
19:25 Cabanossi left
pippo Any body knows why is "my @a .= push: $_.split(';')».trim for $text.lines;" much slower than the equivalent "for $text.lines {…}" version ? 19:25
19:26 Cabanossi joined, rrauenza left, khw joined
lizmat pippo: --profile is your friend 19:26
19:27 alphah joined
gfldex pippo: you don't need any for loop for what you are doing 19:27
pippo lizmat: I'll try that. Thank you. 19:28
gfldex: How can I do that then?
DrForr I'd just use a map{} block. 19:29
gfldex m: my $text = "1;2;3\na;b ;c\n4;5;6 "; my @a = $text.lines».split(';')».trim; dd @a
camelia Array @a = [("1", "2", "3"), ("a", "b", "c"), ("4", "5", "6")]
gfldex you may or may not want to have a .flat 19:30
(or a .Slip)
pippo gfldex: Nice. Thanks.
gfldex m: my $text = "1;2;3\na;b ;c\n4;5;6 "; my @a = $text.lines».split(';')».Slip».trim; dd @a 19:31
camelia Array @a = ["1", "2", "3", "a", "b", "c", "4", "5", "6"]
TimToady pippo: why are you using .= there? 19:32
push doesn't work very well with .=
gfldex pippo: please note that ». is eager, a well places .map (maybe with a .race) may suit you better
TimToady maybe you want (my @a).push: 19:33
alphah Hello P6, I'm having issue with grammar, can't find the right regex, here is the code (more details in comments) gist.github.com/anonymous/e1f7618e...45641ff789
pippo TimToady: that is because I wanted to re-write my for block to fit in one line and and thought that they were equivalent in that they shoud generate the same code under the hood. 19:34
gfldex that's the peril of asking in #perl6. You may get more answers then you may like to. :->
pippo gfldex: There is more than one way… :-)) 19:35
TimToady pippo: I think .= is likely to copy the array every time you push 19:38
push is already mutatational, so you don't need .= to make it doubly so
pippo TimToady: Understood. That is my error and why it is slower. Thank you! 19:39
TimToady s/tata/ta/
yer welcome!
perlpilot alphah: you almost have a good set of test cases in your comments. You might want to turn them into *actual* test cases.
gfldex .oO( Your word mutated, please lower radiation levels! )
pippo :-) 19:40
robertle how do i merge two hashes in a clean way?
perlpilot robertle: what does "merge" mean?
AlexDaniel m: my %a = <a 1 b 2>; my %b = <c 3 d 4>; %a.push(%b); say %a
camelia {a => 1, b => 2, c => 3, d => 4}
AlexDaniel robertle: something like this? ↑ 19:41
gfldex robertle: see docs.perl6.org/type/Hash#method_append
19:41 rurban joined
TimToady I guess tata is in fact a valid base sequence 19:41
ttaggg &
alphah perlpilot: I'm not sure if I understand what youo mean, do you mean to create tests like the tests placed in "t" directory in perl projects? if so I dont think I can do this now, I haven't learned this yet
robertle yes, something like that. I was trying append and push, but failed. I guess because mine are not actual hashes but hash refs? not sure. lie my $a = {a => 1, b => 2} 19:42
AlexDaniel m: my $a = %<a 1 b 2>; my %b = <c 3 d 4>; $a.push(%b); say $a
camelia Use of Nil in string context
in block <unit> at <tmp> line 1
Use of Nil in string context
in block <unit> at <tmp> line 1
{ => (Any), c => 3, d => 4}
AlexDaniel ooops…
m: my $a = %(<a 1 b 2>); my %b = <c 3 d 4>; $a.push(%b); say $a 19:43
camelia {a => 1, b => 2, c => 3, d => 4}
AlexDaniel robertle: it should work anyway. What happens if you do 「say WHAT $a」?
perlpilot alphah: yes, essentially. It's not that hard ... give a couple of minutes and I'll get you started.
alphah Sure thanks 19:44
robertle (Hash)
19:44 dalek joined, ChanServ sets mode: +v dalek
RabidGravy m: my %a = a => 1, b => 2; my %b = c => 3, d => 4; my %c = |%a, |%b; dd %c 19:44
camelia Hash %c = {:a(1), :b(2), :c(3), :d(4)}
19:44 rurban left
AlexDaniel robertle: so that's a hash, should not be a problem 19:44
raschipi Maybe it's itmized? 19:45
itemized*
robertle AlexDaniel: this version combines the values for the same key into an array, is there a way to overwrite it instead?
AlexDaniel robertle: see what RabidGravy said above ↑ 19:47
robertle: his version seems to do exactly that
19:48 ChoHag left 19:49 ChoHag joined 19:50 ChoHag left
robertle totally, that is what I was after! actually I am after a whole array of hashes, planning to use reduce and this... 19:51
19:51 dwarring joined
robertle there is always another new operator to discover... 19:52
AlexDaniel robertle: which one is it in this case? :)
robertle well the prefix flatten to argument list from RabidGravy
gfldex melezhik: META6::bin has been modulified, see github.com/gfldex/perl6-meta6-bin/...-module.p6
AlexDaniel right 19:53
robertle or rather to slip
perlpilot alphah: gist.github.com/perlpilot/67fd0b46...6ba942d5ac 19:55
robertle eh, I don't think I really understand what a slip *is*
alphah perlpilot: checking... 19:56
perlpilot alphah: I didn't really put the valid arch or whatnot in the strings, but if you do that, you should see some of those test start to pass. 19:57
maybe. I didn't really look at the output :) 19:58
alphah perlpilot: yes I'm putting valid values and trying that
AlexDaniel robertle: is it even needed in this case? 19:59
m: my %a = a => 1, b => 2; my %b = c => 3, d => 4; my %c = |%a, |%b; dd %c
camelia Hash %c = {:a(1), :b(2), :c(3), :d(4)}
AlexDaniel m: my %a = a => 1, b => 2; my %b = c => 3, d => 4; my %c = %a, %b; dd %c
camelia Hash %c = {:a(1), :b(2), :c(3), :d(4)}
AlexDaniel m: my %a = a => 1, c => 2; my %b = c => 3, d => 4; my %c = %a, %b; dd %c
camelia Hash %c = {:a(1), :c(3), :d(4)}
perlpilot alphah: anyway, that doesn't help you with your *actual* problems in the grammar, but it does give you a more structured way to test it.
alphah yes I wish I knew that sometime earlier, I was doing all tests manually 20:00
robertle AlexDaniel: right! I somehow thought I had tried *that*, it's quite perl5-ish! 20:01
AlexDaniel robertle: trying to find a ticket for that, by the way…
robertle: although maybe there's none 20:03
perlpilot alphah: A suggestion though ... rather than having all of those optional elements in the TOP token, maybe enumerate all of the valid parses in an alternation.
AlexDaniel I recall somebody complaining about %x = %y, %z
perlpilot alphah: or maybe not *all*, but at least the ones where there's some ordering restriction.
AlexDaniel robertle: the reason why some may prefer to write it in perl 6 like |%a, |%b is here: 20:04
m: my @a = <a b c>; my @b = <1 2 3>; my @c = @a, @b; say @c
camelia [[a b c] [1 2 3]]
perlpilot goes back to work & 20:05
AlexDaniel robertle: so if you say that @c is @a and @b, you just get an array with two elements
hobbs AlexDaniel: simple as do re mi?
AlexDaniel robertle: right! So let's say you don't want that, what can you do?
and this is where you might need slip
m: my @a = <a b c>; my @b = <1 2 3>; my @c = |@a, |@b; say @c 20:06
camelia [a b c 1 2 3]
alphah perlpilot: I can try that as well, However, I tried to understand why look-around assertion work sometimes and other times not,, for example in my code look-around assertions faills for token "arch"
AlexDaniel now, let's say you have the same thing with hashes
20:07 Cabanossi left
AlexDaniel I'd expect it to create a hash with one pair (%a => %b), even if it doesn't really make sense 20:07
m: my %a = <a b c d>; my %b = <1 2 3 4>; my %c = %a, %b; say %c
camelia {1 => 2, 3 => 4, a => b, c => d}
AlexDaniel but no!
20:08 Cabanossi joined
robertle AlexDaniel: I am confused now, but I see where you are going... 20:09
20:09 JAP{Necro}H joined
JAP{Necro}H hi 20:10
AlexDaniel robertle: I was just trying to explain what | does and why you might need it, and why RabidGravy used it even though it is not required in this particular case
JAP{Necro}H: hello!
robertle: sorry if it made things more confusing :)
robertle it is actually helpful, but I need some playing around to digest it... 20:11
JAP{Necro}H I have problems with panda, u can help me?
robertle thanks!
20:11 labster joined
raschipi JAP{Necro}H: Panda is deprecated, have you tried zef? 20:12
20:12 noganex_ joined
AlexDaniel robertle: I've actually found a ticket where this was discussed: rt.perl.org/Ticket/Display.html?id=130870 20:12
JAP{Necro}H how install zef?
samcv if panda works you can do `panda install zef` 20:13
but if it's totally broken
AlexDaniel robertle: Zoffix writes: “If we swap hashes for arrays, then you *don't* mean the contents. You get a self-referential structure … … I'm surprised you don't get the same with hashes. If you give a comma-separated list of stuff, it becomes key-value pairs; yet hashes get special treatment in that regard”
samcv then you'll have to install it manually or something. how did you install panda?
pippo gfldex: I ended up using your suggestion: "my @a = $text.lines».split(';')».trim". Thank you.
20:13 imcsk8 left 20:14 Actualeyes left 20:15 noganex left
JAP{Necro}H panda install zef ==> Fetching zef ==> Building zef ==> Testing zef t/00-load.t ........... ok t/identity.t .......... ok t/utils-filesystem.t .. ok All tests successful. Files=3, Tests=14, 31 wallclock secs ( 0.06 usr 0.00 sys + 29.91 cusr 1.54 csys = 31.51 CPU) Result: PASS ==> Installing zef ==> Successfully installed zef 20:15
but `zef` not work
RabidGravy the place it installed it may not be in your path 20:16
20:16 Zoffix joined
Zoffix JAP{Necro}H: are you using rakudobrew? 20:17
20:17 itaipu joined
dwarring r: class Test { constant X = set < x y >; } 20:18
camelia ( no output )
Zoffix AlexDaniel: fwiw, lizmat++'s fixes to the hash thing also fixed my %h .= push: *bunch of pairs* construct, I believe, so there may be a deeper reason for specialized behaviour 20:19
JAP{Necro}H Zoffix, yeap, rakudo
dwarring ...
Zoffix JAP{Necro}H: erm, rakudo is not same as rakudobrew :/
JAP{Necro}H: run rakudobrew rehash
20:20 cdg joined
AlexDaniel Zoffix: quite possibly. But as a user, I find it a bit inconsistent and weird 20:20
JAP{Necro}H rakudobrew, yes
i used rakudobrew
20:20 gdonald left
Zoffix JAP{Necro}H: run rakudobrew rehash 20:21
20:21 gdonald joined
AlexDaniel Zoffix: anyway, given that nobody will ever actually need (%a => %b), I don't think it is worth a ticket 20:21
20:21 imcsk8 joined
gfldex lolibloggedagain: gfldex.wordpress.com/2017/04/06/mo...he-things/ 20:21
Zoffix JAP{Necro}H: you're supposed to run that after installing any binaries, of which zef is one. In the future, don't install panda, run rakudobrew build-zef to install zef instead 20:22
JAP{Necro}H Zoffix: its how?
Zoffix JAP{Necro}H: type in your terminal: rakudobrew rehash
JAP{Necro}H: it updates the shims for binaries
JAP{Necro}H Updating shims
Zoffix JAP{Necro}H: OK. Noe zef works 20:23
*now
JAP{Necro}H yes. works! 10q
Zoffix Sweet!
Zoffix flies away into the sunset
20:23 Zoffix left
raschipi JAP{Necro}H: did you understand the instructions to avoid this happening in the future again? 20:24
JAP{Necro}H i can removed panda is now?
raschipi Keep it for a while to test zef 20:25
DrForr JAP{Necro}H: Or just not use it.
20:26 andrzejku left
JAP{Necro}H for panda have a command: `panda installdeps .` for zef this command too works? 20:26
or analog please 20:27
RabidGravy zef install --depsonly
lizmat m: my %h = a => 42; dd %h => %h # AlexDaniel: this seems to work ? 20:28
camelia ({:a(42)}) => {:a(42)}
20:29 Actualeyes joined
JAP{Necro}H RabidGravy: output: Usage: /root/.rakudobrew/bin/../moar-nom/install/share/perl6/site/bin/zef [--force] fetch [<identities> ...] -- Download specific distributions /root/.rakudobrew/bin/../moar-nom/install/share/perl6/site/bin/zef [--force] test [<paths> ...] -- Run tests /root/.rakudobrew/bin/../moar-nom/install/share/perl6/site/bin/zef [--force] build [<paths> ...] -- Run Build.pm /root/.rakudobrew/bin/../moar-nom/insta 20:29
AlexDaniel lizmat: what do you mean by “work”? :)
lizmat: you can create a pair like that, sure
lizmat well, does what I expected it to ? 20:30
AlexDaniel lizmat: well, the biggest point there was that this:
m: m: my @a = <a b c>; my @b = <1 2 3>; my @c = @a, @b; say @c
camelia [[a b c] [1 2 3]]
RabidGravy JAP{Necro}H, well you need to supply a module name or path
AlexDaniel m: my %a = <a b c d>; my %b = <1 2 3 4>; my %c = %a, %b; say %c
camelia {1 => 2, 3 => 4, a => b, c => d}
AlexDaniel lizmat: and this ↑ is not really consistent 20:31
lizmat ah, that
AlexDaniel lizmat: so for hashes, %c = |%a, |%b and %c = %a, %b work identically
lizmat: but not for arrays
lizmat I guess that's one for TimToady 20:32
I could argue either way
AlexDaniel lizmat: that said, hash keys are strings anyway, right? So nobody will ever need %c = %a, %b to behave like that anyway
lizmat hash keys can be any object in object hashes
AlexDaniel oh right, right 20:33
right… then I don't know
m: my %a = <a b c d>; my %b = <1 2 3 4>; my %c{Hash} = %a => %b; say %c 20:34
camelia {{a => b, c => d} => {1 => 2, 3 => 4}}
AlexDaniel m: my %a = <a b c d>; my %b = <1 2 3 4>; my %c{Hash} = %a, %b; say %c
camelia Type check failed in binding to parameter 'key'; expected Hash but got Str ("a")
in block <unit> at <tmp> line 1
lizmat yeah, that's because of the implicit flattening 20:35
m: my %a = <a b c d>; my %b = <1 2 3 4>; my %c{Hash} = $%a, $%b; say %c
camelia {{a => b, c => d} => {1 => 2, 3 => 4}}
JAP{Necro}H RabidGravy: this is good? or ... pastebin.com/YfwkEs2C 20:36
I want install LWP:Simple 20:37
RabidGravy well that's "good", the test is failing 20:38
20:40 raschipi left
RabidGravy but wfm here 20:40
JAP{Necro}H RapidGravy: how I can fix it? 20:42
20:43 skids left
RabidGravy I'd suggest trying again, the test doesn't fail for me 20:44
JAP{Necro}H maybe removed rakudobrew and reinstall again? 20:45
RabidGravy nothing to do with it
AlexDaniel lizmat: meh… I don't know. I created a ticket anyway: RT #131111 20:46
lizmat AlexDaniel++
AlexDaniel ( rt.perl.org/Ticket/Display.html?id=131111 )
20:47 mcmillhj left 20:50 duncan_dmg joined, zakharyas left 20:54 duncan_dmg left 21:01 bjz joined 21:02 aindilis joined 21:04 setty1 left
gfldex I have a Hash like {"general.timeout" => "60", "helper.git" => "git"} and want to break that into a multidim Hash that allows %h{'general';'timeout'}. Any simple way to do that? 21:08
21:09 RabidGravy left, alimon left 21:12 pippo left
gfldex might be a usecase for a semilist slippy. Sadly those are NYI. 21:13
m: my %h{||<general timeout>} = 60; 21:14
camelia Odd number of elements found where hash initializer expected:
Only saw: 60
in block <unit> at <tmp> line 1
gfldex m: my %h; %h{||<general timeout>} = 60; dd %h;
camelia Hash %h = {:general(60), :timeout(Any)}
21:17 pippo joined 21:18 pippo left 21:20 sufrostico joined 21:21 wamba left
AlexDaniel m: my %z; my $x = a => (b => 42); %z{$x} = 42; dd %z 21:23
camelia Hash %z = {"a\tb\t42" => 42}
AlexDaniel why is it like this
m: my %z; my $x = (a => ‘b’) => 42; %z{$x} = 42; dd %z
camelia Hash %z = {"a\tb\t42" => 42}
AlexDaniel O_o
gfldex m: my %h; %h<general.timeout> = 60; dd %h; dd do for %h.kv -> $k, $v { ([=>] $k.split('.')) => $v; };
camelia Hash %h = {"general.timeout" => 60}
((:general("timeout")) => 60,)
gfldex Perl 6++ 21:24
AlexDaniel gfldex: wait, what's ++ about it here?
21:25 dh7320 left
lizmat sometimes I wish we could do @a.head(*-1) 21:28
gfldex AlexDaniel: mostly that I can do [=>] to avoid recursion
lizmat as in: iterate over all elements but the last
21:28 dh7320 joined 21:29 beginner left
AlexDaniel lizmat: as in @a[^(*-1)] ? 21:30
lizmat AlexDaniel: yup 21:34
AlexDaniel lizmat: that'd be more readable indeed
JAP{Necro}H all good, all works. thank alls 21:36
21:38 astj joined 21:39 cpage_ left 21:42 astj left, dh7320 left 21:44 bjz left 21:47 bjz joined 21:48 rurban joined
samcv trialing something to make normal string indexing 2.2x faster 21:48
well it works. but only availible on systems with glibc. so gonna keep it in my own branch until it is all sorted out 21:49
fun stuff
El_Che lizmat has speed-it-up! followers :) 21:53
lizmat whee!
:-)
21:56 bjz left
samcv faster faster faster 21:57
El_Che :) 21:58
22:00 hobbs left 22:08 cpage_ joined 22:10 beginner joined, gdonald left, lucastiagodemora left 22:11 gdonald joined 22:14 lucastiagodemora joined
gfldex m: my @a = 1,2,3; my %h; %h.push :{ ([=>] @a) => 42 }; dd %h; 22:17
camelia ===SORRY!===
Cannot find method 'has_compile_time_value' on object of type NQPMu
gfldex m: my @a = 1,2,3; my %h; %h.push: :{ ([=>] @a) => 42 }; dd %h;
camelia Hash %h = {"1\t2\t3" => 42}
22:17 beginner left 22:18 beginner joined, beginner left 22:19 user6 joined
user6 how to do await over an boolean variable 22:19
timotimo you mean wait for a variable's value to be changed? 22:21
user6 yes 22:22
timotimo either you poll it as often as you'd like, for example once a second or a hundred times a second 22:24
22:24 skids joined
timotimo or you put in something that'll signal when it changes 22:24
i wouldn't do either of those things and just use a promise instead if you can
22:24 hobbs joined, hobbs left, hobbs joined
samcv ^ 22:25
22:26 itaipu left, agentzh_ joined 22:27 agentzh left 22:29 rurban left
user6 timotimo can u give an short example.my scenario is something like this gist.github.com/anonymous/89a26076...39a8690d42 22:31
22:33 mr-fooba_ left, st_elmo left
lizmat AlexDaniel: will have a working .tail(*-N) by tomorrow 22:35
22:36 bjz joined
lizmat still thinking on how to work the Array.tail and List.tail cases into this picture 22:38
timotimo oh, you'll want semaphores for that
lizmat but the basic iterator is there now
timotimo github.com/jnthn/oo-monitors - but you can use this, it'll give you what you want, i think 22:39
lizmat good night, #perl6!
timotimo user6: you'll want the "condition variable" part of that module
22:41 bjz left
user6 timotimo will look into it 22:42
22:42 pmurias left
timotimo i'll go to bed. good luck! 22:42
22:53 bjz joined 22:54 cdg left 23:01 kurahaupo left 23:07 bjz left 23:10 kurahaupo joined 23:20 espadrine left, ChoHag joined 23:22 BenGoldberg joined 23:28 lostinfog left, AndyDee joined 23:33 user6 left 23:36 sammers left, bjz joined 23:40 imcsk8 left 23:41 sammers joined 23:45 rindolf left 23:46 bjz left 23:47 kurahaupo_ joined, imcsk8 joined 23:48 kurahaupo left 23:53 kurahaupo_ left
BenGoldberg u-ou, Just in case noone answered between last night and today, yes, sleep() is thread-safe... *however* it causes the OS-level thread to actually go to sleep, which is not always what you want. 23:55
You are recommended to use: await Promise.in($seconds) instead, as this tells perl6's scheduler to suspend just the current task, and either gives the current OS-level another task or puts it into the thread pool. 23:57