»ö« 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.
El_Che [Coke]: news.ycombinator.com/item?id=15625311 00:17
[Coke]: ah you meant his source. Got it slightly too late :) 00:18
timotimo chimed in on a few of the stackoverflow questions linked to from the weekly 00:42
comborico1611 m: my %test = (one => uno, two => dos); 01:34
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routines:
dos used at line 1. Did you mean 'cos'?
uno used at line 1. Did you mean 'UNDO'?
comborico1611 m: my %test = (one => 'uno', two => 'dos'); 01:35
camelia ( no output )
comborico1611 m: my %test = ('one' => uno, 'two' => dos);
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routines:
dos used at line 1. Did you mean 'cos'?
uno used at line 1. Did you mean 'UNDO'?
comborico1611 I see. 01:36
geekosaur => autoquotes the left side on the assumption that it wants to be a string key, but not the right 01:39
comborico1611 Hmm.
geekosaur if you want quoting of both, use a list initializer with <> or <<>> quoting
m: my %test = <one uno two dos>; say %test<two> 01:40
camelia dos
comborico1611 What about with quoting?
geekosaur m: my %test = «one "uno una" two dos»; say %test<one> 01:41
camelia uno una
geekosaur although I'm not sure what you're asking tbh
comborico1611 Weird. I just didn't know what quoting was. I don't think it is discussed in the book I'm reading. 01:44
I'll check it out on docs.
geekosaur the docs aren't as easy to understand as they ought to be, when it comes to quoting. you have to search for « » (or the long form << >>, it's hidden under qqww 01:46
comborico1611 K. Thanks!
comborico1611 This one is the craziest: 01:50
m: my $a = "1 2";
say qqww{"$a" $a}.perl
camelia ( no output )
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/fpPSFKlofK
Variable '$a' is not declared
at /tmp/fpPSFKlofK:1
------> 03say qqww{"08⏏04$a" $a}.perl
comborico1611 m: my @a = 'a' .. 'c'; 02:05
camelia ( no output )
geekosaur m: my $a = "1 2"; say qqww("$a" $a).perl 02:17
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in argument list; couldn't find final ')' (corresponding starter was at line 1)
at <tmp>:1
------> 3my $a = "1 2"; say qqww("$a"7⏏5 $a).perl
expecting any of:…
geekosaur m: my $a = "1 2"; say qqww{"$a" $a}.perl 02:17
camelia ("1 2", "1", "2")
geekosaur right, can't do parens there
geekosaur that works much the same way shell quoting does 02:18
comborico1611 What are the braces denoting that the parens aren't? { } Is more subscripty 02:20
?
geekosaur if you use parens, it's read as a function call instead of a quote
comborico1611 I see. 02:21
geekosaur m: sub qqww (Str $a) { say "hi, " ~ $a }; qqww("a"); say qqww{"a"}
camelia 5===SORRY!5=== Error while compiling <tmp>
Calling qqww() will never work with declared signature (Str $a)
at <tmp>:1
------> 3$a) { say "hi, " ~ $a }; qqww("a"); say 7⏏5qqww{"a"}
comborico1611 What about with <> instead of braces?
geekosaur whoops
that would also work
comborico1611 Brackets? 02:22
I would type, but I'm on my phone.
geekosaur the names used for things vary by region, sadly. I use () = parens, [] = brackets. {} = braces
comborico1611 I use the same.
geekosaur but lots of places do that differently
geekosaur anyway parentheses are special because anything can be used as a function with them. other paired brackets, or repeated non-paired things (e.g. qqww|foo bar| or even qqww,foo bar,) can be used with it 02:25
comborico1611 They need a smiley for "went over my head". 02:27
And I'm losing brain power as the night goes on.
I'm going to rest. Goodnight, geekosaur. 02:28
raiph .tell samcv fyi: stackoverflow.com/questions/471422...-in-perl-6 03:10
yoleaux raiph: I'll pass your message to samcv.
ryn1x_ I just set up a new Ubuntu box and can't install anything with zef... Not sure if it an issue with zef or my new ubuntu install... anyone familiar with this error?: Failed to create directory '/home/ryn1x/.perl6/precomp/531476C94944C40F030060AEB60539343668769B.1510010703.49446/C3' with mode '0o777': Failed to mkdir: 13 03:49
geekosaur 13 is ENOENT. what components of that path exist and what are their permissions? 03:53
(there's some open moarvm tickets for various failure modes from its mkdir-path) 03:54
ryn1x_ precomp has permissions: drwxrwxr-x 04:01
that long dir does not exist but others with a similar naming convention fo^Hdo^H^H^Hdo 04:02
^H^H^H^H^H^H^H^H^Hdo* 04:03
geekosaur guess I should have been more explicit 04:04
(a) permissions includes ownership as the first two rwx mean nothing without knowing the owner/group of the file/dir
(b) permissions in particular of the last component of the path that exists.
wander How about the new `$/`? IIRC old style `method TOP($/)` should be modified for new `$/` 04:16
ryn1x__ geekosaur: the last dir that exists, precomp, has my current user as the owner 04:26
ryn1x__ So I just removed the version of rakudo-star that I built from source and installed the packaged version of rakudo and zef works fine now on ubuntu 16.04. 05:09
wander .ask moritz How about the new `$/`? IIRC old style `method TOP($/)` should be modified for new `$/` 06:21
yoleaux wander: I'll pass your message to moritz.
moritz wander: see github.com/rakudo/rakudo/issues/1235 for a discussion 06:26
yoleaux 06:21Z <wander> moritz: How about the new `$/`? IIRC old style `method TOP($/)` should be modified for new `$/`
wander gotcha
finanalyst p6: my @list='name',; say 'name' ne @list 06:31
camelia False
finanalyst shouldn't this be 'True'
p6: my @list='name',; say 'name' ne any @list
camelia False
finanalyst forget question 06:32
wander .tell [Coke] I find after perl6/Pod-To-HTML#26, you cannot write pod6 inside `=begin Html...=end Html`, this cause messy code at homepage of the doc site 06:53
yoleaux wander: I'll pass your message to [Coke].
wander .ask [Coke] what do you mean saying "=begin Html doesn't emit raw HTML"? Does it mean that every thing inside Html block should be raw Html code? 06:54
yoleaux wander: I'll pass your message to [Coke].
wander .tell [Coke] if so, then what we should do is remove pod6 code inside Html block of homepage. otherwise, if you mean after parse the code inside, Html block should not add redundant <p> tag, then we can hardcode to remove it, because extra <p></p> is always at both ends of returning Str 06:57
yoleaux wander: I'll pass your message to [Coke].
wander well, not only both ends 07:30
however, the first thing is to make sure which 'raw HTML' we want 07:32
ZzZombo m: use Data::Dumper;my $m=Match.new;say Dump($m) 07:36
camelia ===SORRY!===
Could not find Data::Dumper at line 1 in:
/home/camelia/.perl6
/home/camelia/rakudo-m-inst-2/share/perl6/site
/home/camelia/rakudo-m-inst-2/share/perl6/vendor
/home/camelia/rakudo-m-inst-2/share/perl6
CompU…
ZzZombo ah come on
ah 07:37
m: use Data::Dump;my $m=Match.new;say Dump($m)
camelia ===SORRY!===
Could not find Data::Dump at line 1 in:
/home/camelia/.perl6
/home/camelia/rakudo-m-inst-2/share/perl6/site
/home/camelia/rakudo-m-inst-2/share/perl6/vendor
/home/camelia/rakudo-m-inst-2/share/perl6
CompUni…
geekosaur you want dd and it's a built-in 07:43
or the perl method, likewise 07:44
m: my $m = Match.new; dd $m
camelia Match $m = Match.new(list => (), made => Any, pos => 0, hash => Map.new(()), orig => "", from => 0)
geekosaur m: my $m = Match.new; say $m.perl
camelia Match.new(list => (), made => Any, pos => 0, hash => Map.new(()), orig => "", from => 0)
ZzZombo no, it's unreadable with real Match, and I wanted to see if exception I got with `Data::Dump` is reproducible here. 07:45
geekosaur I don't see a Data.Dump 07:46
were you trying to use perl 5's Data::Dumper? I'm not sure that would do much with a perl 6 Match object
ZzZombo No...
geekosaur hm. thought so. only reference to Data.Dump I can find is in my IRC logs from back before the GLR. not much chance it would work, if you managed to dig that up from somewhere 08:12
hasn't been supported in a long time, because it was a workaround for .perl not quite being up to spec back then
lizmat clickbaits p6weekly.wordpress.com/2017/11/06/...tablished/ 08:22
moritz lizmat++
I wonder if Match.gist should replace newlines with ␤ to increase readability 08:23
nine This is hilarious. So it takes a StackOverflow survey that finds that Perl is the most hated programming language to get a HackerNews page where people practically speak absolutely positively about Perl. 08:26
yoleaux 6 Nov 2017 23:22Z <azawawi> nine: Could you please take a look at the rakudo heap corruption bug when setting size to beyond 10k elements github.com/azawawi/perl6-msgpack/b...sgpack.pl6 . Thanks
lizmat nine: yeah, I found that quite ironic as well :-) 08:27
Geth doc: c1a8cd230e | (Alex Chen)++ (committed using GitHub Web editor) | doc/HomePage.pod6
Convert Z<> into <!---->

To clean messy code in homepage.
Besides, code within Html block is assumed to be raw HTML.
If want to mix up pod6 and HTML in one file, separate them into different blocks.
08:32
nine Same is apparently true for reddit.
holyghost timotimo : here's what I started of my simple game kit, pastebin.com/BzEGZfGc 08:57
Geth Pod-To-HTML/emit-raw-HTML: 8d497c2893 | (Alex Chen)++ (committed using GitHub Web editor) | lib/Pod/To/HTML.pm
Html block contains raw HTML code

  *Everything* within a Html block is assuming raw HTML.
Because of the implementation, pod6 syntax will be removed, only its raw text remind. That is, C<code> -> code.
To write C<> within Html block, you can use C&amp;lt;&amp;&gt; ... (17 more lines)
08:59
Pod-To-HTML: W4anD0eR96++ created pull request #28:
Html block contains raw HTML code
09:00
holyghost Some bot should do a timezone based upcon connects and talking, I am not going to write it :-) 09:05
nine .tell azawawi Can't. MsgPack fails its tests on installation: Cannot look up attributes in a MsgPack::Native::msgpack_object type object in method type at /home/nine/.zef/store/perl6-msgpack.git/6c0c3228ef6859a6879c482e846c5ea8942f77cf/lib/MsgPack/Native.pm6 (MsgPack::Native) line 189 09:22
yoleaux nine: I'll pass your message to azawawi. 09:23
wander hey all, any advice on typing unicode such like « and » quickly? especially on mac 09:38
azawawi hi 09:38
yoleaux 09:23Z <nine> azawawi: Can't. MsgPack fails its tests on installation: Cannot look up attributes in a MsgPack::Native::msgpack_object type object in method type at /home/nine/.zef/store/perl6-msgpack.git/6c0c3228ef6859a6879c482e846c5ea8942f77cf/lib/MsgPack/Native.pm6 (MsgPack::Native) line 189
azawawi nine: did you try to install it via zef? what's your dev environment? 09:39
lizmat wander: docs.perl6.org/language/unicode_entry 09:40
nine azawawi: Rakudo version 2017.10-125-g360eb2289 built on MoarVM version 2017.10-56-g68f04144a, zef commit fb9a8bda156e 09:42
azawawi nine: what's your libmsgpack version? it is printed in t/002-version.t 09:43
wander lizmat: oh we have it, thanks ^_^
nine azawawi: libmsgpackc2-2.1.2-1.2.x86_64 09:45
azawawi nine: if you can provide a full tests gist/pastebin... i know it fails on 1.4.2 but 2.1.2 that's new. I tested against it earlier. 09:49
nine azawawi: gist.github.com/niner/deda3a8c239c...5a234449ca 10:09
Grimy p6: say CHECK now - BEGIN now; sub circumfix:«` `» { @_ }; `42` xx 1 10:11
camelia 1.3288373
Grimy Should this be considered a perf bug?
jnthn Well, custom operators need to calculate a new lexer. That said, I'm not immediately sure why a circumfix costs so much more than, say, a postfix 10:15
moritz because they match in term position? 10:17
and there are more possible terms than postfixes, I'd assume
jnthn True, but (unless this got optimized some) I thought the whole lexer was re-calculated (lazily and on demand, though) 10:18
moritz I thought each DFS is re-calculate as needed, but then I'm not deep into that code 10:19
*DFA
wander Anyone familiar with Pod::To::HTML please tell me why this line need `unescape_html`? 10:30
github.com/perl6/Pod-To-HTML/blob/...ML.pm#L351
If we assume text with a Html block is raw HTML, then there is no reason to unescape. 10:32
With unescape action, when we want to type &lt;(raw), it should be &amp;lt;, looks stupid 10:33
eugene_barsky hi 11:12
How to merge two ranges?
I want smth like .say for 1..10 20..30
jnthn m: .say for flat 1..10, 20..30 # like this? 11:13
camelia 1
2
3
4
5
6
7
8
9
10
20
21
22
23
24
25
26
27
28
29
30
jnthn m: .say for (1..10).min .. (20..30).max # or like this?
camelia 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
eugene_barsky thanks! I've done it with flat but thought it should be done easier... 11:14
Then I'll stick to this method. 11:15
Ulti eugene_barsky: how about this: sub merge(Range $a, Range $b) returns Range { return min($a, $b).min .. max($a, $b).max } 11:24
merge might not be the best name there
Ulti obviously if the two ranges are disjoint it doesn't account for that 11:24
wander m: (1..10).&flat: (20..30) # if you like "infix"(fake) 11:27
camelia ( no output )
wander m: say (1..10).&flat: (20..30) # if you like "infix"(fake)
camelia (1 2 3 4 5 6 7 8 9 10 20 21 22 23 24 25 26 27 28 29 30)
wander otherwise I think flat (1..10), (20..30) is concise enough 11:28
wander m: multi sub infix:<+> (Range $a, Range $b) { flat $a.flat, $b.flat }; .say for $a + $b; # or user-defined 11:36
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$a' is not declared
at <tmp>:1
------> 3$b) { flat $a.flat, $b.flat }; .say for 7⏏5$a + $b; # or user-defined
Ulti is the idea to just represent the two ranges? I thought the idea was to have an encompassing single range
surely just a list of ranges is fine 11:37
in the case they are disjoint, the thing then becomes you want an iterator for that thing
RangeList that's iterable job done?
wander m: multi sub infix:<+> (Range $a, Range $b) { flat $a.flat, $b.flat }; .say for (1..10) + (20..30);
camelia 1
2
3
4
5
6
7
8
9
10
20
21
22
23
24
25
26
27
28
29
30
wander m: multi sub infix:<,> (Range $a, Range $b) { flat $a.flat, $b.flat }; .say for (1..10) , (20..30); 11:38
camelia 1
2
3
4
5
6
7
8
9
10
20
21
22
23
24
25
26
27
28
29
30
Ulti wander ok now I give you 1..10, 1..Inf
might be a legit reason like some minus numbers then all natural numbers
Geth Pod-To-HTML/emit-raw-HTML: c73c0a3530 | (Alex Chen)++ (committed using GitHub Web editor) | lib/Pod/To/HTML.pm
Update HTML.pm
11:49
wander m: 2 (elem) 1..10 11:51
camelia WARNINGS for <tmp>:
Useless use of "(elem)" in expression "2 (elem) 1.." in sink context (line 1)
wander m: say 2 (elem) (1..10)
camelia True
ilmari m: say 2 ∊ (1..10) 11:55
camelia 5===SORRY!5=== Error while compiling <tmp>
Confused
at <tmp>:1
------> 3say 27⏏5 ∊ (1..10)
expecting any of:
infix
infix stopper
postfix
statement end
statement modifier
ilmari unicodable6: ∊
unicodable6 ilmari, U+220A SMALL ELEMENT OF [Sm] (∊)
ilmari m: say 2 ∈ (1..10)
camelia True
ilmari unicodable6: element of
unicodable6 ilmari, U+2208 ELEMENT OF [Sm] (∈)
ilmari, U+2209 NOT AN ELEMENT OF [Sm] (∉)
ilmari, 13 characters in total (∈∉∊⋲⋳⋴⋵⋶⋷⋸⋹⟒⫙): gist.github.com/8d19988fa214affdd7...cbe7d28bc9
HoboWithAShotgun m: my @a = 1, 2, 3; say 3|4 ∈ @a; 12:11
camelia any(True, False)
HoboWithAShotgun m: my @a = 1, 2, 3; say "true" if 3|4 ∈ @a;
camelia true
HoboWithAShotgun m: my @a = 1, 2, 3; say "true" if 0|4 ∈ @a; 12:12
camelia ( no output )
HoboWithAShotgun m: my @a = 1, 2, 3; say "true" if 1|2 ∈ @a;
camelia true
HoboWithAShotgun very nice
wander m: grammar { token TOP { <atok> { if $<atok> ~~ /^b/ { make 42; } }} token atok { \w+ } }.parse("abcd").made; 12:18
camelia 5===SORRY!5=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> 3ok> { if $<atok> ~~ /^b/ { make 42; } }}7⏏5 token atok { \w+ } }.parse("abcd").made
expecting any of:
wander m: grammar G { token TOP { <atok> { if self.match($/) { make 42; } }}; token atok { \w+ }; method match($m) { ($m<atok>) ~~ (/^a/) } }.parse("abcd").made.say;
camelia 42
steeznson hello all! I am looking for a project idea using regular expressions that I can use to explore grammars in perl 6. I've been thinking about a crossword clue solver but I'd love to hear some suggestions.
wander parser of a subset of C(or any other language) 12:19
jast convert one syntax to another 12:19
wander that is it 12:20
jast e.g. JSON to XML, something like that
steeznson ah these are good thanks
are the official docs still the best reference point for grammars? 12:21
jast another one, write something that scrapes and parses websites and extracts information from them. of course there are already libraries to do that, but it's a nice and not all too simple thing to play with
wander by the way, our docs of grammar is a little lack, if having question, welcome to here
no :(
steeznson ah well thanks for the ideas and advice, i'll be back if I get stuck.
wander many, many traps/features are not documented yet 12:22
jast well, I've written stuff involving grammars based on the docs, so I'd say it's possible at least :)
wander maybe the best for now :P 12:23
wander m: grammar { token TOP { <atok> { if self.match($/) { make 42; } }}; token atok { \w+ }; method match($/) { ($<atok>) ~~ (/^a/) } }.parse("abcd").made.say; 12:25
camelia Cannot assign to a readonly variable ($/) or a value
in method match at <tmp> line 1
in regex TOP at <tmp> line 1
in block <unit> at <tmp> line 1
wander huh, this's the new $/ 12:26
m: grammar { token TOP { <atok> { if $/<atok> ~~ /^a/ { make 42; } }}; token atok { \w+ } }.parse("abcd").made.say; 12:27
camelia Nil
wander This may be the second worst trap when I was building a miniC parser. 12:29
nine steeznson: you could write a parser for some configuration file format. Could then be used as basis for a configuration tool. I've done this e.g. for Apache and nginx config files and used it for a converter from Apache to nginx. 12:30
steeznson that's a nice idea, could actually save me a lot of time with nginx in the future 12:33
wander rules, which auto-enable :sigspace, maybe causes confusing result too 12:34
only using rules in trivial case would help 12:35
other cases use `token` to make sure it does what you want
p6's grammar(github.com/rakudo/rakudo/blob/mast...ammar.nqp) uses much more tokens than rules 12:38
census2 I'm trying to figure out the download option at another website, and I'm wondering if someone can please help me 13:03
www.clinicaltrials.gov/ct2/results...amp;fund=3
pmurias is there a way to remove a webhook from the github UI? 13:05
pmurias ahh, I just don't have the permission to get to the settings tab on the perl6/nqp repo 13:06
[Coke] pmurias: what do you need removed? 13:09
yoleaux 06:53Z <wander> [Coke]: I find after perl6/Pod-To-HTML#26, you cannot write pod6 inside `=begin Html...=end Html`, this cause messy code at homepage of the doc site
06:54Z <wander> [Coke]: what do you mean saying "=begin Html doesn't emit raw HTML"? Does it mean that every thing inside Html block should be raw Html code?
06:57Z <wander> [Coke]: if so, then what we should do is remove pod6 code inside Html block of homepage. otherwise, if you mean after parse the code inside, Html block should not add redundant <p> tag, then we can hardcode to remove it, because extra <p></p> is always at both ends of returning Str
census hi <[Coke]> 13:09
[Coke] o/ 13:10
El_Che Hi [Coke] 13:12
census2 did you catch my posting before? i'm trying to work with a different website. i'm not sure if it has an API, but it has a .csv. However, I'm struggling to figure out the link to the .csv 13:12
pmurias [Coke]: the appveyor web hook for the nqp repo 13:13
[Coke]: it's just marking commits as failing
[Coke] pmurias: there are two appveyor links. 13:14
... and they appear to be identical? (double checking...) 13:15
so yes, there are 2 things setup to push to PRs&pushes to appveyor. 13:16
[Coke] census2: Sorry, I've not got a lot of time to help you with the project. 13:26
pmurias [Coke]: I guess those appveyor web hooks are causing false fails 13:33
[Coke] but in general, I find dev tools on chrome invaluable for something like this; showing me what resources are going into making the page, and perhaps you can write something to scrape what they're doing. But I would suggest that if you're doing this for a job, that you talk to the website providing the data - they might have an API or some other way for you to get the data you're looking for. 13:35
[Coke] pmurias: ok, I deleted them. 13:45
ZzZombo1 Hey, how can I use default value if no type was passed, but otherwise use that type instead? `x //= default` doesn't work for obvious reasons. 13:51
lizmat ZzZombo1: not sure what you mean, but what's wrong with: 13:53
m: sub a($a = Str) { dd $a }; a; a Int
camelia Str $a = Str
Int $a = Int
ZzZombo1 this is an inline code block though, no argument list 13:54
lizmat m: my $a = -> $b = Str { dd $a }; $a(); $a(Int) 13:56
camelia Block $a = -> $b = Str { #`(Block|65632864) ... }
Block $a = -> $b = Str { #`(Block|65632864) ... }
lizmat m: my $a = -> $b = Str { dd $b }; $a(); $a(Int)
camelia Str $b = Str
Int $b = Int
lizmat a sub is mostly just a block with a name and place to return from 13:56
census hi wander 14:02
wander hi
census i'm struggling with just 1 line of code. the line with my @terms from the .txt file produces an error. however, when i manually do it, there's no error: paste.ubuntu.com/25911080/ 14:06
error is: pastebin.com/pBHxg3BW 14:07
wander () 14:09
perlpilot census: well ... what's different about when you do it "manually" versus when the program does it? 14:11
census perlpilot that 1 line of code 14:12
wander maybe try adding some ()
Guest56405 lizmat: well, but what if I also have another place where I have such a parameter coming from a hash? 14:13
wander installing dependency.. 14:14
perlpilot census: whenever I get into a position where something seemingly innocuous is causing breakage in my code, I go back to first principles and question everything I think I know to get to the bottom of it. So ... start questioning what's in @terms and what is the actual URL that gets passed to get 14:14
wander agree 14:18
I've tested the code, no syntax miss
so it's quite probably that the URL is wrong 14:19
wander delete that line and dd/say what exactly the URL is. 14:21
census wander i figured out the issue 14:24
when there's zero hits and thus no spreadsheet it produces a 404 error
i'm not sure if there's a way to circumvent 404 type errors and just assign them to be a 0 ? 14:25
wander m: my $s; (try $s = die) orelse ($s =42); say $s 14:27
camelia 42
perlpilot census: there's 0 hits for ALS? That's strange :)
census no not ALS
perlpilot 0 hits for a different one
207 hits for ALS
i have an idea 14:28
maybe i can do something like this: www.clinicaltrials.gov/ct2/results...amp;fund=3
so i search for 2 diseases no matter what. and just subtract out the results of ALS each time
perlpilot census: or ... check the result of the get and only spurt if you don't get a 404 (or, better, only spurt if you get a 2xx) 14:30
census perlpilot how would i do that?
perlpilot according to the docs, get returns Failure if the request fails or doesn't return a 2xx HTTP code. So ... check for Failure. 14:32
(or non-Failure really :-)
census perlpilot where do you see this? like there's a value stored in the get ? 14:33
comborico1611 Who is the caller of function2 in this statement? my %hash = function1 function2 'string' ;
perlpilot census: I just read the README for WWW
moritz comborico1611: your own code 14:34
comborico1611 The statement is the caller?
moritz yes
comborico1611 Okay. Thank you. 14:34
moritz this is like my \temp1234 = function2 'string; function1 temp1234
comborico1611 Oh. 14:35
census perlpilot where are you reading this exactly at github.com/zoffixznet/perl6-WWW ? 14:36
perlpilot census: scroll down to where it says "EXPORTED ROUTINES". There's an example for get and the paragraph immediately following says "Returns Failure if request fails or does not return a successful HTTP code." 14:43
census perlpilot where is that stored? 14:44
perlpilot census: color me confused now. What do you mean "stored"?
perlpilot census: you either get back a Str or a Failure. It's up to you to check and decide what to do 14:45
census perlpilot i don't really understand how this code would go down. is there a variable to which the 'failure' string is stored?
cause then i'll write an if statement that's something like if (x=='failure') results = 0; else { }
perlpilot ah ... It's not a string. It's a Failure *type*. So, you might say something like my $result = get "..."; if $result.isa(Failure) { ... } else { ... } 14:47
comborico1611 What is a group of s 14:48
Opp.
comborico1611 What is a group of characters containing a value called? Example, $[ "a", "b", "c" ]. (This expression is occurring within a hash.) 14:50
A group of characters contained in a variable.
moritz an array?
comborico1611 Hmm. Let me look at the code some more and see if an array was declared.. 14:51
perlpilot .tell Zoffix you might want to include a couple of sad-path examples in WWW
yoleaux perlpilot: I'll pass your message to Zoffix.
comborico1611 I don't see an array. Do hashes automatically create arrays?
moritz there's autovivification 14:52
comborico1611 The situation is where there are multiple values for a single key.
moritz m: my %h; %h<a>.push: 'x'; say %h.perl
camelia {:a($["x"])}
comborico1611 lol. That sounds like a Catholic term.
moritz m: my %h; %h<a><b> = 'x'; say %h.perl; # autovivifies a second-level hash 14:54
camelia {:a(${:b("x")})}
census perlpilot thanks! that is totally working for the 0 cases of 404 errors; however, now i'm no longer getting correct answers for the ones that were previously correct 14:56
comborico1611 This doesn't look like what is going on. Yours looks like different kind of manipulation. I'll type the code in a minute.
comborico This is the most code I've typed in here. So, hopefully I get it right. It is kind of strung-out over a few pages in the book. 14:58
holyghost2 Is there someone who wants to comment on my module, I've sent it to [email@hidden.address] it's at gomez.yellowcouch.org/holly6src-1.3.tar.gz ?
comborico m: sub histogram(Str $string) { my %histo; for $string.comb -> $letter { %histo[$letter]++; }; return %histo; }; sub invert-hash( %in-hash) { my %out-hash; for %in-hash.kv -> $key, $val { push %out-hash{$val}, $key; }; return %out-hash; }; my %rev-hist = invert-hash histogram 'parrot' ; say %rev-hist; dd %rev-hist; 15:01
camelia Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5p' (indicated by ⏏)
in sub histogram at <tmp> line 1
in block <unit> at <tmp> line 1
census perlpilot how do i do the spurt correctly? paste.ubuntu.com/25911355/ 15:02
raschipi comborico: use a pastebin next time 15:03
comborico m: sub histogram( Str $string ) { my %histo; for $string.comb -> $letter { %histo{$letter]++; }; return %histo; }; sub invert-hash( %in-hash ) { my %out-hash; for %in-hash.kv -> $key, $val { push %out-hash{$val}, $key; }; return %out-hash; }; my %rev-hist = invert-hash histogram 'parrot' ; say %rev-hist; dd %rev-hist; 15:07
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in subscript; couldn't find final '}' (corresponding starter was at line 1)
at <tmp>:1
------> 3$string.comb -> $letter { %histo{$letter7⏏5]++; }; return %histo; }; s…
comborico m: sub histogram( Str $string ) { my %histo; for $string.comb -> $letter { %histo{$letter}++; }; return %histo; }; sub invert-hash( %in-hash ) { my %out-hash; for %in-hash.kv -> $key, $val { push %out-hash{$val}, $key; }; return %out-hash; }; my %rev-hist = invert-hash histogram 'parrot' ; say %rev-hist; dd %rev-hist; 15:08
camelia {1 => [p a o t], 2 => [r]}
Hash %rev-hist = {"1" => $["p", "a", "o", "t"], "2" => $["r"]}
comborico So there at "1" => $[ ] what is the value variable ($) called that holds multiple characters? 15:09
census thanks perlpilot!! it works :)
comborico Heh, yeah! 15:10
moritz comborico: the [] is an array
moritz and the $ just puts it into scalar context 15:10
comborico So the hash DOES automatically create arrays, right?
moritz the push does
that's the autovification 15:11
ilmari m: my $foo = 42; push $foo, 37; say $foo;
comborico1611 Oh. Very good. Thank you.
camelia Cannot resolve caller push(Int: Int); none of these signatures match:
(Any:U \SELF: |values is raw)
in block <unit> at <tmp> line 1
ilmari m: my $foo; push $foo, 37; say $foo; psuh $foo, 42; say $foo;
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
psuh used at line 1. Did you mean 'push'?
ilmari m: my $foo; push $foo, 37; say $foo; push $foo, 42; say $foo;
camelia [37]
[37 42]
comborico1611 I see. 15:12
comborico1611 raschipi, yeah. I should have just type it in a text editor. Pastebin, right? 15:15
raschipi any pastebin or gist will do 15:16
comborico1611 We're speaking of text editors, though, right?
I would get rakudo moar on my system, but i have an older machine upstairs here that i prefer to use older OS. 15:18
I didn't want to chance using parrot because of unknown incongruities.
Is incongruencies or autovivification the word out the day? 15:21
jdv79 is it correct that die'ing in a thread won't print the error? 15:25
switching to warn and i see it...
jnthn Define "in a thread"
m: Thread.start({ die "oops" }).join 15:26
camelia No exception handler located for catch
at SETTING::src/core/Exception.pm:57 (/home/camelia/rakudo-m-inst-2/share/perl6/runtime/CORE.setting.moarvm:throw)
from SETTING::src/core/control.pm:178 (/home/camelia/rakudo-m-inst-2/share/perl6/runtim…
jdv79 in a start block
jnthn Oh
tyil comborico1611: even with an older OS you can try rakudobrew
jdv79 i threw a CATCH { default { die $_ } } to debug something and that never printed
jnthn Sure, well start returns a Promise 15:27
comborico1611 Thank you. I'll look into that!
jnthn Which will be broken
But if you never await it anywhere then (a) the work may not run to completion before the program ends, and (b) nothing will receive the exception
ilmari m: start { die "aiee" }.result
camelia Tried to get the result of a broken Promise
in block <unit> at <tmp> line 1

Original exception:
aiee
in block at <tmp> line 1
jdv79 oh ok 15:28
ilmari m: await start { die "aiee" }
camelia An operation first awaited:
in block <unit> at <tmp> line 1

Died with the exception:
aiee
in block at <tmp> line 1
jnthn For 6.d, I've been pondering having a start block that is in sink context automatically do a .then(...) that will pull the program down though
(If there's an exception)
callyalater m: my $index = 0; say 'abcdefghij'.subst: /./, 'A', :nth($index+1); $index = 3; say 'abcdefghij'.subst: /./, 'A', :nth($index+1); 15:51
camelia Abcdefghij
abcAefghij
comborico1611 tyil, can you send me a link of where to download a . deb for rakudobrew for Ubuntu 14? A search did not produce. 17:02
tyil I dont think there's debs of it, you just clone the repo and run the script(s) 17:03
comborico1611 Are roles done previously in any other programming language?
tyil github.com/tadzik/rakudobrew
comborico1611 Ty!
(my other question is completely unrelated to what we're talking about.) 17:04
ilmari comborico1611: yes, they originated in Self (called Traits) in 1982
en.wikipedia.org/wiki/Trait_(compu..._languages
dl.acm.org/citation.cfm?doid=966873.806468 # the original Traits paper 17:05
comborico1611 Thank you. 17:05
Ulti I just had a great idea for how to not do an ORM in Perl 6, just have SQL native in the language which abstracts the SQL :S then if the grammar doesnt match you assume someone is putting in some SQL literal at that point 17:21
job done 17:22
everyone is happy
and I dont have to suffer your obscure as hell method chaining verbage thats different between every orm and every programming language
AlexDaniel Ulti: by the way, have you seen github.com/tony-o/perl6-slang-sql ? 17:33
[Coke] I have never worked on a project where something other than raw SQL was preferable. I'm amazed when people find it helpful. 17:55
it==ORM
timotimo perhaps it's there to allow the ORM itself to more easily make sense of the results that are coming back? 18:17
timotimo if you have a raw sql string it'd have to parse the sql itself to find out what it's doing, if you build the query with methods or whatever the orm will know first-hand and can generate the sql at the same time 18:18
i haven't used orms much, though. i think the only orms i've tried were django's own one and sqlalchemy - though django has sqlalchemy now, i believe? 18:19
timotimo bbl
hahainternet [Coke]: they are often useful, i can give you many examples if you care for them 18:26
mspo eh in php world I encounter tons of ad-hoc sql based on partial strings 18:28
and it's quite some spaghetti
ilmari finds DBIx::Class helpful when dealing with ~600 tables and ~1k foreign key relationships across ~20 schemas
several of those being compound foreign keys
hahainternet yes dbic is quite nice
ilmari and some of the schema not being terribly well designed
hahainternet django's ORM is acceptable also
i wrote a translation layer from that to golang
in order to get performance
having the metadata about your schema is valuable 18:29
[Coke] hahainternet: I get that some people find it useful; probably don't bother giving me an example (no time to dig into that now) 18:42
(but if you have one ready, sure.) 18:43
hahainternet [Coke]: i don't have one to hand, but it really isn't 'some people'
it is just a way of encoding the metadata about your structure
if you want to operate on anything indirectly in SQL, you will need something storing this metadata
buggable New CPAN upload: Bailador-0.0.14.tar.gz by UFOBAT cpan.metacpan.org/authors/id/U/UF/....14.tar.gz 19:33
ufobat_ \o/ 19:34
wander ufobat_: could you please should me a picture of website built by Bailador? 19:54
s/should/show
ufobat_ i dont know which one uses it 19:56
bailador.net does, but it's currently down. It is not maintained by me. sorry
wander sad :( 19:58
wander squashable6: next 20:29
squashable6 wander, Next SQUASHathon in 23 days and ≈13 hours (2017-12-02 UTC-12⌁UTC+14). See github.com/rakudo/rakudo/wiki/Mont...Squash-Day
pmurias github.com/tc39/proposal-bigint # bigints are coming to JavaScript :) 20:53
luke Hello 21:14
Guest71897 I'm a Ubuntu user and I'm interested in learning Perl6 21:14
However, I can get Rakudo to install 21:15
Could anyone help me with this?
cannot*
El_Che Hi Guest71897, you can have a look at resources at: perl6.org/resources/
there are some books recomendations there
some of the authors are here :) 21:16
Guest71897 Thanks
El_Che Guest71897: if you're running Ubuntu 17.10, the rakudo version if fine
if something older, have a look here: github.com/nxadm/rakudo-pkg 21:17
if -> is
Guest71897 I'm using 16.04, and I downloaded the 2017.07 release from that repo.
However, I'm not really sure on what to do next
El_Che sudo dpkg -i *.deb 21:18
that will install rakudo in /opt/rakudo-pkg/bin 21:19
the instructions to change the path are in that page (I am the author of that page)
got to go, now. bbl 21:20
stick around people come and go all the time here
Guest71897 Thanks for the help! 21:21
lizmat decommute& 21:23
Guest71897 El_Che: thanks for the help, I got it working now :-) 21:29
HoboWithAShotgun hears scary sounds as he streches his spine 21:59
HoboWithAShotgun m: class X {}; class Foo is X {}; class Bar is X; sub foo returns Array[X] { return @(Foo.new, Bar.new); }; foo 22:26
camelia 5===SORRY!5=== Error while compiling <tmp>
Too late for unit-scoped class definition;
Please use the block form.
at <tmp>:1
------> 3X {}; class Foo is X {}; class Bar is X;7⏏5 sub foo returns Array[X] { return @(Foo
HoboWithAShotgun m: class X {}; class Foo is X {}; class Bar is X {}; sub foo returns Array[X] { return @(Foo.new, Bar.new); }; foo 22:27
camelia Type check failed for return value; expected Array[X] but got List ($(Foo.new, Bar.new))
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1
HoboWithAShotgun m: class X {}; class Foo is X {}; class Bar is X {}; sub foo returns Array[X] { return @(Foo.new, Bar.new).Array; }; foo
camelia Type check failed for return value; expected Array[X] but got Array ($[Foo.new, Bar.new])
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1
HoboWithAShotgun m: class X {}; class Foo is X {}; class Bar is X {}; sub foo returns Array where *.isa("X") { return @(Foo.new, Bar.new).Array; }; foo 22:28
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3class Bar is X {}; sub foo returns Array7⏏5 where *.isa("X") { return @(Foo.new, Ba
expecting any of:
new name to be defined
HoboWithAShotgun m: class X {}; class Foo is X {}; class Bar is X {}; sub foo returns Array where *.all({.isa("X")}) { return @(Foo.new, Bar.new).Array; }; foo
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3class Bar is X {}; sub foo returns Array7⏏5 where *.all({.isa("X")}) { return @(Foo
expecting any of:
new name to be defined
HoboWithAShotgun so how do i tell perl i want an array of things that are all subclasses of X? 22:33
sena_kun m: role A {}; class B does A {}; class C does A {}; my A @rray = B.new, C.new, B.new; 22:39
camelia ( no output )
sena_kun m: role A {}; class B does A {}; class C does A {}; my A @rray = B.new, C.new, B.new; @rray.say;
camelia [B.new C.new B.new]
sena_kun HoboWithAShotgun, like that? ^
m: role A {}; class B does A {}; class C does A {}; my A @rray = B.new, C.new, B.new; @rray.say; @rray.push: 3; 22:40
camelia [B.new C.new B.new]
Type check failed in assignment to @rray; expected A but got Int (3)
in block <unit> at <tmp> line 1
HoboWithAShotgun no, as i tried to do above as a signature 22:41
sena_kun dunno about subclasses though.
sena_kun ah, a signature one. 22:41
HoboWithAShotgun this is my best that works: subset UnitArray of Array where *.grep({ !.isa("Units::Unit") }).elems == 0;
sena_kun what about, give me a second... 22:42
m: sub foo(--> Array[Int]) { Array.new(1,2,3) }; foo(); sub bar(--> Array[Int]) { Array.new(1,2,3,'no') }; bar();
camelia Type check failed for return value; expected Array[Int] but got Array ($[1, 2, 3])
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1
sena_kun m: sub foo(--> Array[Int]) { Array.new(1,2,3) }; foo();
camelia Type check failed for return value; expected Array[Int] but got Array ($[1, 2, 3])
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1
sena_kun eeeeh. 22:43
HoboWithAShotgun that*s better: subset UnitArray of Array where not *.grep({ !.isa("Units::Unit") });
sena_kun ah, ok, I've failed. :/
HoboWithAShotgun not an array of int. that's easy. an array of things that are subclasses of X
here X being Units::Unit 22:44
sena_kun I am assuming I should be able to replace Int with Units::Unit, to be honest.
HoboWithAShotgun that works as the array contains Units::Unit Objects 22:45
sena_kun ugh.
HoboWithAShotgun but it fails when it contains say, Units::Voltage objects
sena_kun well, sorry I couldn't help much then. 22:45
HoboWithAShotgun where Units::Voltage isa Units::Unit 22:46
nah, it's ok. the above is fine.
echo chamber effect ;-)
HoboWithAShotgun i used to have a tortoise for the desk to tell stuff to but it broke 22:46
and it feels weird to talk to a bottle or something :) 22:47
sena_kun it's already 00:48 here, so need to sleep. at least a little bit. 22:48
samcv . 22:50
yoleaux 03:10Z <raiph> samcv: fyi: stackoverflow.com/questions/471422...-in-perl-6
samcv hmm 22:52
rjbs Is Patrick M. ever around here anymore? 22:58
yoleaux 8 Apr 2017 01:12Z <[Coke]> rjbs: github.com/coke/p6-uni
AlexDaniel .seen pmichaud 23:06
yoleaux I saw pmichaud 18 Jul 2017 14:45Z in #perl6: <pmichaud> (Wishing I could get to Amsterdam this year for #yapceu)
AlexDaniel rjbs: ↑ ?
geekosaur that sounds like "not really" 23:10
comborico1611 Three more chapters to go in this book! 23:11
AlexDaniel well, you can still send a pigeon with .tell and hope for the best :)
(although email is probably a better choice in this case)
timotimo if you care about performance, don't isa with a string, HoboWithAShotgun 23:12
you can actually directly .grep(Units::Unit)
because grep uses smartmatch to do its thing
HoboWithAShotgun that's useful. ty 23:13
timotimo two or three years ago i was looking at why some program wasn't performing well, it was because of an isa + string being crazy slow
m: say (1 xx 1000).grep(Rat); say now - INIT now 23:14
camelia ()
0.00517439
timotimo m: say (1 xx 1000).grep(*.isa(Rat)); say now - INIT now
camelia ()
0.0074191
timotimo m: say (1 xx 1000).grep(*.isa("Rat")); say now - INIT now
camelia ()
0.0306595
timotimo still a very noticable difference
especially with a non-match it has to go through the whole mro, of course
it's likely a bit better if the type matches directly, let's see 23:15
m: say +(1 xx 1000).grep(*.isa("Int")); say now - INIT now
camelia 1000
0.0285461
timotimo m: say +(1 xx 1000).grep(*.isa(Int)); say now - INIT now
camelia 1000
0.0067902
timotimo m: say +(1 xx 1000).grep(Int); say now - INIT now
camelia 1000
0.00549737
timotimo that's more than i expected 23:16
HoboWithAShotgun i now have subset UA of List where { $_.grep(Units::Unit).elems == $_.elems }; 23:19
timotimo probably faster than looking for none(Units::Unit) and seeing if that's positive 23:20
perhaps something with .first and the negation would be better? not sure if the grep there uses a count-only thing
if you have negation and check for booleanness, it only has to pull a single value, which means if there's a wrong value somewhere near the beginning it'll immediately reject 23:21
HoboWithAShotgun adds a comment: todo: performance 23:22
rjbs AlexDaniel: Thanks. 23:27
Redrield Is there something that I could add to neovim to get Neomake lints for Perl 6? 23:32