Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2017-09-20

Perl 6 | Reference Documentation | Rakudo

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:02 epony joined #perl6
00:05 epony joined #perl6
00:16 cognominal joined #perl6
00:30 skids joined #perl6
00:35 Cabanossi joined #perl6
00:37 mcmillhj joined #perl6
01:10 headcase joined #perl6
01:33 bwisti joined #perl6
01:36 zakharyas joined #perl6
01:55 ilbot3 joined #perl6
01:55 Topic for #perl6 is now »ö« Welcome to Perl 6! | https://perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:,  or /msg camelia p6: ... | irclog: http://irc.perl6.org or http://colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
02:01 noganex_ joined #perl6
02:15 rngoodn joined #perl6
02:16 skids joined #perl6
02:23 rngoodn joined #perl6
02:29 AlexDaniel m: say (<a b c>,<x y z>) Z (2,1)
02:29 camelia rakudo-moar b66f5e: OUTPUT: «(((a b c) 2) ((x y z) 1))␤»
02:29 AlexDaniel is there any easy way to get ‘c’, ‘y’ from that ^ ?
02:31 AlexDaniel m: say zip (<a b c>,<x y z>), (2,1), :with({$^a[$^b]})'
02:31 camelia rakudo-moar b66f5e: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3 b c>,<x y z>), (2,1), :with({$^a[$^b]})7⏏5'␤    expecting any of:␤        infix␤        infix stopper␤        postfix␤        statement end␤   …»
02:31 AlexDaniel m: say zip (<a b c>,<x y z>), (2,1), :with({$^a[$^b]})
02:31 camelia rakudo-moar b66f5e: OUTPUT: «(c y)␤»
02:35 AlexDaniel m: say (<a b c>,<x y z>) Z[&({$^a[$^b]})] (2,1)
02:35 camelia rakudo-moar b66f5e: OUTPUT: «(c y)␤»
02:35 Cabanossi joined #perl6
02:42 Ben_Goldberg joined #perl6
02:49 benchable6 joined #perl6
02:49 rngoodn joined #perl6
02:53 myrin joined #perl6
03:00 noganex joined #perl6
03:05 Cabanossi joined #perl6
03:17 wamba joined #perl6
03:22 Ven`` joined #perl6
03:25 headcase joined #perl6
03:33 headcase joined #perl6
03:34 Cabanossi joined #perl6
03:34 headcase_ joined #perl6
03:40 Geth ¦ whateverable: c6aa350dee | (Daniel Green)++ | 2 files
03:40 Geth ¦ whateverable: Add memory used to uptime command
03:40 Geth ¦ whateverable:
03:40 Geth ¦ whateverable: Also log the output of the uptime command at the end of a test run for
03:40 Geth ¦ whateverable: each bot.
03:40 Geth ¦ whateverable:
03:40 Geth ¦ whateverable: Addresses part of #197.
03:40 Geth ¦ whateverable: review: https://github.com/perl6/whateverable/commit/c6aa350dee
03:44 todd joined #perl6
03:45 todd HI All,  I forgot where I wrote down how to pass read/write variables to subs.  I can't fing it on perl6.org and google give me 1001 hits on perl 5.  Can someone point me to a link?
03:48 raschipi https://docs.perl6.org/type/Signature#index-entry-trait_is_copy-trait_is_rw-Parameter_Traits_and_Modifiers ?
03:49 todd Perfect!  Thank you!  Bye bye
03:51 rngoodn joined #perl6
04:00 aborazmeh joined #perl6
04:00 aborazmeh joined #perl6
04:04 Cabanossi joined #perl6
04:05 rngoodn joined #perl6
04:17 sacomo is there a reason for this behavior:
04:17 sacomo m: "perl6" ==> uc() ==> my $str; say $str;
04:17 camelia rakudo-moar b66f5e: OUTPUT: «[PERL6]␤»
04:18 sacomo m: "perl6" ==> uc() ==> say();
04:18 camelia rakudo-moar b66f5e: OUTPUT: «PERL6␤»
04:18 sacomo straight to say() prints a Str, but assigning to $str creates an Array.
04:20 sacomo m: "perl6" ==> uc() ==> &{ .^name.say }();
04:20 camelia rakudo-moar b66f5e: OUTPUT: «Str␤»
04:34 Cabanossi joined #perl6
04:35 headcase joined #perl6
04:35 AlexDaniel goddamn Roman numerals
04:39 nadim joined #perl6
04:42 rngoodn joined #perl6
04:48 todd joined #perl6
04:49 headcase joined #perl6
04:49 cdg joined #perl6
04:51 todd Hi All,  I am looking for a reference that tells me what the rulrs are when I use something like `sub XOpenDisplay(Str $name = ':0')`.  I would like a reference that explains the various different types like "Str" and "int" and so on and so forth.  Not finding it on per6.org and Google POUNDS me with perl 5 hits.
04:51 raschipi https://docs.perl6.org/type.html ?
04:53 todd doesn't really help.  I want to know 32 bit, 64 bit integers, etc, when I am calling a system library
04:54 myrin joined #perl6
04:54 raschipi https://docs.perl6.org/language/nativecall#Passing_and_Returning_Values ?
04:55 todd Perfect!  Thank you!  bye bye
04:55 raschipi When you said "int" and "Str" that threw me off because those can't be used with nativecall
04:58 headcase joined #perl6
05:04 Cabanossi joined #perl6
05:07 headcase joined #perl6
05:27 araujo joined #perl6
05:27 araujo joined #perl6
05:39 headcase joined #perl6
05:48 headcase joined #perl6
05:53 lowbro joined #perl6
05:53 lowbro joined #perl6
06:02 domidumont joined #perl6
06:07 headcase joined #perl6
06:23 AlexDaniel ok, now I can finally sleep peacefully https://code-golf.io/
06:23 TEttinger u: ̇
06:23 unicodable6 TEttinger, Found nothing!
06:23 TEttinger u: 775
06:23 unicodable6 TEttinger, Found nothing!
06:25 headcase joined #perl6
06:26 AlexDaniel u: 0x775
06:26 unicodable6 AlexDaniel, U+0775 ARABIC LETTER FARSI YEH WITH EXTENDED ARABIC-INDIC DIGIT TWO ABOVE [Lo] (ݵ)
06:26 AlexDaniel TEttinger: what were you looking for? Maybe I know
06:27 ShalokShalom joined #perl6
06:28 TEttinger nah, it was some weird char that was in a case conversion
06:29 TEttinger turkish I with a dot above, when made lower-case, became ascii i with an extra dot added
06:29 TEttinger the extra dot being a diacritic
06:30 AlexDaniel u: ȧ
06:30 unicodable6 AlexDaniel, U+0227 LATIN SMALL LETTER A WITH DOT ABOVE [Ll] (ȧ)
06:30 AlexDaniel u: _̇
06:30 unicodable6 AlexDaniel, U+005F LOW LINE [Pc] (_)
06:30 unicodable6 AlexDaniel, U+0307 COMBINING DOT ABOVE [Mn] ( ̇)
06:31 AlexDaniel TEttinger: oh, I see now. Unicodable does not really understand combining characters
06:31 AlexDaniel it combines with a space before and I guess it ends up with an empty string
06:31 TEttinger huh
06:32 AlexDaniel uhhh… IIRC it wasn't trivial to fix this issue
06:32 AlexDaniel by the time the bot gets the string, the combined thingy is already eaten by IRC::Client, or something…
06:32 AlexDaniel so you have to restore it somehow
06:33 AlexDaniel at least, that's what I can remember about this issue
06:34 headcase joined #perl6
06:34 Cabanossi joined #perl6
06:42 darutoko joined #perl6
06:44 u-ou How do I install a module from inside its git repo?
06:44 u-ou is there some standard way?
06:44 moritz zef install .
06:44 u-ou it fails on zef
06:45 u-ou wait
06:45 u-ou nvm
06:45 u-ou that's probably what I want
06:45 u-ou I can zef the last commit that works
06:47 |oLa| joined #perl6
06:48 headcase joined #perl6
06:49 firecat left #perl6
06:53 |oLa| joined #perl6
06:56 u-ou I can install NCurses with zef install NCurses --force-test but am afraid to use it as I don't know what test failed. How do I find out?
07:00 krunen_ joined #perl6
07:01 jonas1 joined #perl6
07:01 mr-foobar joined #perl6
07:02 wamba joined #perl6
07:04 Cabanossi joined #perl6
07:06 Deejizzel joined #perl6
07:06 headcase joined #perl6
07:07 krunen_ joined #perl6
07:07 tyil hmm, docs for Bailador are conflicting
07:07 tyil one page says to use `method`, other page says to use `to`
07:07 tyil (both give me the same error, though)
07:08 Deejizzel So what's up everybody I'm new
07:08 tyil Deejizzel: perl 6 is up
07:09 tyil trying to get controllers in bailador to not error out
07:09 tyil and preferably have the controller methods able to get the request body
07:13 cschwenz joined #perl6
07:16 headcase joined #perl6
07:25 headcase joined #perl6
07:32 piojo joined #perl6
07:33 myrin joined #perl6
07:34 headcase joined #perl6
07:34 piojo Hi, does anyone know how to disable buffering for $*ERR and $*OUT? It's going to cause misery, since in my environment perl6 can't figure out whether it's attached to a TTY
07:35 Cabanossi joined #perl6
07:43 headcase joined #perl6
07:43 mrdside joined #perl6
07:44 mrdside привет
07:49 piojo_ joined #perl6
07:50 cosimo joined #perl6
07:57 headcase joined #perl6
07:57 cosimo_ joined #perl6
07:59 piojo Alternatively, is it possible to close and reopen stdout with :!buffer?
08:03 vike joined #perl6
08:06 headcase joined #perl6
08:13 piojo Wow, this actually seems to work:
08:13 piojo $*OUT = $*OUT.open(:!buffer); $*ERR = $*ERR.open(:!buffer);
08:14 piojo I can't believe the API exists to open an already open handle
08:16 dakkar joined #perl6
08:19 knobo joined #perl6
08:21 myrin joined #perl6
08:23 todd joined #perl6
08:24 todd Hi All,  I am looking at https://docs.perl6.org/routine-sub.html and can not find a sub that will tell me what OS I am in.  Does such a critter exist?  Do you have a link to such?
08:24 moritz m: say $*OS
08:24 camelia rakudo-moar b66f5e: OUTPUT: «Dynamic variable $*OS not found␤  in block <unit> at <tmp> line 1␤␤»
08:24 moritz m: say $*KERNEL
08:24 camelia rakudo-moar b66f5e: OUTPUT: «linux (4.4.70.18.9.default)␤»
08:25 moritz todd: ^^ something like this?
08:25 * DrForr pokes his head in for a few minutes in between setting stuff up.
08:26 todd $ perl6 -e 'say $*KERNEL' linux (3.10.0.693.1.1.el.7.x.86._.64)
08:27 todd that will work.  Is there anythig that just says "windows" or "linux"?
08:28 todd Any of you guys on Windows?  what does `perl6 -e 'say $*KERNEL' ` give you?
08:29 pmurias joined #perl6
08:29 moritz m: say $*KERNEL.^name
08:29 camelia rakudo-moar b66f5e: OUTPUT: «Kernel␤»
08:30 pmurias m: my int $x; say $x.WHAT; # Should that be int or Int?
08:30 yoleaux 19 Sep 2017 15:19Z <jnthn> pmurias: A while back you asked if the continuation protect flag should stay or go away. Turns out, stay: https://github.com/rakudo/rakudo/commit/29863a0bdc
08:30 camelia rakudo-moar b66f5e: OUTPUT: «(Int)␤»
08:30 moritz no docs yet for type Kernel :(
08:30 moritz m: say Kernel.^methods
08:30 camelia rakudo-moar b66f5e: OUTPUT: «(BUILD name version release hardware arch archname bits signals signal Str gist auth signature desc)␤»
08:30 tyil todd: use split on teh output of $*KERNEL
08:30 tyil and take the first piece
08:30 moritz m: say $*KERNEL.name
08:30 camelia rakudo-moar b66f5e: OUTPUT: «linux␤»
08:30 tyil or what moritz just did
08:30 tyil he's better than I am with this
08:31 todd $ perl6 -e 'say $*KERNEL.name' linux
08:31 todd a thing of beauty.  Thank you!
08:31 pmurias we have a fudged test in roast for: my int $x; say $x.WHAT being int not sure if I should remove it?
08:32 rindolf joined #perl6
08:33 todd Anyoine running Windows?  What does `perl6 -e 'say $*KERNEL.name'` give you?
08:33 ccakes joined #perl6
08:33 headcase joined #perl6
08:35 tyil tfw everyone awake is sane enough to avoid windows
08:38 moritz any <MSWin32 mingw msys cygwin>
08:38 moritz according to roast
08:41 piojo It says win32, even in cygwin and msys.
08:43 headcase joined #perl6
08:43 AlexDaniel joined #perl6
08:46 todd chuckle.  Win32 thank you!
08:46 todd bye bye
08:48 mniip joined #perl6
08:50 cdg joined #perl6
08:50 mr-foobar joined #perl6
08:52 headcase joined #perl6
08:58 wamba joined #perl6
09:01 headcase joined #perl6
09:10 headcase joined #perl6
09:16 virtualsue joined #perl6
09:24 headcase joined #perl6
09:25 u-ou m: $x
09:25 camelia rakudo-moar b66f5e: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Variable '$x' is not declared␤at <tmp>:1␤------> 3<BOL>7⏏5$x␤»
09:33 headcase joined #perl6
09:33 Aaronepower joined #perl6
09:36 Aaronepower joined #perl6
09:37 aborazmeh joined #perl6
09:37 aborazmeh joined #perl6
09:37 kerframil joined #perl6
09:42 headcase joined #perl6
09:43 zakharyas joined #perl6
09:52 headcase joined #perl6
09:52 mr-foobar joined #perl6
09:58 Aaronepower joined #perl6
10:05 Cabanossi joined #perl6
10:07 perlawhirl erm
10:07 perlawhirl there are 2 modules listed on the ecosystem called Net::ZMQ
10:07 perlawhirl which one does zef install if i ask, and does it pick the "right" one
10:08 perlawhirl https://github.com/arnsholt/Net-ZMQ
10:08 perlawhirl https://github.com/gabrielash/perl6-zmq
10:15 todd joined #perl6
10:16 Aaronepower joined #perl6
10:16 todd Hi All,  Anyone have a link to a list of reserved words/  Stuff line @*ARGS, $*PROGRAM-NAME, $?FILE, etc.?
10:19 moritz those are variables, not reserved words
10:20 jnthn todd: https://docs.perl6.org/language/variables#Compile-time_variables and below. Also what moritz said :)
10:21 fluca1978 joined #perl6
10:22 todd Awesome!   Thank you!
10:30 todd bye bye
10:30 Ven`` joined #perl6
10:32 lizmat http://news.perlfoundation.org/2017/09/grant-proposal-rakudo-perl-6-p.html   # timotimo++
10:32 patrickz joined #perl6
10:34 fluca1978 I'm a little confused about "precedence drop": when should I use and to which purpose?
10:35 Cabanossi joined #perl6
10:35 headcase joined #perl6
10:37 Aaronepower joined #perl6
10:39 fluca1978 for instance, what is the real difference between
10:39 fluca1978 $f.foo( ['a', 'b', 'c'] );
10:39 fluca1978 and
10:39 fluca1978 $f.foo: ['a', 'b', 'c'] ;
10:40 jnthn Nothing in that case. It means the rest of the statement will be taken as the argument list.
10:41 jnthn my ($x, $y) = $f.foo(1), $f.bar(2); # puts the results into $x and $y
10:41 mr-foobar joined #perl6
10:41 jnthn my ($x, $y) = $f.foo: 1, $f.bar: 2; # actually means $f.foo(1, $.bar(2))
10:41 jnthn oops, $f.bar
10:41 jnthn Which in that case wouldn't be what you wanted :)
10:42 piojo jnthn: so it's just another way to pass arguments?
10:42 jnthn Yes
10:42 jnthn Sometimes it's clearer and saves parentheses clutter
10:42 jnthn I especially like it in things like
10:42 jnthn $lock.protect: {
10:42 jnthn ...code here...
10:42 jnthn }
10:42 jnthn Then you don't need the ); on the end
10:43 jnthn Since } is a statement terminator
10:43 fluca1978 thanks jnthn, but can I use it only on methods or also sub?
10:43 sacomo hi everyone
10:43 knobo joined #perl6
10:43 piojo Ahh. Well, it reminds me of the Haskell $ operator: its precedence is so weak that its purpose is essentially to split the line, like putting parentheses around the whole RHS
10:44 jnthn fluca1978: It's only for methods; the equivalent for sub calls is to just not use parens at all
10:44 jnthn some-sub 1, 2, another-sub 3, 4; # same as some-sub(1, 2, another-sub(3, 4))
10:44 piojo jnthn: thanks, that inconsistency had been tripping me up.
10:45 fluca1978 thanks jnthn
10:47 tbrowder .tell ugexe will zef install a man page? if so, how should a module author provide the sources?
10:47 yoleaux tbrowder: I'll pass your message to ugexe.
10:51 piojo_ joined #perl6
10:57 fluca1978 left #perl6
10:57 margeas joined #perl6
10:58 headcase joined #perl6
11:04 pmurias bartolin: is anything blocking the JVM backend or just a lack of tuits?
11:09 eliasr joined #perl6
11:10 lowbro joined #perl6
11:10 lowbro joined #perl6
11:11 virtualsue_ joined #perl6
11:13 headcase joined #perl6
11:22 headcase joined #perl6
11:31 headcase joined #perl6
11:34 Cabanossi joined #perl6
11:35 setty1 joined #perl6
11:36 ShalokShalom joined #perl6
11:40 headcase joined #perl6
11:50 headcase joined #perl6
11:51 mr-foobar joined #perl6
11:52 ShalokShalom_ joined #perl6
11:59 headcase joined #perl6
12:00 drbojingle joined #perl6
12:02 timotimo y'all forgot about $*DISTRO.is-win last night :)
12:02 moritz or maybe we never knew about it in the first place :-)
12:03 nattefrost joined #perl6
12:06 sacomo hello
12:06 timotimo o/
12:07 sacomo is this the ==> feed operator is intended behavior?
12:07 sacomo m: "perl6" ==> uc() ==> say();
12:07 camelia rakudo-moar b66f5e: OUTPUT: «PERL6␤»
12:08 sacomo m: "perl6" ==> uc() ==> my $str; say $str;
12:08 camelia rakudo-moar b66f5e: OUTPUT: «[PERL6]␤»
12:08 sacomo see how it created the Array?
12:08 sacomo m: "perl6" ==> uc() ==> &{ .^name.say }();
12:08 camelia rakudo-moar b66f5e: OUTPUT: «Str␤»
12:08 headcase joined #perl6
12:09 piojo joined #perl6
12:12 sacomo it seems to happen any time a single value is fed into a $ container
12:14 pmurias jnthn: Iterable is assumed to be hard baked into perl 6 semantics? nqp::p6decontrv works differently depending on it's definition
12:17 timotimo sacomo: i believe that's intended. you get the PERL6 "without the array" when feeding it into say() because it passes the items as individual parameters
12:17 timotimo m: ("perl6", "foobar") ==> say()
12:17 camelia rakudo-moar b66f5e: OUTPUT: «(perl6 foobar)␤»
12:17 timotimo oh, or not i guess
12:17 patrickz left #perl6
12:18 timotimo tbh i haven't used the feed operators in a loooong while
12:19 jnthn It just calls .push on the target
12:19 jnthn That will vivify an Array inside of the Scalar container
12:19 jnthn So yeah, no surprise there.
12:19 sacomo ok
12:19 sacomo m: %{:name('Perl6')} ==> my %h; say %h;
12:19 camelia rakudo-moar b66f5e: OUTPUT: «{name => Perl6}␤»
12:20 sacomo m: 6 ==> my $i; say $i;
12:20 camelia rakudo-moar b66f5e: OUTPUT: «[6]␤»
12:20 jnthn pmurias: What does "depending on its definition" mean?
12:20 astj joined #perl6
12:21 jnthn pmurias: But yeah, iirc that op checks if there's an Iterable and re-wraps the return value if so
12:22 pmurias jnthn: that means Iterable is part of the language semantics?
12:22 sacomo it *feels* like it should just create a single value scalar in that situation. just wondering if there is some reason why making a new Array is more useful here
12:23 headcase joined #perl6
12:23 jnthn pmurias: Sure
12:24 jnthn sacomo: The point of ==> is producer/consumer list processing
12:24 jnthn sacomo: At some point in the future it'll likely schedule each phase on a separate thread
12:25 sacomo ok, then that would make sense. So feed shouldn't be seen as an alternative to method chaining (.&) when not expecting a list/hash?
12:25 geekosaur if you intend a single value, building a pipeline for it makes little sense (and a fair amount of overhead, likely). it makes sense in the context of a stream of values
12:25 pmurias btw. that op grabs Iterable for the first time from it's callers lexical scope so crazy things will happen if it ends up being called for the first time from a custom setting :)
12:29 headcase joined #perl6
12:32 astj joined #perl6
12:37 headcase joined #perl6
12:37 piojo joined #perl6
12:38 AlexDaniel joined #perl6
12:49 Cabanossi joined #perl6
12:54 AlexDaniel joined #perl6
12:58 atta joined #perl6
13:07 bisectable6 joined #perl6
13:08 darutoko- joined #perl6
13:18 rindolf joined #perl6
13:18 wamba joined #perl6
13:25 mcmillhj joined #perl6
13:36 astj joined #perl6
13:43 headcase joined #perl6
13:45 ufobat joined #perl6
13:47 ruoso___ joined #perl6
13:51 headcase joined #perl6
13:51 headcase joined #perl6
14:02 skids joined #perl6
14:05 wamba joined #perl6
14:08 headcase joined #perl6
14:18 headcase joined #perl6
14:32 rindolf joined #perl6
14:35 ponbiki joined #perl6
14:56 Aaronepower joined #perl6
14:59 astj joined #perl6
15:02 rindolf joined #perl6
15:05 xinming__ joined #perl6
15:06 domidumont joined #perl6
15:09 kerframil joined #perl6
15:11 troys joined #perl6
15:29 rindolf joined #perl6
15:35 Cabanossi joined #perl6
15:38 grondilu m: class Foo { constant Foo foo .= new };
15:38 camelia rakudo-moar 78a482: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Missing initializer on constant declaration␤at <tmp>:1␤------> 3class Foo { constant Foo7⏏5 foo .= new };␤»
15:38 grondilu m: class Foo { constant foo = Foo.new };
15:38 camelia rakudo-moar 78a482: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤An exception occurred while evaluating a constant␤at <tmp>:1␤Exception details:␤  No such method 'new' for invocant of type 'Foo'␤    in block  at <tmp> line 1␤␤»
15:38 ShalokShalom joined #perl6
15:38 grondilu I suppose it's because the constant evaluation occurs before class composition?
15:44 grondilu kind of annoying.  I have a compunit class and I want it to export particular instances as constants.  Can't I do that?
15:45 piojo m: class Foo {...}; class Foo { constant foo = Foo.new; }
15:45 camelia rakudo-moar 78a482: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤An exception occurred while evaluating a constant␤at <tmp>:1␤Exception details:␤  No such method 'new' for invocant of type 'Foo'␤    in block  at <tmp> line 1␤␤»
15:45 piojo too bad.
15:46 grondilu Basically a Vector class exporting e0, e1, etc as the orthonormal basis
15:47 timotimo m: class Test; constant foo = $?CLASS.new
15:47 camelia rakudo-moar 78a482: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Semicolon form of 'class' without 'unit' is illegal.  You probably want to use 'unit class'␤at <tmp>:1␤------> 3class Test;7⏏5 constant foo = $?CLASS.new␤»
15:47 timotimo m: unit class Test; constant foo = $?CLASS.new
15:47 camelia rakudo-moar 78a482: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤An exception occurred while evaluating a constant␤at <tmp>:1␤Exception details:␤  No such method 'new' for invocant of type 'Test'␤    in block  at <tmp> line 1␤␤»
15:47 cdg joined #perl6
15:47 piojo ‎grondilu‎: it works if you explicitly define method new
15:47 grondilu I did
15:47 timotimo i'd suggest working with an EXPORT sub
15:47 grondilu oh wait
15:47 piojo m: class Foo { method new() { }; constant foo = Foo.new; }
15:47 camelia rakudo-moar 78a482: ( no output )
15:47 grondilu I didn't.  My bad.
15:48 grondilu though I don't want to mess up the inheritage tree of new
15:49 grondilu *inheritance
15:49 piojo ‎grondilu‎: how about a helper method, then?
15:49 grondilu ?
15:49 piojo method Create { new(); }
15:49 piojo not sure if that works, though
15:50 piojo m: class Foo { method Create() { $?CLASS.new(); }; constant foo = Foo.Create; }
15:50 camelia rakudo-moar 78a482: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤An exception occurred while evaluating a constant␤at <tmp>:1␤Exception details:␤  No such method 'new' for invocant of type 'Foo'␤    in method Create at <tmp> line 1␤    in block  at <tmp> line …»
15:51 grondilu btw don't use uppercase in methods
15:52 grondilu (or rather firstcase, maybe)
15:53 mr-foobar joined #perl6
15:53 * grondilu forgot how one call the style where the first letter is uppercase
15:53 piojo is that the convention? I'l try to keep that in mind.
15:53 grondilu first letter in uppercase is for class names, IIRC
15:53 rgrau joined #perl6
15:53 piojo perl6 certainly has more conventions available--it doesn't need case as much as other languages
15:54 piojo because of being able to use dashes in names
15:54 piojo I thought that was blasphemy when I first saw it, but it's pretty cool.
15:54 cdg_ joined #perl6
15:54 grondilu yeah it's cool.  I wish I could also use single quotes, though.  As in Scala IIRC
15:55 timotimo "initial case"?
15:55 grondilu (or Haskell, can't quite remember)
15:55 grondilu m: say "foo".tc
15:55 camelia rakudo-moar 78a482: OUTPUT: «Foo␤»
15:55 piojo Haskell has single quotes
15:55 timotimo wait, you're allowed single quotes though?
15:55 timotimo m: my $foo'bar = 99;
15:55 camelia rakudo-moar 78a482: ( no output )
15:55 * grondilu forgot what tc stands for in .tc
15:55 piojo m: my $day's-earinings = 0;
15:55 camelia rakudo-moar 78a482: ( no output )
15:55 timotimo Title Case
15:55 grondilu oh yeah
15:55 piojo but haskell allows quote at the end, like x' for "x prime"
15:55 grondilu m: say my $foo'bar = pi
15:55 timotimo m: class Oh { method yo'yo { say "whoa, 90s!" } }; Oh.yo'yo
15:55 camelia rakudo-moar 78a482: OUTPUT: «3.14159265358979␤»
15:55 camelia rakudo-moar 78a482: OUTPUT: «whoa, 90s!␤»
15:55 timotimo oh, yes, indeed
15:56 grondilu oh boy I can use single quotes.  TIL
15:56 piojo but with the same rule as dashes
15:56 grondilu m: say my $foo' = pi # even at the end of the name?
15:56 camelia rakudo-moar 78a482: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3say my $foo7⏏5' = pi # even at the end of the name?␤    expecting any of:␤        constraint␤        infix␤        infix stopper␤        postfix…»
15:57 wamba joined #perl6
15:57 grondilu ah, not at the end
15:57 perlpilot I wonder what the implications would be to allow for ' at the end of identifiers?
15:57 grondilu pretty sure it's possible in either Scala or Haskell
15:58 AlexDaniel joined #perl6
15:58 * grondilu has been reading about both languages lately so he tends to mix things up :P
15:58 piojo I think Haskell kind of needs it, in a way that perl6 doesn't
15:59 piojo after all, in haskell you can't have: x=5; x *= 2;
15:59 piojo so it's awfully useful to be able to refer to x' and x''
16:00 piojo otherwise people would have to call the new variables x2 and x3, and we can't have that. :)
16:00 grondilu m: sub postfix:<'>(Int $n) { $n + 1 }; say 12'
16:00 camelia rakudo-moar 78a482: OUTPUT: «13␤»
16:00 grondilu well at least we can do that^
16:00 piojo nice!
16:01 piojo I'm still pretty enamoured with being able to define postfix operators for units, like 12kg
16:01 grondilu that will be useful for my Polynomial module, when I write the derivatives
16:01 piojo it doesn't work very well in the REPL, though
16:01 grondilu piojo: I think someone wrote a Physics::Units module recently
16:01 piojo grondilu: really? That would be awesome! I'll search for that, thanks
16:02 grondilu can't find it in the module repo, though :(
16:03 grondilu there was a blog entry :  https://p6steve.wordpress.com/2017/08/18/physicsunit-in-perl6/
16:04 timotimo you know the slang that lets you end method names in ? and !
16:04 timotimo probably possible to have that also let you put a ' at the end of things
16:05 Cabanossi joined #perl6
16:07 grondilu I thought about writing postfix methods for units once, but the SI prefix system made it more difficult than I thought
16:08 grondilu basically I had no idea how to implement a "prefix to a suffix"
16:08 grondilu so I gave up
16:08 grondilu that's the kind of thing that would require a slang, I think
16:10 grondilu physics is more interesting without dimensions, anyway ;)
16:13 grondilu back to my initial question : is it not possible to have a compunit class export particular instances as constants?
16:13 * perlpilot wonders how Physics::Unit handles dimensionless quantities
16:14 perlpilot grondilu: I would think it possible.
16:14 grondilu I've tried and failed
16:14 astj joined #perl6
16:16 perlpilot m: class Foo { };  constant f is export = Foo.new;  # something like that
16:16 camelia rakudo-moar 78a482: ( no output )
16:17 timotimo perlpilot: that's not a unit class :)
16:17 timotimo grondilu: have you tried an EXPORT sub?
16:18 grondilu oh yeah I guess that would work
16:19 grondilu I just need to cache it
16:19 perlpilot oh, I didn't read compunit as "unit class Foo;" but just as "compilation unit"
16:20 grondilu isn't it what compunit means?
16:21 ilmari unit class Foo; just means that 'class Foo' applies to the entire compilation unit
16:21 perlpilot every module and EVAL is a compilation unit, but not every one is a "unit class" thingy  :)
16:22 ilmari m: class Foo {}; unit class Bar;
16:22 camelia rakudo-moar 78a482: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Too late for unit-scoped class definition;␤Please use the block form.␤at <tmp>:1␤------> 3class Foo {}; unit class Bar;7⏏5<EOL>␤»
16:22 ilmari thus ^^
16:23 timotimo well, it makes the class become the compilation unit
16:23 timotimo rather than having a package with the class in it or something
16:23 grondilu ok
16:24 astj joined #perl6
16:24 perlpilot so ... anyway, what I said works, so use that :)
16:28 Ven`` joined #perl6
16:32 headcase joined #perl6
16:32 thundergnat joined #perl6
16:32 rngoodn joined #perl6
16:32 headcase joined #perl6
16:33 rngoodn What is the most used file extension? .pl6 ot .p6 or... ?
16:34 thundergnat m: say my $xʼ = 'x prime'; # grondilu
16:34 camelia rakudo-moar 78a482: OUTPUT: «x prime␤»
16:35 Cabanossi joined #perl6
16:37 piojo thundergnat: clever. I wouldn't, but clever.
16:37 timotimo i usually write .p6 scripts and .pm6 modules
16:37 xinming__ left #perl6
16:38 xinming__ joined #perl6
16:39 xinming_ joined #perl6
16:39 mcmillhj joined #perl6
16:46 leont joined #perl6
16:52 mr-foobar joined #perl6
16:57 jdv79 https://gist.github.com/anonymous/f1c7e97d4b2e15d72e40290d7840464a
16:57 jdv79 bug right? ^^
17:00 timotimo why?
17:00 timotimo oh, because that one listens
17:00 timotimo maybe the code needs to switch socket and peer around when it's a listening socket, but it didn't seem like it'd need that to me when i wrote it
17:01 timotimo huh, the peer port is also not 8888
17:02 jdv79 shouldn't the socket port be 8888 there?
17:03 timotimo [pid 22615] getpeername(32, {sa_family=AF_INET, sin_port=htons(8888), sin_addr=inet_addr("127.0.0.1")}, [128->16]) = 0
17:03 timotimo [pid 22615] getsockname(32, {sa_family=AF_INET, sin_port=htons(47298), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
17:03 timotimo so something's clearly off here.
17:05 timotimo i can't see an obvious mistake
17:10 itaipu joined #perl6
17:10 wamba joined #perl6
17:14 jdv79 both ports are wrong
17:17 jdv79 amazingly those look untested
17:18 entonian joined #perl6
17:21 jdv79 i'll but it
17:21 jdv79 *bug
17:31 jdv79 now i can't even see my new ticket as spam
17:31 jdv79 rt is unfun
17:37 headcase joined #perl6
17:40 cdg joined #perl6
17:40 timotimo did the way uv_tcp_get*name work change?
17:47 jdv79 ah, its RT#132135
17:47 synopsebot6 Link:  https://rt.perl.org/rt3/Public/Bug/Display.html?id=132135
17:50 timotimo jdv79: rakudo is just passing on what moarvm got from the get*name call, somehow it ends up bogus
17:50 timotimo c: 2017.07,2017.08,2017.09 start react whenever IO::Socket::Async.listen(<0.0.0.0>,8888) {say $_.socket-port; say $_.peer-port}; sleep 1;IO::Socket::Async.connect(<0.0.0.0>,8888);sleep 1
17:51 committable6 timotimo, ¦2017.07: «» ¦2017.08: «47138␤55523» ¦2017.09: «47138␤55779»
17:51 samcv joined #perl6
17:52 timotimo c: head start react whenever IO::Socket::Async.listen(<0.0.0.0>,8888) {say $_.socket-port; say $_.peer-port}; sleep 1;given IO::Socket::Async.connect(<0.0.0.0>,8888).result { .host-port.say; .peer-port.say } ;sleep 1
17:52 committable6 timotimo, ¦head: «Cannot find this revision (did you mean “Bend”?)»
17:52 timotimo c: HEAD start react whenever IO::Socket::Async.listen(<0.0.0.0>,8888) {say $_.socket-port; say $_.peer-port}; sleep 1;given IO::Socket::Async.connect(<0.0.0.0>,8888).result { .host-port.say; .peer-port.say } ;sleep 1
17:52 committable6 timotimo, ¦HEAD(78a4824): «47138␤No such method 'host-port' for invocant of type 'IO::Socket::Async'␤  in block <unit> at /tmp/TfkaLjGIMl line 1␤␤996 «exit code = 1»»
17:52 timotimo c: HEAD start react whenever IO::Socket::Async.listen(<0.0.0.0>,8888) {say $_.socket-port; say $_.peer-port}; sleep 1;given IO::Socket::Async.connect(<0.0.0.0>,8888).result { .socket-port.say; .peer-port.say } ;sleep 1
17:52 committable6 timotimo, ¦HEAD(78a4824): «47138␤3300␤3300␤47138»
17:52 andrzejku joined #perl6
17:53 timotimo maybe it actually returned an error
17:53 timotimo no, it returns 0, as if it had succeeded
17:55 grondilu m: class A does Numeric { multi method Numeric { NaN } }; multi infix:<+>(A $, A $) { 1 }; say [+] A.new
17:55 camelia rakudo-moar 78a482: OUTPUT: «NaN␤»
17:55 grondilu m: class A does Numeric { multi method Numeric { NaN } }; multi infix:<+>(A $, A $) { 1 }; say [+] A.new, A.new
17:55 camelia rakudo-moar 78a482: OUTPUT: «1␤»
17:56 grondilu what must I do to overload the behavior of [+] with one element?
17:56 timotimo oh ffs, the mvmroot macro is making it impossible to step into the interesting code
17:57 grondilu m: class A does Numeric { multi method Numeric { NaN } }; multi infix:<+>(A $, A $x?) { 1 }; say [+] A.new, A.new
17:57 camelia rakudo-moar 78a482: OUTPUT: «1␤»
17:57 grondilu m: class A does Numeric { multi method Numeric { NaN } }; multi infix:<+>(A $, A $x?) { 1 }; say [+] A.new
17:57 camelia rakudo-moar 78a482: OUTPUT: «NaN␤»
17:57 leont joined #perl6
17:57 grondilu m: class A does Numeric { multi method Numeric { NaN } }; multi infix:<+>(A $) { 1 }; say [+] A.new
17:57 camelia rakudo-moar 78a482: OUTPUT: «1␤»
17:57 grondilu ^I guess this will do
18:00 AlexDaniel https://code-golf.io/ # π and ? tasks are waiting for their heroes
18:05 jdv79 my c-fu is weak but it looks "ok"
18:06 timotimo jdv79: yeah but all the values are garbage?!? :( :(
18:06 timotimo https://github.com/bnoordhuis/libuv-chat/blob/master/deps/uv/test/test-getsockname.c - here's libuv example code using getsockname
18:06 jdv79 they are; oddly
18:12 headcase joined #perl6
18:14 headcase joined #perl6
18:16 headcase joined #perl6
18:19 cdg joined #perl6
18:34 Cabanossi joined #perl6
18:45 TEttinger joined #perl6
18:46 geekosaur joined #perl6
19:03 |oLa|1 joined #perl6
19:08 grondilu AlexDaniel: maybe we used different tricks for Pascal's triangle
19:13 AlexDaniel grondilu: then 32 is possible
19:13 vendethiel- joined #perl6
19:16 AlexDaniel grondilu: nevermind I think I just did 31
19:17 AlexDaniel the website is broken but it is 31
19:22 mr-foobar joined #perl6
19:23 moritz for my current book project I wrote a small too that splits a PDF file into separate files per chapter: https://gist.github.com/moritz/8cd941011b5a947e5401ce23fe279e84
19:23 moritz s/too/tool/
19:24 moritz it uses bookmarks (what you see as side bars in most PDF readers) to determine the chapter boundaries
19:24 moritz of course, pdftk does the heavy listing, but I still found it useful :-)
19:24 Zoffix m: say +combinations(8,$_) for 0..8
19:24 camelia rakudo-moar 78a482: OUTPUT: «1␤8␤28␤56␤70␤56␤28␤8␤1␤»
19:25 Zoffix m: for 0..20 -> $row { say +combinations(8,$row) for 0..$row; say "|" }
19:25 camelia rakudo-moar 78a482: OUTPUT: «1␤|␤8␤8␤|␤28␤28␤28␤|␤56␤56␤56␤56␤|␤70␤70␤70␤70␤70␤|␤56␤56␤56␤56␤56␤56␤|␤28␤28␤28␤28␤28␤28␤28␤|␤8␤8␤8␤8␤8␤8␤8␤8␤|␤1␤1␤1␤1␤1␤1␤1␤1␤1␤|␤0␤0␤0␤0…»
19:26 Zoffix boo
19:26 Zoffix oh
19:26 Zoffix m: for 0..20 -> $row { say +combinations($row,$_) for 0..$row; say "|" }
19:26 camelia rakudo-moar 78a482: OUTPUT: «1␤|␤1␤1␤|␤1␤2␤1␤|␤1␤3␤3␤1␤|␤1␤4␤6␤4␤1␤|␤1␤5␤10␤10␤5␤1␤|␤1␤6␤15␤20␤15␤6␤1␤|␤1␤7␤21␤35␤35␤21␤7␤1␤|␤1␤8␤28␤56␤70␤56␤28␤8␤1␤|␤1␤9␤36␤84␤126␤…»
19:26 moritz better :-)
19:29 AlexDaniel Zoffix: oh wow
19:29 Zoffix :)
19:29 AlexDaniel Zoffix: if only “combinations” was a shorter word, right?
19:30 Zoffix Yeah heh
19:30 AlexDaniel Zoffix: but that's awesome, I didn't think about it
19:30 AlexDaniel Zoffix++
19:31 mcmillhj joined #perl6
19:32 grondilu maybe we could cheat and put a shorter alias in the core just for code golf contests :P
19:32 Zoffix >:D
19:34 AlexDaniel even if it was called “c”, I still find it a bit hard to get it under 40 characters
19:34 AlexDaniel buuut maybe, maybe…
19:36 grondilu I'm a bit confused about what Numeric does exactly.  If I write an hyper-complex class, should it implement Numeric?  It does algebra, but it's not a scalar.
19:36 grondilu Also I'm not sure I see the advantage of implementing Numeric.
19:37 grondilu Like I was hoping defining &[*] would automatically give me &[**], but apparently not :/
19:37 Zoffix 0.o
19:37 grondilu &[**] falls back to $^a.Numeric**$^b.Numeric IIRC
19:38 grondilu which seems dumb to me
19:38 Zoffix Why dumb?
19:38 grondilu shouldn't &[**] be [*] $^a xx $^n
19:39 Zoffix If you wanted 1000 or more times slower, sure :)
19:39 Zoffix Power op just uses C's pow. What you wrote generates a Rakudo lazy Seq then consumes it, while calling the multiplication op $^n-1 times
19:40 moritz also, what if $^n isn't integer?
19:40 grondilu it was just an example
19:40 grondilu my point was that instead of falling back to .Numeric, it should use the multiplication
19:40 grondilu moritz: good point
19:41 grondilu though I can restrict that case in the signature
19:42 Zoffix But multiplication then would have to fall back to Numeric, so you made power op thousands of times slower for no good reason.
19:42 grondilu I guess there's something I don't understand about what Numeric is
19:42 Zoffix It might make more sense for whatever custom thing you're building, but not for core ops and types that are meant to work together..
19:43 grondilu I guess I'm just better off not implementing it
19:43 Zoffix grondilu: Numeric role is done by all numeric types and ops and things can typematch on it. And Numeric coercer method just asks for one of those numeric types
19:43 Zoffix m: .Numeric.^name.say for '42', '1.0', '1e0', '1+1i'
19:44 camelia rakudo-moar 78a482: OUTPUT: «Int␤Rat␤Num␤Complex␤»
19:44 grondilu Should Quaternions for instance implement Numeric?
19:45 grondilu They do in https://github.com/Util/Perl6-Math-Quaternion/blob/master/lib/Math/Quaternion.pm6
19:45 Zoffix No idea :) If their .Numeric can return one of the core types, then sure, as you get all the ops working fine for free, if the .Numeric returns just itself, then I'd expect a lot of infiniloops in dispatch that you were experiencing before
19:45 Zoffix So it's more of a "CoreNumeric" I guess rather than Numeric. At least that's my understanding of it, while working with core stuff. Dunno how designers thought of it
19:47 grondilu Interestingly enough, Complex does Numeric but has no .Numeric
19:47 grondilu m: say 1i.Numeric
19:47 camelia rakudo-moar 78a482: OUTPUT: «0+1i␤»
19:47 grondilu hum
19:47 Zoffix s: 1i, 'Numeric', \()
19:47 SourceBaby Zoffix, Sauce is at https://github.com/rakudo/rakudo/blob/78a4824b8/src/core/Numeric.pm#L5
19:48 Zoffix Just uses the one from the role that returns `self`
19:48 grondilu I see
19:49 grondilu so if there were no definition of &[**] in Complex, it would loop forever
19:49 Cabanossi joined #perl6
19:50 Zoffix m: &[**].candidates».say
19:50 camelia rakudo-moar 78a482: OUTPUT: «sub infix:<**> ($x = 1) { #`(Sub|64870056) ... }␤sub infix:<**> (\a, \b) { #`(Sub|64871576) ... }␤sub infix:<**> (Real \a, Real \b) { #`(Sub|64871424) ... }␤sub infix:<**> (Int:D \a, Int:D \b) { #`(Sub|64870512) ... }␤sub infix:<**> (int $a, int …»
19:50 Zoffix m: &[**].candidates».signature.say
19:50 camelia rakudo-moar 78a482: OUTPUT: «(($x = 1) (\a, \b) (Real \a, Real \b) (Int:D \a, Int:D \b) (int $a, int $b --> int) (Num:D \a, Num:D \b) (num $a, num $b --> num) (Rational \a, Int \b) (Complex:D \a, Complex:D \b --> Complex:D) (Real \a, Complex:D \b --> Complex:D) (Complex:D \a, Real \…»
19:50 Zoffix s: &[**], \(class {}.new, class {}.new)
19:50 SourceBaby Zoffix, Sauce is at https://github.com/rakudo/rakudo/blob/78a4824b8/src/core/Numeric.pm#L261
19:50 Zoffix yeah, looks like it
19:50 * Zoffix &
19:51 grondilu there's something fishy about all this, can't quite put my finger on it
19:53 grondilu I just don't like the idea that I *have to* define &[**]($, Int $) when I already defined &[*].  It's clearly redundant.
19:54 grondilu Just like I shouldn't have to define $a - $b.  It should automatically turn into $a + (-1)*$b
19:54 grondilu basically we should have an Algebra role.  But I guess it could be a module.
19:55 grondilu (a user module I mean)
19:56 epony joined #perl6
19:58 grondilu though ideally even Numeric should implement that role, so it would make sense to put it in the core.
19:58 rindolf joined #perl6
19:59 grondilu but then there would be the issue with the lexical scopes mentioned yesterday (IIRC), so that's not possible either.
19:59 grondilu there is just something wrong and un-satisfying imho
20:00 perlpilot yeah, we should only have to define a small number of primitives and Perl should deduce the rest!
20:00 grondilu not sure that's irony or what
20:01 mr-foobar joined #perl6
20:01 perlpilot it's perhaps 1/2 sarcasm.   While I tend to agree with you in theory, I accept that reality is always more complicated.
20:03 perlpilot If someone could come up with a scheme that works and is performant, I'm all for it  :)
20:03 moritz grondilu, perlpilot: https://gist.github.com/masak/8e082999e06bfb4d03b8d12899bbcde5
20:04 perlpilot moritz: is there a tldr on that?  :)
20:05 moritz perlpilot: not really; it's just taken the "small number of primitives" to the extreme :-)
20:05 grondilu moritz, I think I know what lambda calculus is, and I really think what I'm asking is not that deep.
20:06 lichtkind joined #perl6
20:09 mcmillhj joined #perl6
20:09 cdg joined #perl6
20:15 grondilu something like that:  https://gist.github.com/grondilu/996c4d4b8911d4b3ddb5d6fdc095e488
20:17 grondilu so a class implementing Algebra would only have to define the ADD and MULTIPLY methods
20:17 grondilu the operators would come for free
20:18 cdg_ joined #perl6
20:19 BooK m: say !''
20:19 camelia rakudo-moar 78a482: OUTPUT: «True␤»
20:19 BooK m: say !!''
20:19 camelia rakudo-moar 78a482: OUTPUT: «False␤»
20:19 headcase joined #perl6
20:19 BooK m: say ! !''
20:19 camelia rakudo-moar 78a482: OUTPUT: «False␤»
20:19 BooK m: say ! ! ''
20:19 camelia rakudo-moar 78a482: OUTPUT: «False␤»
20:19 BooK m: say !! ''
20:19 camelia rakudo-moar 78a482: OUTPUT: «Non ast passed to WANTED: NQPMu␤5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3say !!7⏏5 ''␤    expecting any of:␤        infix␤        infix stopper␤        postfix␤        statement end␤ …»
20:20 BooK I guess because ?? !!
20:20 BooK but confusing still
20:22 Aaronepower joined #perl6
20:23 Juerd m: say !!
20:23 camelia rakudo-moar 78a482: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Prefix ! requires an argument, but no valid term found␤at <tmp>:1␤------> 3say !!7⏏5<EOL>␤    expecting any of:␤        prefix␤»
20:23 Juerd m: !!
20:23 camelia rakudo-moar 78a482: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Prefix ! requires an argument, but no valid term found␤at <tmp>:1␤------> 3!!7⏏5<EOL>␤    expecting any of:␤        prefix␤»
20:23 Juerd In the REPL, !! by itself results in Nil
20:23 BooK the error message didn't help: I remembered about the ternary when grepping the source for !! showed it to me
20:24 Aaronepower What's the best way to get a list of files of a certain extension in a directory? I tried using IO::Glob, but it doesn't seem to work.
20:25 headcase joined #perl6
20:25 Juerd m: !! while 1
20:25 camelia rakudo-moar 78a482: OUTPUT: «===SORRY!===␤Cannot find method 'okifnil' on object of type NQPMu␤»
20:25 Juerd What the... :D
20:26 perlpilot neat.
20:26 perlpilot crazy.  but neat.
20:26 moritz Aaronepower: dir($path).grep(/\.md$/)
20:27 BooK ! is a naughty character anyway
20:28 moritz m: ! while 1
20:28 camelia rakudo-moar 78a482: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Undeclared routine:␤    while used at line 1␤␤»
20:29 BooK 0.o
20:29 geekosaur there aren't that many actual keywords in perl 6
20:30 moritz Juerd's example seems to be a bug in EXPR
20:30 BooK if would kinda neat if the only one was 'goto'
20:30 moritz nah, 'comefrom' :-)
20:31 Aaronepower moritz: How do I do recursive?
20:33 moritz Aaronepower: File::Find or Path::Iterator, I think
20:38 BooK moritz: is perl6 powerful enough to have a comefrom?
20:40 moritz BooK: I have not the slightest idea :-)
20:43 Zoffix BooK: any error mentioning AST is a bug as it's just guts leaking out. It should be filed as a ticket
21:00 mr-foobar joined #perl6
21:04 Cabanossi joined #perl6
21:11 BooK Zoffix: i will
21:13 itaipu joined #perl6
21:16 Zoffix Thanks.
21:22 khw joined #perl6
21:24 piojo joined #perl6
21:29 thundergnat joined #perl6
21:31 thundergnat Is there any way to expose the transform used by the collate method to the user?
21:32 thundergnat so it could, for instance, be used as a single arity transform modifier to sort?
21:32 * thundergnat probably something I should be asking samcv...
21:33 samcv hello
21:33 samcv transform?
21:33 thundergnat ooo!
21:33 samcv do you understand how the UCA works?
21:33 thundergnat umm. Take a look at this gist https://gist.github.com/thundergnat/3d71a3e1b24feec533612dd7e2fa94e6
21:34 samcv not sure what you're trying to do?
21:35 thundergnat unicmp must use some kind of comparison to figure out the order, I was wondering if it could be coerced into a transform of some kind
21:35 samcv well
21:35 samcv it's complex
21:35 thundergnat I maintain the Sort::Naturally module. I'm trying to make it work with collation
21:36 samcv thundergnat, read https://cry.nu/perl6/grant-status-update-2/
21:36 samcv where i talk a bit about how the uca works
21:36 samcv also read the docs on MVM collation https://github.com/MoarVM/MoarVM/blob/master/docs/collation.asciidoc
21:36 kyan joined #perl6
21:37 samcv for detail on how it's actually implemented
21:37 timotimo does collation only work if there's two input strings and is only able to give a less/same/more output?
21:37 thundergnat Could we get a routine that returns that array and a three character string. [.0706.0020.0002].chars or some such
21:38 thundergnat s/and/as/
21:38 thundergnat for each character in the string
21:39 samcv you want to return the array data?
21:39 samcv for each character?
21:39 samcv i mean. i'm not sure why .collate isn't sufficient?
21:39 samcv what are you trying to achieve?
21:39 samcv that .collate does not do
21:40 timotimo "natural sort" is a big thing
21:40 samcv define that
21:40 thundergnat Well, what I want is a transform function, but the array data would allow that
21:40 timotimo i.e. sorting 20 after 3 even though 2 comes before 3
21:40 samcv so you want numeric sort?
21:40 thundergnat m:https://gist.github.com/thundergnat/3d71a3e1b24feec533612dd7e2fa94e6
21:40 evalable6 thundergnat, It looks like a URL, but mime type is ‘text/html; charset=utf-8’ while I was expecting something with ‘text/plain’ or ‘perl’ in it. I can only understand raw links, sorry.
21:40 samcv is that all we're talking about?
21:40 thundergnat m: https://gist.github.com/thundergnat/3d71a3e1b24feec533612dd7e2fa94e6
21:40 camelia rakudo-moar 78a482: OUTPUT: «(144th 17th 2 32nd 3rd 95 æon Æon aether apple außen Autumn Bald ball Évian evoke)␤(2 3rd 17th 32nd 95 144th aether apple außen Autumn Bald ball evoke Æon æon Évian)␤(2 3rd 17th 32nd 95 144th æon Æon aether apple außen Autumn Bald ball Év…»
21:40 samcv just .collate but sorting numbers differently?
21:41 thundergnat The first list is collated, the second is naturally sorted and collated ^^
21:41 kyan_ joined #perl6
21:41 samcv well i could just add that feature
21:41 samcv that seems like a much easier way to do things
21:42 samcv though it sounds slightly annoying but. i mean implementing the UCA in perl6 again would be a pain
21:42 samcv it took me months to write it. so the raw data is really i mean. idk how useful it is
21:42 thundergnat I was just asking if the is a user exposed way to access the collation data so it can be used in a transform routine
21:43 samcv also. what about data of multiple codepoints in a row?
21:43 samcv how would that be accessed?
21:43 kyan_ Hi! When I try to install zef, (using the instrtuctions in the README), it gives me an error "Aborting due to test failure: zef:ver<0.1.29>:auth<github:ugexe>"
21:43 samcv but i'd ask you to read https://github.com/MoarVM/MoarVM/blob/master/docs/collation.asciidoc
21:43 timotimo kyan_: can you start out by telling us what "perl6 --version" gives you?
21:43 kyan_ This is Rakudo version 2017.05 built on MoarVM version 2017.05
21:44 timotimo okay, perhaps you'll need an older zef for that
21:44 samcv thundergnat, we don't actually traverse the entire strings either. i have lots of optimizations. and it'd be much better just to add natural sort capabilities to moarvm
21:44 kyan_ Ah, thanks. I'll try one from around then.
21:44 timotimo good luck!
21:45 timotimo though depending on what other modules you'll be installing and using, perhaps there'll be more modules you'll need older versions of
21:45 headcase joined #perl6
21:45 thundergnat samcv ok. I'll read that in depth, I don't know enough to know if what I'm asking is unreasonable. The ncollate routine in the aformentioned gist works, it's just ugly
21:45 timotimo not terribly likely, but possible
21:46 itaipu joined #perl6
21:46 samcv thundergnat, yes i'd say read that document. and also i can maybe add natural sort. but then i'd have to add the ability to backtrack which would be annoying. or make it much slower since i'd have to detect all numbers and hm
21:46 kyan_ yay, it worked ! Thanks :)
21:47 headcase_ joined #perl6
21:47 timotimo cool
21:48 samcv we iterate both strings into a ringbuffer of size 3. when we find a differeing codepoint. we then use that data, possibly further down the string as well to sort with. but if we had to check if the last thing was a number. then we may care about ones behind that as well. and what if there's numbers going back even further. we would have to backtrack and find it again. sounds annoying
21:48 samcv but i could figure out a way to do it if it seems important enough
21:48 kyan_ Hm, doesn't want to install readline though, since /usr/lib64/libreadline.so isn't a ELF file (the real libreadline.so is /lib64/libreadline.so.6.3)
21:49 timotimo ah, yes, it's probably a little linker script, isn't it?
21:49 kyan_ Cannot locate native library 'libreadline.so': /usr/lib64/libreadline.so: invalid ELF header — yeah
21:49 timotimo you can git clone the readline module and enter the exact version in the "is native" traits it uses; it probably has one variable up top where that can be set
21:49 thundergnat samcv don't add stuff to core unnecessarily, Sort::Naturally lives quit happily in a module. This was more a "I wonder if" question than a "I gotta have"
21:50 samcv well
21:50 thundergnat *quite
21:50 timotimo my constant LIB = ( 'readline' );
21:50 samcv doesn't seem that unneccisary. seems to be a common use case to sort numbers properly
21:50 timotimo it could be enough to change that to ( 'readline', v6.3 )
21:50 timotimo who here is good with the nativecall library finding code?
21:51 epony joined #perl6
21:52 samcv i mean it'd be slower. and we could have a ringbuffer which expands. and it expands to the size of how many digits it has encountered. then also, what's the max length that is ok
21:52 thundergnat It isn't for a general case though, only when you're sorting lists with a mix of strings and 'numeric' strings together. Not worth slowing down or bulking up the general case.
21:52 samcv of digits length. and do we accept unicode digits too, or just numbers
21:52 samcv no i would never do that thundergnat :)
21:52 samcv slow down the general case
21:53 kyan_ Ok, I just changed that line...
21:53 samcv i'm just saying it could be done
21:53 kyan_ Now it wants "ufo" or "panda" to build it :P
21:53 samcv and i'd rather do that then expose the data. since that would be much more work than that one line of code...
21:53 thundergnat You worked too hard to make it so good, don't make it worse on my behalf. Kudos, by the way.
21:54 mr-foobar joined #perl6
21:54 samcv Numbers. A customization may be desired to allow sorting numbers in numeric order. If strings including numbers are merely sorted alphabetically, the string “A-10” comes before the string “A-2”, which is often not desired. This behavior can be customized, but it is complicated by ambiguities in recognizing numbers within strings (because they may be formatted according to different language conventions). Once each number is recognized, it
21:54 samcv can be preprocessed to convert it into a format that allows for correct numeric sorting, such as a textual version of the IEEE numeric format.
21:54 kyan_ heh, ~/.perl6/bin/zef install ufo worked
21:54 ugexe m: use NativeCall; sub foo() is native("xxx", v1.2) { }; foo()
21:54 camelia rakudo-moar 78a482: OUTPUT: «Cannot locate native library 'libxxx.so.1.2': libxxx.so.1.2: cannot open shared object file: No such file or directory␤  in method setup at /home/camelia/rakudo-m-inst-1/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 320…»
21:55 kyan_ Hm, didn't work, trying ~/.perl6/bin/zef install panda instead :)
21:55 timotimo no, not ufo
21:55 timotimo you can just "zef install ." inside the folder
21:55 timotimo we should throw ufo and panda out of the readme
21:55 kyan_ Oh, ok, thanks!
21:55 thundergnat samcb or you could use something similar to the &natural transform in that gist.
21:56 timotimo haha
21:56 timotimo i opened an issue about "shouldn't mention ufo any more" in november 2016
21:56 timotimo i should open a pull request instaed so the repo owner can just casually click "merge" and be done with it
21:57 kyan_ Yay, Readline working in perl6 repl now! Thanks :)
21:58 timotimo done
21:59 timotimo DrForr: https://github.com/drforr/perl6-readline/pull/19 - if you would? :)
22:04 Cabanossi joined #perl6
22:20 AlexDaniel joined #perl6
22:24 mr-foobar joined #perl6
22:34 skids joined #perl6
22:35 pecastro joined #perl6
22:37 epony joined #perl6
22:46 headcase joined #perl6
22:50 Cabanossi joined #perl6
23:11 samcv thundergnat,
23:12 samcv this is acceptable order? (Autumn Bald aether apple außen ball evoke Æon Évian æon 2 3rd 17th 32nd 95 144th)
23:16 thundergnat samcv Traditionally numerics sort before alphabetics but that wouldn't be the end of the word.
23:16 thundergnat *world
23:17 samcv but something similar to that?
23:17 thundergnat Yes
23:19 cdg joined #perl6
23:19 thundergnat Umm. Wait a minute. I would expect Bald to sort just before ball and Autumn to come after außen
23:19 samcv yeah ignore that
23:19 samcv the numbers are sorting right is the main thing
23:20 samcv (æon Æon aether apple außen Autumn Bald ball Évian evoke 2 3rd 17th 32nd 95 144th)
23:20 samcv ok there we go
23:21 thundergnat m: https://gist.github.com/thundergnat/3d71a3e1b24feec533612dd7e2fa94e6
23:21 camelia rakudo-moar 78a482: OUTPUT: «(2 3rd 17th 32nd 95 144th æon Æon aether apple außen Autumn Bald ball Évian evoke)␤»
23:22 samcv well UCA sorts numbers after letters so that's why it sorts numbers last
23:22 samcv though i did do some quick hacks for numbers
23:22 audiatorix joined #perl6
23:25 BenGoldberg joined #perl6
23:26 samcv so it seems to be doable
23:26 samcv so it will likely get implemented. sometimes soonish
23:28 thundergnat Cool. would it deal with numbers embedded in alphabetic strings?
23:28 thundergnat m: https://gist.github.com/thundergnat/3d71a3e1b24feec533612dd7e2fa94e6
23:28 camelia rakudo-moar 78a482: OUTPUT: «(2 3rd 17th 32nd 95 144th æon Æon aether apple außen Autumn Bald ball Évian evoke file3 file17 file21)␤»
23:29 samcv thundergnat, yes
23:29 thundergnat samcv++
23:29 thundergnat awesome
23:33 samcv thundergnat, if you want to try it out https://github.com/samcv/MoarVM/tree/natural
23:33 samcv let me know if there's any issues, aside from numbers sorting after letters
23:35 samcv will speed up time for me to implement it by a lot if you can test it some. especially testing things like numbers embedded in text, and also testing the end of line. i.e. '10' unicmp '1' how there's no text after it? i've tested the simple cases. but there may be more
23:36 samcv where if you imagine it, numbers, non numbers and end of string are three distinct entities that need testing in all their combinations of those three
23:36 samcv within string and end of string etc being the differing codepoints between the two strings for example
23:37 samcv i tested this at least and seems to work:
23:37 samcv for ^10000000 {  my $a = 1000.rand.Int; my $b = 1000.rand.Int; if ("$a-" unicmp "$b") |("$a" unicmp "$b") !== ($a cmp $b) { die "aaaa $a b $b" } }
23:49 thundergnat samcv I'm running out of time for tonight,family stuff and work tomorrow but I'll see if I can look at it tomorrow.
23:49 samcv no problem. i'm not in a rush
23:50 thundergnat I really didn't mean for you to have to implement it, I was just really asking somewhat uninformed questions... but thanks.
23:56 timotimo another case of perl6 devs underpromising and overdelivering? %)
23:56 * timotimo disappears into bed

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

Perl 6 | Reference Documentation | Rakudo