»ö« 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 mcmillhj joined 00:03 orac1e_ left 00:05 mcmillhj left 00:16 mcmillhj joined 00:22 mcmillhj left 00:38 headcase joined 00:42 headcase left 00:43 titsuki joined 00:45 entonian joined 00:47 skids left 00:49 grondilu joined
grondilu m: say Set().total 00:50
camelia No such method 'total' for invocant of type 'Set(Any)'
in block <unit> at <tmp> line 1
grondilu was expecting 0
00:51 skids joined 00:53 aborazmeh joined, aborazmeh left, aborazmeh joined 00:55 ufobat left 00:59 entonian left 01:06 wamba left 01:15 headcase joined 01:17 wander4096 joined
wander4096 need some help >_< 01:18
what's the difference between method and subroutine in perl 6 docs
01:20 headcase left
geekosaur methods are called on objects; subs are just called 01:20
m: class A { method a { say 'in A::a' } }; sub b { say 'in b' }; my A $x .= new; $x.a; b(); 01:21
camelia in A::a
in b
wander4096 I think so, but see it docs `routine isa` which can be only(?) used as sth.isa(...) 01:22
01:23 dj_goku joined, dj_goku left, dj_goku joined 01:24 headcase joined
geekosaur but the proto says 'multi method isa' 01:25
01:26 dj_goku_ left
geekosaur "routine" is a superclass for both subs and methods (and, quietly, it's possible to call a method as a sub by marking the invocant explicitly) 01:27
m: my Int $a = 5; say isa($a: 'Int')
camelia True
geekosaur the colon there is an invocant marker 01:28
01:28 headcase left 01:29 llfourn joined, headcase joined 01:32 headcase_ joined 01:33 headcase left 01:34 BenGoldberg joined 01:36 headcase_ left
wander4096 ok, so `Str(42:)` can't work but `isa(42: Int)` works, `method Str` and `routine isa` 01:40
01:45 ilbot3 left 01:51 davidfetter left 01:54 markmont joined, ilbot3 joined, ChanServ sets mode: +v ilbot3, wander4096 left 01:57 cuonglm joined 02:00 wander4096 joined 02:01 piojo joined, markmont left 02:05 markmont joined
BenGoldberg m: sub foo { dd callframe(1).code.name }; (sub { foo() }).(); 02:06
camelia ""
02:07 noganex_ joined 02:10 noganex left
wander4096 m: say "test" 02:17
camelia test
02:18 headcase joined 02:20 AlexDaniel left, ipatrol joined
ipatrol if I interpolate one regex into another with <$regex>, how are the groups in the substituted regex addressed? 02:21
02:22 headcase left, wander4096_ joined
ipatrol m: my $reg = /(.)(.)(.)/; my $mat = "abcdefg" ~~ /<$reg>(.)/; say $mat.gist; 02:23
camelia 「abcd」
0 => 「d」
ipatrol m: my $reg = /(.)(.)(.)/; my $mat = "abcdefg" ~~ /<$reg>(.)/; say $0;
camelia 「d」
02:24 wander4096 left
ipatrol m: my $reg = /(.)(.)(.)/; my $mat = "abcdefg" ~~ /(<$reg>)(.)/; say $/; 02:24
camelia 「abcd」
0 => 「abc」
1 => 「d」
02:25
ipatrol m: my $reg = /(.)(.)(.)/; my $mat = "abcdefg" ~~ /(<$reg>)(.)/; say $/[0];
camelia 「abc」
ipatrol m: my $reg = /(.)(.)(.)/; my $mat = "abcdefg" ~~ /(<reg>)(.)/; say $/[0];
camelia No such method 'reg' for invocant of type 'Match'
in block <unit> at <tmp> line 1
ipatrol doesn't preserve it
02:26 AlexDaniel joined
ipatrol m: my regex reg {(.)(.)(.)}; my $mat = "abcdefg" ~~ /(<reg>)(.)/; say $/.gist; 02:27
camelia 「abcd」
0 => 「abc」
reg => 「abc」
0 => 「a」
1 => 「b」
2 => 「c」
1 => 「d」
02:29 llfourn left 02:31 headcase joined 02:34 cdg joined 02:39 cdg left 02:42 greppable6 left, greppable6 joined, ChanServ sets mode: +v greppable6 02:49 Todd joined
Todd Hi All. "Once Upon A time", I found a reference in the documentation as to what the variables were is you wanted to force the issue: Int64, StrD, etc.. I thought I had written it down, but can't find it if I did. I found docs.perl6.org/language/variables but it does not go into the the types of forced variables 02:52
ipatrol m: my $reg = /(.)(.)(.)/; my $mat = "abcdefg" ~~ /$reg(.)/; say $mat.gist; 02:53
camelia 「abcd」
0 => 「d」
b2gills m: my $reg = /(.)(.)(.)/; my $mat = "abcdefg" ~~ /$<reg> = $reg(.)/; say $mat.gist; 02:54
camelia 「abcd」
reg => 「abc」
0 => 「a」
1 => 「b」
2 => 「c」
0 => 「d」
ipatrol b2gills: thanks, though I actually found another way of doing what I wanted 02:59
Todd In `method getc(IO::Handle:D: --> Str:D)` what does the "D" stand for in "Handle"? Never undefined? 03:07
got to go 03:20
03:20 Todd left 03:22 Cabanossi left 03:24 Cabanossi joined 03:35 mst is now known as ninjastealthcat, ninjastealthcat is now known as mst 03:37 Cabanossi left 03:38 Cabanossi joined
ipatrol m: say 'cat'.end; 03:51
camelia 0
ipatrol m: say 'cat'.first; 03:52
camelia cat
ipatrol m: 'cat'split('').last; 03:53
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3'cat'7⏏5split('').last;
expecting any of:
infix
infix stopper
statement end
statement modifier
state…
03:53 Ven`` joined
ipatrol m: 'cat'split('').tail; 03:54
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3'cat'7⏏5split('').tail;
expecting any of:
infix
infix stopper
statement end
statement modifier
state…
03:54 vendethiel- left
ipatrol m: 'cat'.split('').tail; 03:54
camelia ( no output )
ipatrol m: 'cat'.split('').last;
camelia No such method 'last' for invocant of type 'Seq'. Did you mean any of these?
Hash
List
Rat
flat

in block <unit> at <tmp> line 1
ipatrol m: 'cat'.split('').List.tail; 03:55
camelia ( no output )
ipatrol m: 'cat'.split('')[*-1];
camelia ( no output )
ipatrol m: 'cat'.split('').eager[*-1]; 03:56
camelia ( no output )
ipatrol m: say 'cat'.split('').eager[*-1];
camelia
ipatrol m: say 'cat'.split('', :no-empty).eager[*-1]; 03:57
camelia
ipatrol m: say 'cat'.split('', :skip-empty).eager[*-1];
camelia t
ipatrol m: say 'cat'.split('', :skip-empty).tail;
camelia t
03:57 wander4096_ left
ipatrol m: say 'cat'.tail; 03:57
camelia cat
04:04 AlexDaniel left, headcase_ joined 04:06 headcase left 04:11 virtualsue left 04:16 imcsk8 left, imcsk8 joined, virtualsue joined 04:19 dogbert17 joined, khw left 04:20 lizmat_ joined 04:21 AlexDaniel joined, moritz left 04:22 lizmat left, dogbert17_ left, protium left 04:23 moritz joined 04:24 Exodist left 04:25 Exodist joined, eater left 04:26 shadowpaste left 04:28 eater joined, protium joined 04:31 shadowpaste joined 04:37 ipatrol left 04:42 cuonglm left 04:45 xtreak joined 04:48 ShalokShalom joined, ShalokShalom left 04:55 cdg joined 04:59 AlexDaniel left 05:00 cdg left 05:08 wander4096 joined 05:10 skids left 05:19 ShalokShalom joined 05:21 xtreak left, xtreak_ joined
wander4096 what is the word "invocant" means? i'm from china and difficult to understand it 05:33
the word is here and there, every time puzzle me 05:34
TEttinger "One who calls upon or invokes." I don't know the specific meaning in perl 6, but it would normally be something that is calling something else (probably a method) 05:36
piojo ‎wander4096‎: do you know C and C++ (or C++ and function objects or boost)? 05:37
perl methods are like class functions in these environments: the invisible first function argument (usually ignored) is the caller--usually the class object 05:38
this is the invocant
But I don't think the invocant is always an object of that class, but almost always 05:39
and within the method, you can use "self" to refer to the invocant.
wander4096 emmmm... 05:40
piojo (call its other methods, mostly)
wander4096 sounds more like in Python
piojo I don't know that much Python, but I think it's like this in most object oriented languages
05:41 virtualsue left, BenGoldberg left
wander4096 thx, maybe i got it :) 05:43
05:45 virtualsue joined
piojo wander4096: you're welcome. BTW, the invocant can be a class instance or the class itself, corresponding to Foo.new.Func versus Foo.Func 05:46
05:46 espadrine joined 05:48 cdg joined
piojo and it's not called "caller" because "caller" means the caller *scope* in perl 05:48
wander4096 so it is. the latter i know it for the first time. 05:50
05:50 nige left 05:52 cdg left 05:53 headcase_ left 05:56 headcase joined 05:57 nadim joined 05:58 headcase_ joined
masak wander4096: when you do `$something.method()`, the object that's in $something gets bound as the invocant of the method call (and can be accessed as `self` inside that call) 05:58
wander4096: you're right in that Perl culture is quite unique in using that word :) 05:59
06:00 aborazmeh left 06:02 headcase left
wander4096 this question occurs when distinguish `method does` from `method isa` 06:04
and i wonder if a role does `Mu`
m: Callable.does(Mu)
camelia ( no output )
wander4096 m: say Callable.does(Mu)
camelia True
wander4096 but in the type graph, i can't find something like the root of roles 06:05
so how can Callable does Mu?
even 06:06
m: say Callable.isa(Mu)
camelia True
06:06 headcase_ left 06:08 wamba joined 06:15 headcase joined 06:18 lizmat_ is now known as lizmat, zacts joined 06:20 headcase left, Cabanossi left 06:21 headcase joined 06:23 telex left, Cabanossi joined 06:30 setty1 joined, headcase left 06:31 headcase joined
piojo The docs for .does() and .isa() don't mention each other 06:31
but in each case, the docs say it's equivalent to `~~`
funny.
piojo files a doc bug/suggestion 06:34
06:35 telex joined 06:38 headcase left 06:48 headcase joined
wander4096 em, how to "files a doc bug/suggestion"? 06:52
piojo wander4096: start the message with "/me " 06:56
06:57 headcase left 06:58 headcase joined 07:03 headcase left
wander4096 is there a manual about chatroom robot? 07:03
piojo I just found this: github.com/perl6/whateverable/wiki 07:12
07:12 headcase joined
piojo and this mentions a few more that aren't listed there (aren't part of the "whateverable" project): github.com/perl6/doc/issues/711 07:12
07:16 headcase left 07:18 darutoko joined 07:20 headcase joined 07:23 cuonglm joined 07:25 domidumont joined, headcase left 07:28 headcase joined 07:29 domidumont left, xtreak_ left 07:30 domidumont joined 07:32 cdg joined 07:34 xtreak joined 07:35 Cabanossi left 07:36 cdg left 07:37 headcase left 07:38 Cabanossi joined, headcase joined 07:41 konsolebox left 07:42 headcase left 07:46 ChoHag joined 07:48 xtreak left, xtreak joined 07:52 konsolebox joined 07:53 xtreak left 08:02 ChoHag left 08:03 penguin_ joined 08:05 penguin_ left, cdg joined 08:06 cdg left 08:07 cdg joined 08:10 headcase joined 08:11 cdg left 08:13 domidumont left 08:14 headcase left 08:17 simonm left 08:18 Terry__ joined 08:27 headcase joined 08:30 xtreak joined 08:32 cuonglm left, headcase left 08:36 Cabanossi left 08:38 Cabanossi joined 08:52 darutoko left 08:54 headcase joined 08:58 headcase left, headcase joined 09:01 darutoko joined 09:03 headcase left 09:08 headcase joined 09:09 wander4096 left 09:12 headcase left 09:15 cdg joined 09:17 leont joined 09:18 headcase joined 09:20 cdg left 09:21 Cabanossi left 09:23 Cabanossi joined, Terry__ left 09:27 headcase left 09:28 headcase joined 09:41 headcase left 09:42 piojo left 09:43 wander4096 joined, piojo joined 09:46 ufobat joined 09:47 headcase joined 09:51 headcase left 09:53 llfourn joined 09:59 headcase joined 10:02 ufobat_ joined 10:03 ufobat___ joined, zakharyas joined, headcase left 10:05 sena_kun joined, ufobat left
sena_kun [Coke], ping. 10:06
10:06 orac1e_ joined, ufobat_ left 10:08 headcase joined 10:18 headcase left 10:20 headcase joined 10:21 Cabanossi left 10:22 headcase left 10:23 Cabanossi joined 10:29 TEttinger left 10:33 leont left 10:34 headcase joined, zakharyas1 joined 10:42 headcase left 10:53 leont joined 10:54 headcase joined 10:56 Skarsnik joined 10:58 leont left 10:59 xtreak left, zakharyas1 left 11:02 xtreak joined, margeas joined 11:03 headcase left 11:04 headcase joined 11:09 orac1e_ left 11:13 headcase left 11:14 headcase joined 11:18 HoboWithAShotgun joined
HoboWithAShotgun m: $_ = chr(12); .say; s/{chr(12)}/x/; .say; 11:20
camelia
x
yoleaux 15 Sep 2017 17:55Z <Zoffix> HoboWithAShotgun: managed to make it work without parens (and slurpy slurps the things): multi postfix:<°> { $^a }; multi prefix:<△> (*@things) is looser(&[,]) { class Triangle { has $.things; method beta { $!things.perl.uc } }.new: :@things }; .beta.say with △ α => 75°, c => 3, b => 3
HoboWithAShotgun m: $_ = chr(65); .say; s/{chr(65)}/x/; .say; 11:21
camelia A
xA
11:21 nadim left
HoboWithAShotgun i thought i can have code blocks anywhere 11:21
11:23 headcase left 11:24 headcase joined
HoboWithAShotgun m: $_ = chr(65); .say; s/ {return chr(65)} /x/; .say; 11:30
camelia A
Attempt to return outside of any Routine
in regex at <tmp> line 1
in block <unit> at <tmp> line 1
11:31 cdg joined 11:33 headcase left 11:34 virtualsue left 11:36 virtualsue joined 11:37 headcase joined 11:39 cdg left 11:44 xtreak left
HoboWithAShotgun m: my @a = 3, (if 0 { 2 }), 1; say @a.elems 11:45
camelia 2
HoboWithAShotgun interesting. i would have expected 3
timo the result of a non-executed if is () aka Empty
that flattens away in list assignment 11:46
11:46 headcase left
HoboWithAShotgun so there is a value produced, it just happens to be of type Empty. So, 0 ?? 2 !! Empty should be the equivalent 11:49
m: my @a = 3, 0 ?? 2 !! Empty, 1; say @a.elems 11:50
camelia 2
HoboWithAShotgun heh
11:51 ShalokShalom_ joined
HoboWithAShotgun but i have skimmed the control flow and regex docs now, i still don't know what s/{something}/does/; and why it seems to match the beginning of a string 11:52
11:52 eliasr joined
HoboWithAShotgun i figured it'd execute "something" and replace its return value, but it doesn't 11:54
11:54 headcase joined
piojo timo: it seems that Empty is |(), not () 11:54
11:54 ShalokShalom left
piojo and I'm also interested to know how (if 0 {}) becomes Empty 11:55
obviously () is empty, but not Empty (not a slip)
so how does putting some x inside -- (x) -- cause perl6 to turn it into a slip? 11:56
MasterDuke_ HoboWithAShotgun: {something} just executes, <{something}> interpolates the result of executing it into the regex
timo oh, right, it must be a slip
good catch
piojo perl really isn't like other languages... the way it parses things makes me smile but stretches my brain. 11:57
11:58 headcase left
piojo Actually, I think I know how that case works: grouping paretheses are ignored, after they serve their purpose, so `(code...)` is not the same as`()`, because the latter is not for grouping, and it can't be just dropped by the compiler. 12:00
so `(code)` can be turned into a slip because it's actually equivalent to `code`, not list(`code`)
("turned into a slip" == evaluated and returns something that is a slip) 12:01
timo m: say ()
camelia ()
timo m: say ().perl
camelia ()
timo gee thanks %)
m: say ().^name
camelia List
piojo m: say (42).perl
camelia 42
piojo m: say ().perl
camelia ()
timo yeah, the comma is normally what causes a list to be created, except if the parens are completely empty (and not in a place where they would be an argument list) 12:02
piojo so () is only kept when it doesn't serve a semantic purpose
MasterDuke_ m: say (42,).perl
camelia (42,)
piojo but you know what gets me? this:
m: say <hi>.perl
camelia "hi"
moritz m: say <hi>.^name
camelia Str
12:03 headcase joined
piojo m: dd <hello world>, 12:04
camelia ("hello", "world")
piojo so with a comma, it doesn't matter whether there's just one word, or more
except it's awkward to do that in an argument list
12:04 ShalokShalom_ is now known as ShalokShalom
piojo m: say <hello>,, ('world',) 12:05
camelia 5===SORRY!5=== Error while compiling <tmp>
Preceding context expects a term, but found infix , instead
at <tmp>:1
------> 3say <hello>,,7⏏5 ('world',)
piojo m: say (<hello>,), ('world',)
camelia (hello)(world)
piojo awkward ways to make lists :P
timo corner cases everywhere! 12:07
jnthn m: say @('hello'), @('world') # arguably prettier than trailing , 12:08
camelia (hello)(world)
12:08 headcase_ joined
piojo jnthn: I like that, thanks. I'll try to remember that 12:08
m: dd @<hello>
camelia (Nil,)
timo haha
piojo shrugs
timo that's a postcircumfix there
kind of like %foo<bar baz> 12:09
jnthn Is it?
I thought it was the match object access sytnax
timo right, it should complain about @ not having hash access
jnthn Usually used as $<named-arg>
timo oh, right!
it is
i thought of an anonymous state var
jnthn m: dd @'hello'
camelia 5===SORRY!5=== Error while compiling <tmp>
Name must begin with alphabetic character
at <tmp>:1
------> 3dd @7⏏5'hello'
expecting any of:
infix
infix stopper
postfix
statement end
st…
piojo oh, I've seen % and @ used with no variable name before, and I wondered what that was
jnthn m: dd @"hello"
camelia 5===SORRY!5=== Error while compiling <tmp>
Name must begin with alphabetic character
at <tmp>:1
------> 3dd @7⏏5"hello"
expecting any of:
infix
infix stopper
postfix
statement end
st…
jnthn Yeah, figured one'd not get away with that :) 12:10
moritz m: /a b+/ 12:11
camelia Potential difficulties:
Space is not significant here; please use quotes or :s (:sigspace) modifier (or, to suppress this warning, omit the space, or otherwise change the spacing)
at <tmp>:1
------> 3/a7⏏5 b+/
piojo so is @<hello> really the match object? Is this a way to access / <hello>* / ?
moritz I'm kinda annoyed by this warning; the quantifier after the second atom makes the whitespace very sensible
HoboWithAShotgun MasterDuke_: thanks, yet what does <{}> do? where is that documented? 12:12
12:12 headcase left
piojo m: 'a b c' ~~ m/<match>=(.*)/; say @<match>.perl 12:13
camelia 5===SORRY!5===
Unrecognized regex metacharacter = (must be quoted to match literally)
at <tmp>:1
------> 3'a b c' ~~ m/<match>7⏏5=(.*)/; say @<match>.perl
Couldn't find terminator / (corresponding / was at line 1)
at <tmp>:1
------>…
piojo m: 'a b c' ~~ m/ <match>=(.*) /; say @<match>.perl
camelia 5===SORRY!5===
Unrecognized regex metacharacter = (must be quoted to match literally)
at <tmp>:1
------> 3'a b c' ~~ m/ <match>7⏏5=(.*) /; say @<match>.perl
Couldn't find terminator / (corresponding / was at line 1)
at <tmp>:1
-----…
moritz piojo: should be $<match>=
12:13 kaare_ left
piojo moritz: thanks! 12:13
m: 'a b c' ~~ m/ $<match>=(.*) /; say @<match>.perl 12:14
camelia ()
piojo m: 'a b c' ~~ m/ $<match>=(.*) /; say $<match>.perl
camelia Match.new(list => (), made => Any, pos => 5, hash => Map.new(()), orig => "a b c", from => 0)
piojo jnthn: so @<foo> isn't the match object, it seems
MasterDuke_ HoboWithAShotgun: don't know where it's documented
m: say "a1b2c3" ~~ /a <{"hobo".chars - "hob".chars}> b/ 12:16
camelia 「a1b」
MasterDuke_ m: say "a1b2c3" ~~ /a <{"hobowithashotgun".chars - "hob".chars}> b/
camelia Nil
jnthn piojo: heh, wow, I thought t was... 12:17
piojo jnthn: the test wasn't rigorous, though. a better test would have a named match group with a quantifier 12:18
teatime just wanna say: the fact that even you guys can't always remember the special vars / funny symbols, gives me hope
jnthn huh, the AST seems to agree with me 12:19
- QAST::Op(callmethod list) <sunk> :statement_id<?>
- QAST::Op(call &postcircumfix:<{ }>) <foo>
- QAST::Var(lexical $/)
- QAST::WVal(Str) foo
@<foo> desugars to $/{'foo'}.list 12:20
piojo jnthn: you were right
m: grammar G { token TOP { <match>* }; token match { . } }; G.parse('foo'); dd @<match>
camelia [Match.new(list => (), made => Any, pos => 1, hash => Map.new(()), orig => "foo", from => 0), Match.new(list => (), made => Any, pos => 2, hash => Map.new(()), orig => "foo", from => 1), Match.new(list => (), made => Any, pos => 3, hash => Map.new(()), o…
piojo my other example must have failed because of details about when the array part of the match is assigned to. 12:21
12:21 armin left
timo one day we'll totally build that desuger module/function 12:21
jnthn m: "aaa" ~~ /[$<foo>=a]+/; say @<foo> 12:22
camelia [「a」 「a」 「a」]
piojo If you have a certain $/ in local scope, does @<...> come along for the ride just as $<...> ? 12:23
timo they are literally just syntax shortcuts to calling postcircumfix:<{ }> on $/ 12:24
(and in the case of @< > and %< > also calling .list or .hash on them)
piojo timo: oh, thanks. 12:25
though I have to assume that's merely _almost_ true
timo ah?
piojo because that doesn't explain why @<match> is not populated, when in the same code has $<match> containing a value
m: 'a b c' ~~ m/ $<match>=(.*) /; say $<match>.perl; say @<match>.perl 12:26
camelia Match.new(list => (), made => Any, pos => 5, hash => Map.new(()), orig => "a b c", from => 0)
()
timo oh
of course you get the .list of the thing
12:26 cognominal left
piojo haha 12:26
timo and the list => () part from the Match is what you get here
piojo oh
oh, so .list isn't like list()
sorry, should have realized
I've been confusing myself about that, recently. this goes a long way toward clearing up some things I've been puzzling about, like when hash(...) gives a different result than (...).hash 12:27
timo it gets more interesting when the $<foo>=... is actually captured multiple times
12:28 headcase_ left, Skarsnik_ joined
timo like jnthn showed above with the "aaa" match 12:28
piojo yeah
I know that's gonna be useful
I've wondered in the past about how to address when a match should be an array that might have 0 or 1 value(s). This is probably applicable
12:30 domidumont joined
piojo though I think @($<match>) would also solve that problem 12:30
timo for "0 or 1 matches" you can decide between using "?" where you'll get a Nil or a single value, or using ** 0..1, where you'll always get a list
m: "" ~~ / "a"* /; say $/.perl
camelia Match.new(list => (), made => Any, pos => 0, hash => Map.new(()), orig => "", from => 0)
timo m: "a" ~~ / "a"* /; say $/.perl
camelia Match.new(list => (), made => Any, pos => 1, hash => Map.new(()), orig => "a", from => 0)
piojo timo: that's good to know
I actually meant *, though
I wasn't sure the engine would give me a list if there's 1 match
timo oh, that wasn't interesting at all
m: "a" ~~ / ("a")* /; say $/.perl 12:31
camelia Match.new(list => ([Match.new(list => (), made => Any, pos => 1, hash => Map.new(()), orig => "a", from => 0)],), made => Any, pos => 1, hash => Map.new(()), orig => "a", from => 0)
piojo I suppose it will. my code was buggy enough that I'm not sure I got to that point
timo there it is
12:31 Skarsnik left
piojo m: 'a' ~~ / [ $<a>='a']* /; say $<a>.elems 12:32
camelia 1
piojo sorry, that's the newbie version :) 12:33
uh-oh, I'm remembering more details 12:34
teatime timo: are you also timotimo ?
12:35 cognominal joined
piojo m: 'aa' ~~ / $<match>=a | [ $<match>=a ]* /; say $<match>.elems 12:36
camelia 2
piojo m: 'aa' ~~ / $<match>=a || [ $<match>=a ]* /; say $<match>.elems
camelia 1
piojo m: 'aa' ~~ / $<match>=a /; say $<match>.elems
camelia 0
piojo haha
It's definitely smarter than I expected 12:37
12:38 cognominal left
timo teatime: i am 12:39
12:39 timo is now known as timotimo
timotimo sorry for the confusion 12:39
piojo teatime: who will you be in an hour?
timotimo who will you be when the irc drops?
piojo I mean, if you're teatime now.
teatime so, tea is lovely nearly any time. and, it's all kinds of different times around the globe. I assert that any time is teatime :) 12:40
piojo excellent answer :) 12:41
teatime timotimo: no worries, just curious / trying to keep up w/ "faces".
12:41 cognominal joined
teatime I do not at all understand why 'aa' ~~ / $<match>=a /; say $<match>.elems --> 0 12:41
hrm, it is a Match though, not a Str like I was thinking. 12:42
timotimo because the .elems goes at the .list part i'd expect
12:42 _28_ria left, nadim joined
piojo so the more interesting question is how the .list part gets populated 12:42
teatime "Returns the number of positional elements in the Capture." aha, gotcha. 12:43
piojo I think it's populated permissively, if there could *possibly* be anything in the list, then that thing is put in
m: 'aa' ~~ / $<match>=a || $<match>=a /; say $<match>.elems 12:44
12:44 _28_ria joined
camelia 0 12:44
12:44 Ven`` left, llfourn left, HoboWithAShotgun left, Ven`` joined
piojo yep, that's how it looks. if it sees any value being populated by the *, +, or {x}, or {x..x} quantifiers, it will be treated as belonging to a list, even if that match-codepath is not true (doesn't match) 12:44
teatime finally gets it. 12:50
12:58 pmurias_ joined 12:59 pmurias joined
pmurias or backends where there are really only 32bit integers do we want to emulate 8,16bit behavior for int16, int8 etc.? 12:59
13:01 headcase joined
moritz I think so, yes 13:02
there are some algorithms (like hash sums / message digests) where the wrapping is mandatory
but maybe wait for somebody elses opinion 13:03
13:03 zakharyas left 13:05 headcase left
pmurias dislikes doing language design choices 13:05
too much questions where there are arguments for both choices ;) 13:06
13:09 MasterDuke_ left
teatime <stdint.h> -> uint16_t is *exactly* 16 bits wide. it would surprise me if I used a type called "int16" and it was actually ≥16 rather ==16 bits wide. 13:09
13:10 headcase joined 13:11 domidumont left
hahainternet teatime: hope you don't put things in structs ;) 13:13
piojo ‎hahainternet‎: it would be nice if we could put things in structs 13:14
hahainternet piojo: i thought nativecall padded correctly
piojo I reimplemented a clever file duplicate finding algorithm in perl, and it kept running out of memory and choking
I mean, not structs for native calls, but structs for perl 13:15
hahainternet i don't see why that's a problem, p6 has native types
piojo objects with a known memory layout and size
I haven't explored that yet--actually, I wasn't planning to port it to perl6 until it's faster 13:16
perl6 seems quite slow for filesystem operations
teatime I need to deep-dive into the nativecall stuff at some point... it's a mystery to me how it (that is, the ecosystem libs that wrap shared libs) can work reliably.
hahainternet it's quite slow in general, but that's not really a criticism given how much work has gone into it so far
piojo: i would say though, treating memory as an on-demand, virtually allocatable, balloonable pool is a naive approach and you should implement a fixed size pool in your code 13:17
but that's arguably also pre-optimisation
and i know many people who prefer the Lambda approach
13:17 headcase left, headcase_ joined
teatime like, it's way easier to successfully make one of those wrappers than should be possible, or something. 13:17
hahainternet teatime: C calling conventions are pretty straightforward 13:18
piojo ‎hahainternet‎: I'm not sure what you mean. But my (perl5) code is all perl objects and code. The memory I'm running out of is because for example a perl int is a lot bigger than 32 bytes.
hahainternet piojo: imagine trying to write this same algorithm on a system that was severely memory constrained 13:19
say a megabyte or two
instead of creating arbitrary objects and adding to a list or similar
piojo but even if all the memory usage were equivalent to native bytes, it would still be a tight squeeze, so I converted it to use sqlite, which is probably the right path, given that the size increases with the count of files examined
hahainternet: yeah, that agrees with what I eventually decided
hahainternet you would statically allocate an area of memory and reuse it consistently 13:20
sqlite is a decent approach depending on your index requirements
piojo hahainternet: the algorithm requires remembering some data for every file examined
hahainternet i would usually hesitate to mention this, but you could consider memcached
piojo: right, but how much it can remember depends on your system
and if you simply blindly allocate objects and store them, you'll never know if your script can work on a system or not without trying it
anyway i'm not saying you should go away and go statically allocating 13:21
piojo hahainternet: it has to remember all of it. and yes, you're right, that can't possibly work, but there's not a better way, other than ridiculous hacks that would require lots of extra I/O because information was purged from memory
so a database is necessary if the script is going to run on all systems. 13:22
hahainternet piojo: so make the extra IO more efficient, learn about r/b trees etc (depending on your balancing requirements)
anyway i'm not trying to suggest you've done anythign wrong or bad
just saying that strategy is not going to be a winner even if you have 10x more RAM, because its memory requirement is set by the size of the challenge
you should aim to design your software so that its memory requirement is as static as possible no matter the input set size
memcached/sqlite are excellent options there 13:23
13:23 headcase joined
piojo some algorithms are O(n) in memory usage--I believe file duplicate checking falls into that category 13:23
at a minimum, you need to memorize the size of each file 13:24
*duplicate file finding, not just checking
hahainternet i can think of smaller algorithms
hash the file, store the first nibble
there's always going to be options
it's more of a question for your use case what's appropriate
piojo that's stil O(n), just a smaller n
hahainternet i just wanted to point out that if you're OOMing on perl5, no language will fix that explosion
piojo: big-o is a complexity class 13:25
a multi-stage algorithm is not the same
piojo It's still O(n), even if there are 3-4 passes over the input data
hahainternet i suppose technically if you're using big enough ints that the file size certainly fits inside 13:26
13:26 headcase_ left
hahainternet but the size of your result is actually known, vs 'a big number' 13:26
moritz
.oO( O(4n) )
hahainternet piojo: you can easily think of this in a different way 13:28
piojo hahainternet: basically, I agree with you, it might be acceptable to write programs that will run fine "unless you try to run it on more than 30 million files", as long as that limitation is documented
hahainternet take the length of your files, int divide it
(by 2)
piojo but it would hurt my pride to write one that chokes with a much smaller limit
hahainternet now you need only store which of the two categories the file is in
two whole bits :p
and yeah piojo that is quite common with an awful lot of tools 13:29
but it's also a very common mistake i see, especially in my own code :)
piojo hahainternet: that's clever, but in the case I tried, it wouldn't have helped because almost every file had at least one duplicate, so pre-passes saved IO (by comparing inodes) but didn't really reduce the amount of stuff that had to be remembered so much 13:32
13:32 headcase left
hahainternet piojo: it's just a hash :p 13:33
but yeah there are plenty of techniques
it's up to you to choose what works best for your use case
piojo hahainternet: actually, I'm not sure I understand. are you talking about dividing divide and conquor, based on categorizing the size?
hahainternet yeah if you have 30 million files, and you store if the length is odd or even, you need 30 million bits total
and that bisects your set to approximately 15 million files
so next pass you now have 2 bits per file to play with
piojo plus the size of the filenames, which is the real killer
hahainternet then 4 bits
then 8 bits
piojo: sort them, use bit # in memory to be file # 13:34
there are lots and lots of techniques for this, i don't want to imply you've done anything wrong though
piojo I thought about that, but decided it wouldn't help enough :)
I'm sure you have a lot of great ideas I haven't thought of
but I divided the acceptable memory usage by the number of files and found even perfect optimizations wouldn't be enough, except one-- 13:35
it ended up not working out, but in c++ (not perl) I would have been able to store the filenames in a trie, with each node representing a directory (or the basename)
I tried it in perl but it used even more memory than just storing each fname as a full string. Because of overhead for variables, I think 13:36
hahainternet well you can do that in perl, but yeah memory usage
pmurias hmm, is there a way to determine which multi variant is called?
13:37 nadim left
hahainternet piojo: just out of interest, can you give me some actual numbers 13:38
like you have 4 billion files
and 200mb memory
piojo hahainternet: if I recall, it was 5 billion files. 8 GB ram, with half taken up by other programs that were running
hahainternet yeah that's quite difficult, no matter how efficient
piojo some long filenames. lots of hard links because it was a backup disk. Slow frustrating I/O, so that had to be as efficient as possible 13:39
hahainternet oh, this smells like a mailserver backup usign rsync
how far am i off the mark?
piojo just a personal backup with rsync :)
hahainternet 5 billion files, crikey
piojo I don't know where they all came from 13:40
hahainternet anyhow i'd do some sort of component analysis there, because short of using the technique of a 2 bit hash and repeated passes
piojo oh, I think there probably was a mail directory in there somewhere
hahainternet the next stage after that is to make your hash function more perfect
that is, you identify the type of test that is most likely to split your set up into a small 'potential match' set
piojo I borrowed the algorithm from fslint, but modified it to be smart about repeated inodes
hahainternet microsoft have an interesting paper on perfect hash functions
i think what you'd want is kinda the opposite 13:41
piojo the hash doesn't need to be that fast, because it's not run very often--first pass gets sizes, then sorts. next pass makes sure the inode hasn't been seen yet (this is my change) and gets a checksum of the first kilobyte. next pass does a full checksum 13:42
hahainternet i see the thought, and doing a size pass is a good idea if it fits in memory 13:43
piojo I should really get around to publishing that on cpan. I need to clean it up and find out what the coding standards for publication are...
hahainternet but the 'hash' is just a consistent reduction of your data into a smaller space
a perfect hash embodies the minimum set required to identify a member uniquely
13:43 headcase joined
hahainternet you kinda want the opposite, the shortest hash required to identify a minimum set 13:44
right i'm gonna go deal with some irl things, i'm sorry i can't be of any direct help piojo
but fun chat :)
piojo hahainternet: yeah, good talking to you!
hahainternet plus there's always people here willing to help out with perl, and you should play with 6 regardless
because it's absurdly fun, -Ofun don't you know
piojo yeah, I like it a lot
but I'm not gonna wait for rakudo to scan 5 billion files 3 times 13:45
hahainternet why not? do it and profile it
timotimo maybe only with 5 thousand files
hahainternet then you're providing useful data on what's really slow as heck
teatime warning: perl6 is known to the state of california to be addictive.
piojo If that's useful, we could start smaller
hahainternet you kids and your » symbols
piojo a directory walk is significantly slower in perl6 than perl5
13:46 raschipi joined
piojo though threading speeds it up to be just 50% slower 13:46
(err, that's for a type of full-text search, not just a directory walk)
I'm also comparing apples to oranges, since my perl5 version is using the cygwin perl5, which is far faster than the windows perl5 13:47
13:48 Rawriful joined
raschipi 💩💩💩 13:51
13:52 HoboWithAShotgun joined
HoboWithAShotgun allright. how can it be an operator behaves differntly depending on wether i import it from a module or wether it is in the program itself 13:54
13:55 Rawriful left
raschipi HoboWithAShotgun: How so? 13:55
13:57 Rawriful joined 13:58 nadim joined
HoboWithAShotgun apparently a precedence issue 13:58
consider, hastebin.com/ixomivepoh.pl 14:00
14:01 lustlife joined
raschipi considers 14:01
Are you sure the other code declares itself looser than the comma? 14:03
HoboWithAShotgun i am sure the code is identical
raschipi Does anyone know a way to introspect the precedence of an operator? 14:04
14:04 imcsk8 left, knobo joined, headcase_ joined, wander4096 left 14:06 headcase left 14:08 MasterDuke joined
timotimo m: say &infix:<,>.pred 14:09
camelia No such method 'pred' for invocant of type 'Sub+{<anon|63427424>}+{Precedence}'. Did you mean any of these?
grep
prec
tree

in block <unit> at <tmp> line 1
timotimo m: say &infix:<,>.precedence
camelia No such method 'precedence' for invocant of type 'Sub+{<anon|63427424>}+{Precedence}'
in block <unit> at <tmp> line 1
timotimo m: say &infix:<,>.prec
camelia {assoc => list, prec => g=}
timotimo there we go
14:10 lancew joined 14:11 lancew left
raschipi Thanks, timotimo. 14:11
HoboWithAShotgun: Can you run that method in your code?
14:13 AlexDaniel joined 14:15 vendethiel- joined
HoboWithAShotgun it says {} for the op in the script file and {prec => v=} for the imported one 14:15
so, yes. the precedence is different 14:16
14:16 knobo left, Ven`` left
raschipi Are you sure it's calling the correct multi? 14:17
HoboWithAShotgun yes, as seen in the output. there is no third one 14:18
14:18 skids joined, headcase joined
HoboWithAShotgun i put together a minimal case and see if that persists. if so i gonna file a bug 14:19
14:19 ufobat___ left
raschipi HoboWithAShotgun: I think you hit RT #128042 14:20
synopsebot6 Link: rt.perl.org/rt3/Public/Bug/Display...?id=128042
14:21 dogbert2 joined, headcase_ left 14:22 KDr2__ joined
HoboWithAShotgun uh, nice and the fix right there 14:24
14:26 dogbert2 left 14:32 ufobat___ joined 14:37 setty1 left 14:48 rindolf joined 14:50 skids left, Skarsnik joined, MasterDuke left 14:51 bisectable6 left, unicodable6 left, squashable6 left, benchable6 left, committable6 left, bloatable6 left, coverable6 left, evalable6 left, releasable6 left, greppable6 left, quotable6 left, statisfiable6 left, nativecallable6 left 14:52 MasterDuke joined 14:53 vike left, Skarsnik_ left 14:55 bloatable6 joined, ChanServ sets mode: +v bloatable6, coverable6 joined, nativecallable6 joined, ChanServ sets mode: +v coverable6, ChanServ sets mode: +v nativecallable6, releasable6 joined, quotable6 joined, evalable6 joined, ChanServ sets mode: +v evalable6, bisectable6 joined, committable6 joined, ChanServ sets mode: +v bisectable6, ChanServ sets mode: +v committable6, greppable6 joined 14:56 unicodable6 joined, ChanServ sets mode: +v unicodable6, benchable6 joined, statisfiable6 joined, squashable6 joined, ChanServ sets mode: +v squashable6 15:02 vike joined 15:06 headcase left 15:07 Actualeyes left
raschipi Tidal bots. 15:09
HoboWithAShotgun how do i introspect the parameters to a sub within the sub via introspection. I know I must get ahold of the routine object of the mehod but how 15:14
15:18 MasterDuke left
HoboWithAShotgun that's all i can find in the docs: "Introspection on subroutines is provided via Routine." 15:19
yes, tyvm. that doesn't tell me how to get an instance of it 15:20
jnthn &?ROUTINE 15:22
HoboWithAShotgun doesn't work within the routine. maybe that's xy. i have a sub with various named arguments and i want to access those via a hash 15:24
moritz HoboWithAShotgun: just declare the signature with *%named or so 15:25
m: sub foo(*%named) { say %named.keys.sort.list.perl }; foo a => 2, :b, :c(34); 15:26
camelia ("a", "b", "c")
HoboWithAShotgun i know. but i want to keep the explicitly named arguments
ugexe is passing an action class + supply to a JSON grammar a kind of streaming json parser if the action class emits its first level objects from the action class? 15:29
moritz HoboWithAShotgun: you can have both with a subsignature 15:30
15:30 headcase joined
moritz m: sub foo(*%named (:$a, Int :$b) ) { say $b; say %named.keys }; foo b => 42; 15:30
camelia 42
(b)
weabot What's the best way to use a long-lived thread that I basically want to use as a different process sharing the same address space? 15:31
is the Thread class more reliable for this than promises?
15:33 headcase_ joined 15:34 headcase left 15:36 Cabanossi left
moritz weabot: what reliability issues are you having with promises? 15:37
15:37 headcase_ left
weabot they hang after a bit, I'll make an example real quick 15:37
15:38 Cabanossi joined, kaare_ joined 15:39 rindolf left
jnthn How many are you creating? If lots of them, it's possible you're running into the thread pool size limit (which you can increase) 15:42
weabot I'm creating them with Promise.start, appending the return value to an array that's cleaned when another function sees that the promise is kept, I make sure that the amount of promises I have stays under 10 15:43
well, I call .Bool on each promise and delete the entry if it shows True
15:43 nadim left 15:45 rindolf joined
weabot alright here it is p.teknik.io/L88yU 15:47
on my end this prints 1 and 2, and eventually stops
there is no 0
I'm sure I'm doing something wrong, but this is generally what happens in my program
it starts, and after a few instructions it hangs 15:48
15:48 headcase joined
sena_kun weabot, it prints 2 infinitely for me. 15:49
weabot what OS are you on?
and version
sena_kun linux, 2017.08-108-g760530a52 built on MoarVM version 2017.08.1-150-g0b81969db
weabot interesting, I'll try it on linux 15:50
15:50 MasterDuke joined
weabot yup, only prints 2 on linux 15:50
on 2017.07 15:51
but it eventually stops
15:52 headcase left
weabot now here's something 15:53
15:54 headcase joined
weabot if I call them all individually without a loop, they all print before stopping 15:54
15:58 headcase left
piojo weabot: for me on linux it prints 1 and 2 15:59
but my version is 16:00
sub t($i) {
while (True) {
print($i);
}
}
sub MAIN() {
loop (my $i = 0; $i < 2; $i++) {
Promise.start({t($i)});
}
t($i);
# Not reached
return 0;
}
err, sorry about that
two clipboards!
my version is 2017.08-96-ge5a600997 built on MoarVM version 2017.08.1-135-ge86428d4
whoa, I ran it again and it only printed 2. 16:01
16:01 zakharyas joined
piojo is $i is being copied in the closure rather than aliased? because my guess is the variable is being copied only when the function call happens 16:03
16:03 headcase joined
piojo and if the function call occurs after the loop has already gotten to i=1 or i=2, then the function's value of $i will be frozen at that point 16:04
so the "22222222" behavior happens if all the iterations of the loop happen before the thread pool actually lets the threads long enough that they can get to the t() function call.
*before the thread pool lets the threads run long enough to get to the t() function call 16:05
(which means this is unexpected but not a bug. c# had the same issue, but they decided to change the language behavior because it was so damn counter-intuitive) 16:06
weabot hmm
the bug is that the threads just stop printing anything after not too long for me
piojo I bet if you make a copy of $i within the loop body, you get 0, 1, and 2
weabot but let's see
piojo weabot: isn't that just the program finishing? 16:07
weabot nope, the command line doesn't return, I have to SIGINT
and I tried to do this
my $done = Promise.allof(@promises);
await $done;
no returns
piojo weabot: oh, sorry, of course you're right. it also hangs for me. I had a dumb (actually an "it's my bedtime") moment
16:07 headcase left
piojo but I tested and was right about the "2222222" issue 16:08
weabot hmm
16:08 MasterDuke left, zakharyas left
weabot but when I use .ACCEPTS on t instead of putting it in a block, it only prints 0 16:08
16:08 Sgeo_ left, MasterDuke joined 16:09 headcase joined
piojo weabot: sorry, I'm not familiar with what that is 16:09
16:09 MasterDuke left, Sgeo joined
weabot docs.perl6.org/type/Code#method_ACCEPTS 16:10
it lets you pass arguments
16:11 lustlife left
piojo changing it to &t.ACCEPTS($i) ? when I run that, I just get "22222222" 16:12
weabot I only had 000 16:13
16:13 HoboWithAShotgun left
weabot anyway, here's what strange 16:13
piojo I think on my computer, it causes the code to take longer to run
weabot putting $i into another variable made it run forever
let me try again
piojo oh, that is strange! It didn't do that fo rme
16:13 headcase left
weabot yep, it looks like it's gone for good 16:14
I have no clue why
16:14 headcase joined
piojo oh, and when it hangs, it's using 100% cpu. I wonder if it's deadlocked? 16:16
weabot that's what I was thinking
piojo I've gotta go to bed. sorry I didn't have an answer for the more buggy part of this test case.
weabot but on 2017.07 both on linux and macOS, setting $i in another variable lets it go on forever 16:17
I'm clueless
anyhow, good nigth piojo
night*
piojo night. It's too bad I'm not patient enough to stick around to hear the answer, if there is one. :D
weabot yeah, I'm not sure we'll have them 16:18
16:18 headcase left
weabot if anything this way we'll figure out workarounds and write bug reports 16:18
Skarsnik ping jnthn x) 16:19
16:23 ritre joined, virtualsue left 16:30 KDr2__ left 16:35 Cabanossi left 16:37 ufobat___ left 16:38 Cabanossi joined 16:42 leont joined, domidumont joined 16:46 piojo left 17:05 domidumont left, Cabanossi left 17:06 HoboWithAShotgun joined 17:08 Cabanossi joined 17:12 leont left 17:13 raschipi left 17:18 rindolf left 17:23 rindolf joined 17:28 HoboWithAShotgun left, Skarsnik_ joined 17:30 headcase joined 17:31 ipatrol joined 17:32 Skarsnik left
ipatrol Can a module declared inline access variables from outside itself? 17:32
17:33 domidumont joined, headcase_ joined 17:35 headcase left
ipatrol m: my $foo = 'cat'; module Bar {sub foobar {say $foo;}} import Bar 'foobar'; foobar(); 17:37
camelia 5===SORRY!5=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> 3at'; module Bar {sub foobar {say $foo;}}7⏏5 import Bar 'foobar'; foobar();
expecting any of:
infix
17:37 Cabanossi left
ipatrol m: my $foo = 'cat'; module Bar {sub foobar() {say $foo;}} import Bar 'foobar'; foobar(); 17:37
camelia 5===SORRY!5=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> 3'; module Bar {sub foobar() {say $foo;}}7⏏5 import Bar 'foobar'; foobar();
expecting any of:
infix
17:38 headcase_ left
ipatrol m: my $foo = 'cat'; my module Bar {sub foobar() {say $foo;};}; import Bar 'foobar'; foobar(); 17:38
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
foobar used at line 1
17:38 Cabanossi joined, grondilu left
ipatrol m: my $foo = 'cat'; my module Bar {sub foobar() {say $foo;};}; import Bar 'foobar'; Bar::foobar(); 17:38
camelia Could not find symbol '&foobar'
in block <unit> at <tmp> line 1
ipatrol m: my $foo = 'cat'; my module Bar {our sub foobar() {say $foo;};}; import Bar 'foobar'; Bar::foobar();
camelia cat
ipatrol m: my $foo = 'cat'; my module Bar {our sub foobar() {say $foo;};}; Bar::foobar(); 17:39
camelia cat
ipatrol m: my $foo = 'cat'; module Bar {our sub foobar() {say $foo;};}; Bar::foobar();
camelia cat
ipatrol m: my $foo = 'cat'; module Bar {my $baz = 'nap'; our sub foobar() {say "$foo$baz";};}; Bar::foobar(); 17:40
camelia catnap
17:47 zakharyas joined 17:49 karthyk joined 17:51 pecastro left 17:54 Skarsnik_ is now known as Skarsnik 18:06 Cabanossi left 18:08 Cabanossi joined 18:13 leont joined 18:16 headcase joined 18:23 HoboWithAShotgun joined 18:26 headcase_ joined 18:29 headcase left, knobo joined 18:30 pecastro joined, leont left 18:36 knobo left 18:38 leedo left 18:39 leedo joined, headcase_ left 18:43 nadim joined 18:44 headcase joined 18:48 headcase left 18:50 nadim left
HoboWithAShotgun m:class Bar { method bar { die "a b c"; } }; throws-like { Bar.new().bar }, Exception, "test3", message => /a \s b/; # ok 18:57
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/OvmH1EDAz3
Undeclared routine:
throws-like used at line 1
HoboWithAShotgun m:use Test; class Bar { method bar { die "a b c"; } }; throws-like { Bar.new().bar }, Exception, "test3", message => /a \s b/; # ok
evalable6 1..3
ok 1 - code dies
ok 2 - right exception type (Exception)
ok 3 - .message matches /a \s b/
ok 1 - test3
HoboWithAShotgun m:use Test; class Bar { method bar { die "a b c"; } }; throws-like { Bar.new().bar }, Exception, "test3", message => m:s/a b/; 18:58
evalable6 (exit code 1) Use of uninitialized value of type Any in string context.
Methods .^name, .p…
HoboWithAShotgun, Full output: gist.github.com/00b35084df73b2cc62...1abf326612
HoboWithAShotgun m: use Test; class Bar { method bar { die "a b c"; } }; throws-like { Bar.new().bar }, Exception, "test4", message => m:s/a b/; 18:59
camelia Use of uninitialized value of type Any in string context.
Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.
1..3
ok 1 - code dies
ok 2 - right exception type (Exception)
not ok 3 - .messa…
18:59 kaare__ joined
HoboWithAShotgun strange. on my perl6 this does something different. also wrong, but different 19:00
19:02 kaare_ left
HoboWithAShotgun scratch that, i misread 19:02
19:03 zakharyas left
HoboWithAShotgun so, why does the second test fail? message => /a \s b/ and message => m:s/a b/ should be equivalent 19:03
shouldn't they
19:06 zakharyas joined
geekosaur HoboWithAShotgun, the m// executes immediately 19:07
it is not a value, it is performed and its result is made the value associated with the key 'message'
HoboWithAShotgun i see. 19:08
ipatrol use rx instead of m
19:08 zakharyas left
geekosaur ^ 19:08
19:09 headcase joined 19:10 zakharyas joined 19:11 pecastro left 19:12 headcase_ joined, headcase_ left
ipatrol I have managed to condense virtually the entire system of verb conjugations in Japanese, into 150 lines of code, whitespace included. 19:13
19:13 headcase left 19:14 okl joined 19:16 nadim joined
moritz ipatrol: you scare me 19:16
HoboWithAShotgun pff. i am not scared. i am panicking :) 19:19
can i express this a bit shorter? $_ ~~ %_ && %_{$_}.defined
moritz why not just %_{$_}.defined ? 19:20
19:21 domidumont left
HoboWithAShotgun good question. i figured that would throw an error 19:21
since i cannot know if $_ is an existing key 19:22
Skarsnik %_{$_}:exists?
ugexe that includes undefined values 19:23
19:23 darutoko left
ipatrol moritz: why do I scare you? 19:24
19:33 pecastro joined 19:34 zakharyas1 joined 19:35 zakharyas left, zakharyas joined, Cabanossi left 19:36 zakharyas1 left 19:38 Cabanossi joined 19:39 headcase joined 19:40 zakharyas left
ipatrol I think I can knock out all the polite forms in another 50 lines or so 19:40
19:43 headcase left 19:44 HoboWithAShotgun left 19:48 headcase joined 19:54 ritre left 19:57 headcase left 19:59 headcase joined 20:00 sena_kun left 20:02 wamba left, TEttinger joined, headcase left 20:03 headcase joined 20:07 itaipu joined, setty1 joined, headcase left, wamba joined
gfldex lolibloggedalittle: gfldex.wordpress.com/2017/09/16/th...-continue/ 20:15
timotimo hehe 20:17
20:18 eliasr left
ipatrol can't see the whole line in my browser for some reason 20:18
20:23 itaipu left 20:29 rindolf left 20:31 leont joined 20:35 Cabanossi left 20:38 Cabanossi joined 20:42 domidumont joined, itaipu joined
AlexDaniel gfldex: hehe :D 20:46
20:49 domidumont left, nadim left 20:51 dwarring left
ipatrol Actually, I was able to code the polite conjugations in only 22 lines, plus a couple of functions defined earlier 20:52
20:52 anosh joined 20:59 headcase joined
ipatrol gist.github.com/anonymous/d8123631...d6f2208e72 21:02
21:03 mr-foobar left 21:04 mr-foobar joined, headcase left 21:06 Cabanossi left 21:08 Cabanossi joined 21:18 leont left 21:19 leont joined
unclechu hey guys, could someone explain me how i've got `-2.44929359829471e-16` by `sin(pi * 2)` instead of zero? 21:20
timotimo we use floating point numbers for trigonometry functions 21:22
you'll get the same result from, for example, python
geekosaur floating point is inherently inaccurate
or at least a similar but still nonzero one, unless something is specifically checking or you limit output precision 21:23
TEttinger also, no way to store the exact value of pi 21:25
you could store it symbolically, but then it's just the symbol pi and needs special treatment 21:26
e-16 means it's very small though
ipatrol you could store a routine that computes pi to arbitrary precision
TEttinger can you pass an arbitrary precision number to sin()? 21:27
ipatrol TEttinger: depends on how it's implemented
21:27 headcase joined
ipatrol unclechu: the thing is, Perl 6 is not a CAS. 21:27
TEttinger in perl 6, thatis
21:28 headcase left
unclechu thanks 21:28
geekosaur floating-point-gui.de/ 21:29
TEttinger I'm guessing there's a convenient way to compare within some epsilon
ipatrol TEttinger: I think =~= does that 21:30
sjn m: say sin(π * 2) =~= 0
camelia True
TEttinger nice
ipatrol the epsilon it uses is $*TOLERANCE 21:31
TEttinger say sin(π / 2.0) =~= 1
evalable6 True
ipatrol m: say $*TOLERANCE;
camelia 1e-15
TEttinger huh, evalable6 took over there, thanks evalable6 21:32
gfldex m: say sin(π / 2.0) ≅ 1
camelia True
ipatrol I'm not sure what semantics assign which bot to which statement
TEttinger I think m: goes to camelia always, not sure how evalable6 figured out I pasted code 21:33
21:33 headcase joined
ipatrol TEttinger: probably using the `say` 21:33
TEttinger say say
ipatrol say 'Happy';
evalable6 Happy
TEttinger say say 0;
evalable6 0
True
gfldex another ENODOC 21:34
21:34 mr-foobar left
ipatrol It might try to evaluate everything of that form, and just remain silent if it gets a syntax error 21:34
say <STDIN>; 21:35
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/sQEiG4Wrx7
Unsuppo…
ipatrol, Full output: gist.github.com/c45dab4405f075bc74...52e4da1365
ipatrol nopu
say <STDIN> 21:36
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/jufkdMXG5H
Unsuppo…
ipatrol, Full output: gist.github.com/1857f7551593864e64...3f78166eaa
ipatrol no idea then
21:37 mr-foobar joined
geekosaur evalable6 takes lines that it thinks "look like" perl 6 code. but it ignores anything specifically directed to another bot with a prefix 21:37
21:38 headcase left 21:39 nadim joined, headcase joined 21:41 leont left
AlexDaniel say you start your message with “say”, it shouldn't eval, right? 21:43
;)
because magic
ipatrol say "I just wanna run" 21:44
evalable6 I just wanna run
AlexDaniel actually, evalable calculates the ratio of non-\w characters in a message, and if there are too many, then it's probably code
ipatrol say I saw a man say "desu"
AlexDaniel ^ here we have more regular letters, so maybe it's not code 21:45
say I saw a man say "d““e”s”u"
ipatrol say <I> saw <a> man? !say "desu"
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/GSzSnIPyV2
Two ter…
ipatrol, Full output: gist.github.com/dec2122d6d5583a29b...ef5c2297c7
AlexDaniel well, you get the idea :) fun stuff
github.com/perl6/whateverable/blob...p6#L42-L54 21:46
^ code that does it
and here's what does the trick: $0.chars / $0.comb(/<-alpha -space>/) ≤ 10 21:47
21:48 headcase left
ipatrol so it only works on "say", intentionally omits "say I", omits anything that ends in a period, question mark, or exclamation point, automatically operates on `say I "..."`, and otherwise requires a word/nonword ratio of 10 or less 21:50
* automatically operates on `say "..."`
21:53 headcase joined 21:57 headcase left 21:59 Skarsnik_ joined, headcase joined 22:00 pecastro left 22:02 Skarsnik left, pmurias left, pmurias_ left 22:03 headcase left, mr-foobar left 22:04 mr-foobar joined 22:07 headcase joined 22:08 setty1 left 22:10 Skarsnik_ left 22:19 pecastro joined 22:20 Cabanossi left 22:23 Cabanossi joined 22:24 headcase left 22:27 MasterDuke joined 22:30 erdic left 22:35 pecastro left 22:36 nadim left 22:42 okl left 22:53 espadrine left
Geth whateverable: a9d9697df2 | (Aleks-Daniel Jakimenko-Aleksejev)++ | bin/Evalable.p6
Add ELI5 description for code detection

  ipatrol++
22:54
AlexDaniel ipatrol: thanks :) ↑
Geth whateverable: 1e5270241c | (Aleks-Daniel Jakimenko-Aleksejev)++ | bin/Evalable.p6
Explain how we got there
22:57
timotimo i think i found a tiny buglet in the permutations iterator 23:01
it uses $b, which is a lexical in the outer scope, inside the iterator class
since classes aren't closures, that'll give bogus values after the first use
MasterDuke can you show an example where it breaks? 23:03
23:05 khw joined
timotimo doesn't look like i can 23:07
23:08 MatrixDaniel is now known as AelxDnaiel 23:09 pecastro joined 23:13 headcase joined 23:17 headcase left 23:18 grondilu joined
grondilu in S14 I read I should be able to do '$fido does Wag($tail)' but I can't get it to work. 23:19
m: role Dog { has $.tail }; my $dog does Dog($) 23:20
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in typename; couldn't find final ')'
at <tmp>:1
------> 3le Dog { has $.tail }; my $dog does Dog(7⏏5$)
grondilu m: role Wag { has $.tail }; say class Dog does Wag($) {}.new
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in typename; couldn't find final ')'
at <tmp>:1
------> 3 { has $.tail }; say class Dog does Wag(7⏏5$) {}.new
grondilu m: role Wag { has $.tail }; say class Dog does Wag(my $tail) {}.new 23:21
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in typename; couldn't find final ')'
at <tmp>:1
------> 3 { has $.tail }; say class Dog does Wag(7⏏5my $tail) {}.new
grondilu what am I missing?
23:21 Rawriful left
timotimo grondilu: don't think that's a thing we have 23:21
there's only parametric roles 23:22
23:22 headcase joined
jnthn grondilu: Confusing does trait with does infix, and iirc it's only `but` that does that magic anyway 23:23
timotimo oooooh, *that* 23:24
grondilu A role applied with "does" may be parameterized with an initializer in
parentheses, but only if the role supplies exactly one attribute to the
mixin class
meh, * 23:25
jnthn Maybe the synopses is unclear. I wrote chunks of it, sorry if so. But I at least know what it's meant to mean, and that certainly only is talking about the infix. 23:26
grondilu I tried the infix too though 23:27
m: role Dog { has $.tail }; my $dog; $dog does Dog($) 23:28
camelia Unexpected named argument 'value' passed
in block <unit> at <tmp> line 1
jnthn Yeah, I'm a bit confused in that I was sure that only applied to `but`
grondilu m: role Dog { has $.tail }; my $dog; $dog but Dog($)
camelia Unexpected named argument 'value' passed
in block <unit> at <tmp> line 1
jnthn m: role Dog { has $.tail }; my $dog; $dog but Dog('foo')
camelia Unexpected named argument 'value' passed
in block <unit> at <tmp> line 1
jnthn oh!
Of course
A mixin has to be into an object 23:29
m: role Dog { has $.tail }; my $dog = Any.new; $dog but Dog('foo')
camelia ( no output )
jnthn m: role Dog { has $.tail }; my $dog = Any.new; $dog does Dog('foo')
camelia ( no output )
grondilu ok
jnthn Error reporting should be better there.
grondilu it actually makes sense
jnthn And yeah, it's right about it working on does, it seems
Guess it can :) 23:30
23:31 margeas left 23:34 benchable6 left 23:35 benchable6 joined 23:40 headcase left 23:46 raschipi joined 23:52 headcase joined 23:53 headcase left 23:58 headcase joined