»ö« 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.
u-ou is sleep() thread-safe? 03:24
llfourn m: my $foo = "foo"; my \t = (* =:= $foo); say $foo ~~ t; say t.($foo) # bug? 03:36
camelia False
True
andrzejku hello! 03:40
u-ou hi 03:41
andrzejku john51_ hey 05:05
andrzejku :) 05:55
andrzejku hello?;) 07:01
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
moritz or .^methods(:all) if you also want to include methods from Cool, Any and Mu 07:19
japh__ is rakudo-star 2017-03 coming soon or should we build rakudo without using the rakudo-star pack? 07:29
lizmat japh__: atm I don't think there are immediate plans for a Rakudo Star 2017.03 08:08
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
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
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
El_Che add --rm 09:29
so it does not keep the container around 09:30
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
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
sammers hi #perl6 11:33
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
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
lizmat this feels like a bug to me 11:43
afk&
timotimo definitely not
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
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; }
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
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
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
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
timotimo right. i'm not sure why that feature is in there 14:02
Ulti are there any docs on the new way to do slangs? 14:23
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
perlpilot new way to do slangs? 14:41
Do you mean $*LANG.define_slang() or something else?
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
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
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
lizmat hmmm... 16:40
I think it can actually be shortened to:
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
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
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
[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
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
Geth doc/nom: d463181678 | (Zoffix Znet)++ | doc/Type/IO/Path.pod6
Fix formatting
17:42
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
DrForr o/ 18:10
raschipi \o 18:11
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
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
[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
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 :)
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
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
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
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
DrForr beginner: Cool! Where'd you find out about Perl 6? 19:17
RabidGravy I'm having a brain fail, do multi native subs work? 19:21
masak beginner: welcome! we strive to be unceasingly helpful in here :) 19:22
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 :)
DrForr And there we go, tidying statements done in one helper method and adding two cursor move commands I'd forgotten about. 19:24
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
lizmat pippo: --profile is your friend 19:26
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
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)
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)}
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
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
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
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!
robertle AlexDaniel: I am confused now, but I see where you are going... 20:09
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!
raschipi JAP{Necro}H: Panda is deprecated, have you tried zef? 20:12
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.
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
Zoffix JAP{Necro}H: are you using rakudobrew? 20:17
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
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
Zoffix JAP{Necro}H: run rakudobrew rehash 20:21
AlexDaniel Zoffix: anyway, given that nobody will ever actually need (%a => %b), I don't think it is worth a ticket 20:21
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
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.
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)}
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
RabidGravy but wfm here 20:40
JAP{Necro}H RapidGravy: how I can fix it? 20:42
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 )
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
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)}
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?
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
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
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!
:-)
samcv faster faster faster 21:57
El_Che :) 21:58
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}
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
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
samcv ^ 22:25
user6 timotimo can u give an short example.my scenario is something like this gist.github.com/anonymous/89a26076...39a8690d42 22:31
lizmat AlexDaniel: will have a working .tail(*-N) by tomorrow 22:35
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
user6 timotimo will look into it 22:42
timotimo i'll go to bed. good luck! 22:42
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