»ö« 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.
[Coke] twitter.com/cokefloats/status/9103...4732293120 - two proposals this round. 01:47
AlexDaniel m: say (<a b c>,<x y z>) Z (2,1) 02:29
camelia (((a b c) 2) ((x y z) 1))
AlexDaniel is there any easy way to get ‘c’, ‘y’ from that ^ ?
m: say zip (<a b c>,<x y z>), (2,1), :with({$^a[$^b]})' 02:31
camelia 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
AlexDaniel m: say zip (<a b c>,<x y z>), (2,1), :with({$^a[$^b]})
camelia (c y)
AlexDaniel m: say (<a b c>,<x y z>) Z[&({$^a[$^b]})] (2,1) 02:35
camelia (c y)
Geth whateverable: c6aa350dee | (Daniel Green)++ | 2 files
Add memory used to uptime command

Also log the output of the uptime command at the end of a test run for each bot.
Addresses part of #197.
03:40
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:45
raschipi docs.perl6.org/type/Signature#inde..._Modifiers ? 03:48
todd Perfect! Thank you! Bye bye 03:49
sacomo is there a reason for this behavior: 04:17
m: "perl6" ==> uc() ==> my $str; say $str;
camelia [PERL6]
sacomo m: "perl6" ==> uc() ==> say(); 04:18
camelia PERL6
sacomo straight to say() prints a Str, but assigning to $str creates an Array.
m: "perl6" ==> uc() ==> &{ .^name.say }(); 04:20
camelia Str
AlexDaniel goddamn Roman numerals 04:35
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 docs.perl6.org/type.html ?
todd doesn't really help. I want to know 32 bit, 64 bit integers, etc, when I am calling a system library 04:53
raschipi docs.perl6.org/language/nativecall...ing_Values ? 04:54
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:55
AlexDaniel ok, now I can finally sleep peacefully code-golf.io/ 06:23
TEttinger u: ̇
unicodable6 TEttinger, Found nothing!
TEttinger u: 775
unicodable6 TEttinger, Found nothing!
AlexDaniel u: 0x775 06:26
unicodable6 AlexDaniel, U+0775 ARABIC LETTER FARSI YEH WITH EXTENDED ARABIC-INDIC DIGIT TWO ABOVE [Lo] (ݵ)
AlexDaniel TEttinger: what were you looking for? Maybe I know
TEttinger nah, it was some weird char that was in a case conversion 06:28
turkish I with a dot above, when made lower-case, became ascii i with an extra dot added 06:29
the extra dot being a diacritic
AlexDaniel u: a􏿽xCC􏿽x87 06:30
unicodable6 AlexDaniel, U+0227 LATIN SMALL LETTER A WITH DOT ABOVE [Ll] (ȧ)
AlexDaniel u: _̇
unicodable6 AlexDaniel, U+005F LOW LINE [Pc] (_)
AlexDaniel, U+0307 COMBINING DOT ABOVE [Mn] ( ̇)
AlexDaniel TEttinger: oh, I see now. Unicodable does not really understand combining characters 06:31
it combines with a space before and I guess it ends up with an empty string
TEttinger huh
AlexDaniel uhhh… IIRC it wasn't trivial to fix this issue 06:32
by the time the bot gets the string, the combined thingy is already eaten by IRC::Client, or something…
so you have to restore it somehow
at least, that's what I can remember about this issue 06:33
u-ou How do I install a module from inside its git repo? 06:44
is there some standard way?
moritz zef install .
u-ou it fails on zef
wait 06:45
nvm
that's probably what I want
I can zef the last commit that works
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? 06:56
tyil hmm, docs for Bailador are conflicting 07:07
one page says to use `method`, other page says to use `to`
(both give me the same error, though)
Deejizzel So what's up everybody I'm new 07:08
tyil Deejizzel: perl 6 is up
trying to get controllers in bailador to not error out 07:09
and preferably have the controller methods able to get the request body
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:34
mrdside привет 07:44
piojo Alternatively, is it possible to close and reopen stdout with :!buffer? 07:59
piojo Wow, this actually seems to work: 08:13
$*OUT = $*OUT.open(:!buffer); $*ERR = $*ERR.open(:!buffer);
I can't believe the API exists to open an already open handle 08:14
todd Hi All, I am looking at 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
camelia Dynamic variable $*OS not found
in block <unit> at <tmp> line 1
moritz m: say $*KERNEL
camelia linux (4.4.70.18.9.default)
moritz todd: ^^ something like this? 08:25
DrForr pokes his head in for a few minutes in between setting stuff up.
todd $ perl6 -e 'say $*KERNEL' linux (3.10.0.693.1.1.el.7.x.86._.64) 08:26
that will work. Is there anythig that just says "windows" or "linux"? 08:27
Any of you guys on Windows? what does `perl6 -e 'say $*KERNEL' ` give you? 08:28
moritz m: say $*KERNEL.^name 08:29
camelia Kernel
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: github.com/rakudo/rakudo/commit/29863a0bdc
camelia (Int)
moritz no docs yet for type Kernel :(
m: say Kernel.^methods
camelia (BUILD name version release hardware arch archname bits signals signal Str gist auth signature desc)
tyil todd: use split on teh output of $*KERNEL
and take the first piece
moritz m: say $*KERNEL.name
camelia linux
tyil or what moritz just did
he's better than I am with this
todd $ perl6 -e 'say $*KERNEL.name' linux 08:31
a thing of beauty. Thank you!
pmurias we have a fudged test in roast for: my int $x; say $x.WHAT being int not sure if I should remove it?
todd Anyoine running Windows? What does `perl6 -e 'say $*KERNEL.name'` give you? 08:33
tyil tfw everyone awake is sane enough to avoid windows 08:35
moritz any <MSWin32 mingw msys cygwin> 08:38
according to roast
piojo It says win32, even in cygwin and msys. 08:41
todd chuckle. Win32 thank you! 08:46
bye bye
u-ou m: $x 09:25
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$x' is not declared
at <tmp>:1
------> 3<BOL>7⏏5$x
perlawhirl erm 10:07
there are 2 modules listed on the ecosystem called Net::ZMQ
which one does zef install if i ask, and does it pick the "right" one
github.com/arnsholt/Net-ZMQ 10:08
github.com/gabrielash/perl6-zmq
todd Hi All, Anyone have a link to a list of reserved words/ Stuff line @*ARGS, $*PROGRAM-NAME, $?FILE, etc.? 10:16
moritz those are variables, not reserved words 10:19
jnthn todd: docs.perl6.org/language/variables#..._variables and below. Also what moritz said :) 10:20
todd Awesome! Thank you! 10:22
bye bye 10:30
lizmat news.perlfoundation.org/2017/09/gra...l-6-p.html # timotimo++ 10:32
fluca1978 I'm a little confused about "precedence drop": when should I use and to which purpose? 10:34
fluca1978 for instance, what is the real difference between 10:39
$f.foo( ['a', 'b', 'c'] );
and
$f.foo: ['a', 'b', 'c'] ;
jnthn Nothing in that case. It means the rest of the statement will be taken as the argument list. 10:40
my ($x, $y) = $f.foo(1), $f.bar(2); # puts the results into $x and $y 10:41
jnthn my ($x, $y) = $f.foo: 1, $f.bar: 2; # actually means $f.foo(1, $.bar(2)) 10:41
oops, $f.bar
Which in that case wouldn't be what you wanted :)
piojo jnthn: so it's just another way to pass arguments? 10:42
jnthn Yes
Sometimes it's clearer and saves parentheses clutter
I especially like it in things like
$lock.protect: {
...code here...
}
Then you don't need the ); on the end
Since } is a statement terminator 10:43
fluca1978 thanks jnthn, but can I use it only on methods or also sub?
sacomo hi everyone
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:43
jnthn fluca1978: It's only for methods; the equivalent for sub calls is to just not use parens at all 10:44
some-sub 1, 2, another-sub 3, 4; # same as some-sub(1, 2, another-sub(3, 4))
piojo jnthn: thanks, that inconsistency had been tripping me up.
fluca1978 thanks jnthn 10:45
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.
pmurias bartolin: is anything blocking the JVM backend or just a lack of tuits? 11:04
timotimo y'all forgot about $*DISTRO.is-win last night :) 12:02
moritz or maybe we never knew about it in the first place :-)
sacomo hello 12:06
timotimo o/
sacomo is this the ==> feed operator is intended behavior? 12:07
m: "perl6" ==> uc() ==> say();
camelia PERL6
sacomo m: "perl6" ==> uc() ==> my $str; say $str; 12:08
camelia [PERL6]
sacomo see how it created the Array?
m: "perl6" ==> uc() ==> &{ .^name.say }();
camelia Str
sacomo it seems to happen any time a single value is fed into a $ container 12:12
pmurias jnthn: Iterable is assumed to be hard baked into perl 6 semantics? nqp::p6decontrv works differently depending on it's definition 12:14
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
m: ("perl6", "foobar") ==> say()
camelia (perl6 foobar)
timotimo oh, or not i guess
timotimo tbh i haven't used the feed operators in a loooong while 12:18
jnthn It just calls .push on the target 12:19
That will vivify an Array inside of the Scalar container
So yeah, no surprise there.
sacomo ok
m: %{:name('Perl6')} ==> my %h; say %h;
camelia {name => Perl6}
sacomo m: 6 ==> my $i; say $i; 12:20
camelia [6]
jnthn pmurias: What does "depending on its definition" mean?
jnthn pmurias: But yeah, iirc that op checks if there's an Iterable and re-wraps the return value if so 12:21
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
jnthn pmurias: Sure 12:23
sacomo: The point of ==> is producer/consumer list processing 12:24
sacomo: At some point in the future it'll likely schedule each phase on a separate thread
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
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 :)
grondilu m: class Foo { constant Foo foo .= new }; 15:38
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing initializer on constant declaration
at <tmp>:1
------> 3class Foo { constant Foo7⏏5 foo .= new };
grondilu m: class Foo { constant foo = Foo.new };
camelia 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
grondilu I suppose it's because the constant evaluation occurs before class composition? 15:38
kind of annoying. I have a compunit class and I want it to export particular instances as constants. Can't I do that? 15:44
piojo m: class Foo {...}; class Foo { constant foo = Foo.new; } 15:45
camelia 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
piojo too bad.
grondilu Basically a Vector class exporting e0, e1, etc as the orthonormal basis 15:46
timotimo m: class Test; constant foo = $?CLASS.new 15:47
camelia 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
timotimo m: unit class Test; constant foo = $?CLASS.new
camelia 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
piojo ‎grondilu‎: it works if you explicitly define method new 15:47
grondilu I did
timotimo i'd suggest working with an EXPORT sub
grondilu oh wait
piojo m: class Foo { method new() { }; constant foo = Foo.new; }
camelia ( no output )
grondilu I didn't. My bad.
though I don't want to mess up the inheritage tree of new 15:48
*inheritance 15:49
piojo ‎grondilu‎: how about a helper method, then?
grondilu ?
piojo method Create { new(); }
not sure if that works, though
piojo m: class Foo { method Create() { $?CLASS.new(); }; constant foo = Foo.Create; } 15:50
camelia 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 …
grondilu btw don't use uppercase in methods 15:51
(or rather firstcase, maybe) 15:52
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.
grondilu first letter in uppercase is for class names, IIRC
piojo perl6 certainly has more conventions available--it doesn't need case as much as other languages 15:53
because of being able to use dashes in names 15:54
I thought that was blasphemy when I first saw it, but it's pretty cool.
grondilu yeah it's cool. I wish I could also use single quotes, though. As in Scala IIRC 15:54
timotimo "initial case"? 15:55
grondilu (or Haskell, can't quite remember)
m: say "foo".tc
camelia Foo
piojo Haskell has single quotes
timotimo wait, you're allowed single quotes though?
m: my $foo'bar = 99;
camelia ( no output )
grondilu forgot what tc stands for in .tc
piojo m: my $day's-earinings = 0;
camelia ( no output )
timotimo Title Case
grondilu oh yeah
piojo but haskell allows quote at the end, like x' for "x prime"
grondilu m: say my $foo'bar = pi
timotimo m: class Oh { method yo'yo { say "whoa, 90s!" } }; Oh.yo'yo
camelia 3.14159265358979
whoa, 90s!
timotimo oh, yes, indeed
grondilu oh boy I can use single quotes. TIL 15:56
piojo but with the same rule as dashes
grondilu m: say my $foo' = pi # even at the end of the name?
camelia 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…
grondilu ah, not at the end 15:57
perlpilot I wonder what the implications would be to allow for ' at the end of identifiers?
grondilu pretty sure it's possible in either Scala or Haskell
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
after all, in haskell you can't have: x=5; x *= 2; 15:59
so it's awfully useful to be able to refer to x' and x''
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'
camelia 13
grondilu well at least we can do that^
piojo nice!
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
piojo it doesn't work very well in the REPL, though
grondilu piojo: I think someone wrote a Physics::Units module recently
piojo grondilu: really? That would be awesome! I'll search for that, thanks
grondilu can't find it in the module repo, though :( 16:02
there was a blog entry : p6steve.wordpress.com/2017/08/18/p...-in-perl6/ 16:03
timotimo you know the slang that lets you end method names in ? and ! 16:04
probably possible to have that also let you put a ' at the end of things
grondilu I thought about writing postfix methods for units once, but the SI prefix system made it more difficult than I thought 16:07
basically I had no idea how to implement a "prefix to a suffix" 16:08
so I gave up
that's the kind of thing that would require a slang, I think
grondilu physics is more interesting without dimensions, anyway ;) 16:10
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
perlpilot grondilu: I would think it possible. 16:14
grondilu I've tried and failed
perlpilot m: class Foo { }; constant f is export = Foo.new; # something like that 16:16
camelia ( no output )
timotimo perlpilot: that's not a unit class :) 16:17
grondilu: have you tried an EXPORT sub?
grondilu oh yeah I guess that would work 16:18
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"
grondilu isn't it what compunit means? 16:20
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 :)
ilmari m: class Foo {}; unit class Bar; 16:22
camelia 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>
ilmari thus ^^
timotimo well, it makes the class become the compilation unit 16:23
rather than having a package with the class in it or something
grondilu ok
perlpilot so ... anyway, what I said works, so use that :) 16:24
rngoodn What is the most used file extension? .pl6 ot .p6 or... ? 16:33
thundergnat m: say my $xʼ = 'x prime'; # grondilu 16:34
camelia x prime
piojo thundergnat: clever. I wouldn't, but clever. 16:37
timotimo i usually write .p6 scripts and .pm6 modules
jdv79 gist.github.com/anonymous/f1c7e97d...0d7840464a 16:57
bug right? ^^
timotimo why? 17:00
oh, because that one listens
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
huh, the peer port is also not 8888 17:01
jdv79 shouldn't the socket port be 8888 there? 17:02
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
[pid 22615] getsockname(32, {sa_family=AF_INET, sin_port=htons(47298), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
so something's clearly off here.
i can't see an obvious mistake 17:05
jdv79 both ports are wrong 17:14
amazingly those look untested 17:17
jdv79 i'll but it 17:21
*bug
jdv79 now i can't even see my new ticket as spam 17:31
rt is unfun
timotimo did the way uv_tcp_get*name work change? 17:40
jdv79 ah, its RT#132135 17:47
synopsebot6 Link: rt.perl.org/rt3/Public/Bug/Display...?id=132135
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:50
committable6 timotimo, ¦2017.07: «» ¦2017.08: «47138␤55523» ¦2017.09: «47138␤55779» 17:51
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”?)»
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
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»»
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
committable6 timotimo, ¦HEAD(78a4824): «47138␤3300␤3300␤47138»
timotimo maybe it actually returned an error 17:53
no, it returns 0, as if it had succeeded
grondilu m: class A does Numeric { multi method Numeric { NaN } }; multi infix:<+>(A $, A $) { 1 }; say [+] A.new 17:55
camelia NaN
grondilu m: class A does Numeric { multi method Numeric { NaN } }; multi infix:<+>(A $, A $) { 1 }; say [+] A.new, A.new
camelia 1
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
grondilu m: class A does Numeric { multi method Numeric { NaN } }; multi infix:<+>(A $, A $x?) { 1 }; say [+] A.new, A.new 17:57
camelia 1
grondilu m: class A does Numeric { multi method Numeric { NaN } }; multi infix:<+>(A $, A $x?) { 1 }; say [+] A.new
camelia NaN
grondilu m: class A does Numeric { multi method Numeric { NaN } }; multi infix:<+>(A $) { 1 }; say [+] A.new 17:57
camelia 1
grondilu ^I guess this will do
AlexDaniel code-golf.io/ # π and 𝑒 tasks are waiting for their heroes 18:00
jdv79 my c-fu is weak but it looks "ok" 18:05
timotimo jdv79: yeah but all the values are garbage?!? :( :( 18:06
github.com/bnoordhuis/libuv-chat/b...sockname.c - here's libuv example code using getsockname
jdv79 they are; oddly
grondilu AlexDaniel: maybe we used different tricks for Pascal's triangle 19:08
AlexDaniel grondilu: then 32 is possible 19:13
AlexDaniel grondilu: nevermind I think I just did 31 19:16
AlexDaniel the website is broken but it is 31 19:17
moritz for my current book project I wrote a small too that splits a PDF file into separate files per chapter: gist.github.com/moritz/8cd941011b5...23fe279e84 19:23
s/too/tool/
it uses bookmarks (what you see as side bars in most PDF readers) to determine the chapter boundaries 19:24
of course, pdftk does the heavy listing, but I still found it useful :-)
Zoffix m: say +combinations(8,$_) for 0..8
camelia 1
8
28
56
70
56
28
8
1
Zoffix m: for 0..20 -> $row { say +combinations(8,$row) for 0..$row; say "|" } 19:25
camelia 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…
Zoffix boo 19:26
oh
m: for 0..20 -> $row { say +combinations($row,$_) for 0..$row; say "|" }
camelia 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
moritz better :-)
AlexDaniel Zoffix: oh wow 19:29
Zoffix :)
AlexDaniel Zoffix: if only “combinations” was a shorter word, right?
Zoffix Yeah heh 19:30
AlexDaniel Zoffix: but that's awesome, I didn't think about it
Zoffix++
grondilu maybe we could cheat and put a shorter alias in the core just for code golf contests :P 19:32
Zoffix >:D
AlexDaniel even if it was called “c”, I still find it a bit hard to get it under 40 characters 19:34
buuut maybe, maybe…
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:36
Like I was hoping defining &[*] would automatically give me &[**], but apparently not :/ 19:37
Zoffix 0.o
grondilu &[**] falls back to $^a.Numeric**$^b.Numeric IIRC
which seems dumb to me 19:38
Zoffix Why dumb?
grondilu shouldn't &[**] be [*] $^a xx $^n
Zoffix If you wanted 1000 or more times slower, sure :) 19:39
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
moritz also, what if $^n isn't integer? 19:40
grondilu it was just an example
my point was that instead of falling back to .Numeric, it should use the multiplication
moritz: good point
though I can restrict that case in the signature 19:41
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
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..
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
m: .Numeric.^name.say for '42', '1.0', '1e0', '1+1i'
camelia Int
Rat
Num
Complex
19:44
grondilu Should Quaternions for instance implement Numeric?
They do in github.com/Util/Perl6-Math-Quatern...ernion.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
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
grondilu Interestingly enough, Complex does Numeric but has no .Numeric 19:47
m: say 1i.Numeric
camelia 0+1i
grondilu hum
Zoffix s: 1i, 'Numeric', \()
SourceBaby Zoffix, Sauce is at github.com/rakudo/rakudo/blob/78a4...eric.pm#L5
Zoffix Just uses the one from the role that returns `self` 19:48
grondilu I see
so if there were no definition of &[**] in Complex, it would loop forever 19:49
Zoffix m: &[**].candidates».say 19:50
camelia 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 …
Zoffix m: &[**].candidates».signature.say
camelia (($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 \…
Zoffix s: &[**], \(class {}.new, class {}.new)
SourceBaby Zoffix, Sauce is at github.com/rakudo/rakudo/blob/78a4...ic.pm#L261
Zoffix yeah, looks like it
Zoffix &
grondilu there's something fishy about all this, can't quite put my finger on it 19:51
I just don't like the idea that I *have to* define &[**]($, Int $) when I already defined &[*]. It's clearly redundant. 19:53
Just like I shouldn't have to define $a - $b. It should automatically turn into $a + (-1)*$b 19:54
basically we should have an Algebra role. But I guess it could be a module.
(a user module I mean) 19:55
grondilu though ideally even Numeric should implement that role, so it would make sense to put it in the core. 19:58
grondilu but then there would be the issue with the lexical scopes mentioned yesterday (IIRC), so that's not possible either. 19:59
there is just something wrong and un-satisfying imho
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
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:01
If someone could come up with a scheme that works and is performant, I'm all for it :) 20:03
moritz grondilu, perlpilot: gist.github.com/masak/8e082999e06b...2899bbcde5
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 :-)
grondilu moritz, I think I know what lambda calculus is, and I really think what I'm asking is not that deep.
grondilu something like that: gist.github.com/grondilu/996c4d4b8...fdc095e488 20:15
so a class implementing Algebra would only have to define the ADD and MULTIPLY methods 20:17
the operators would come for free
BooK m: say !'' 20:19
camelia True
BooK m: say !!''
camelia False
BooK m: say ! !'' 20:19
camelia False
BooK m: say ! ! ''
camelia False
BooK m: say !! ''
camelia 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
BooK I guess because ?? !! 20:20
but confusing still
Juerd m: say !! 20:23
camelia 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
Juerd m: !! 20:23
camelia 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
Juerd In the REPL, !! by itself results in Nil
BooK the error message didn't help: I remembered about the ternary when grepping the source for !! showed it to me
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:24
Juerd m: !! while 1 20:25
camelia ===SORRY!===
Cannot find method 'okifnil' on object of type NQPMu
Juerd What the... :D
perlpilot neat. 20:26
crazy. but neat.
moritz Aaronepower: dir($path).grep(/\.md$/)
BooK ! is a naughty character anyway 20:27
moritz m: ! while 1 20:28
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
while used at line 1
BooK 0.o 20:29
geekosaur there aren't that many actual keywords in perl 6
moritz Juerd's example seems to be a bug in EXPR 20:30
BooK if would kinda neat if the only one was 'goto'
moritz nah, 'comefrom' :-)
Aaronepower moritz: How do I do recursive? 20:31
moritz Aaronepower: File::Find or Path::Iterator, I think 20:33
BooK moritz: is perl6 powerful enough to have a comefrom? 20:38
moritz BooK: I have not the slightest idea :-) 20:40
Zoffix BooK: any error mentioning AST is a bug as it's just guts leaking out. It should be filed as a ticket 20:43
BooK Zoffix: i will 21:11
Zoffix Thanks. 21:16
thundergnat Is there any way to expose the transform used by the collate method to the user? 21:31
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...
samcv hello 21:33
thundergnat ooo!
samcv transform?
do you understand how the UCA works?
thundergnat umm. Take a look at this gist gist.github.com/thundergnat/3d71a3...d7e2fa94e6
samcv not sure what you're trying to do? 21:34
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
it's complex
thundergnat I maintain the Sort::Naturally module. I'm trying to make it work with collation
samcv thundergnat, read cry.nu/perl6/grant-status-update-2/ 21:36
where i talk a bit about how the uca works
also read the docs on MVM collation github.com/MoarVM/MoarVM/blob/mast...n.asciidoc
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?
thundergnat Could we get a routine that returns that array and a three character string. [.0706.0020.0002].chars or some such
s/and/as/ 21:38
for each character in the string
samcv you want to return the array data? 21:39
for each character?
i mean. i'm not sure why .collate isn't sufficient?
what are you trying to achieve?
that .collate does not do
timotimo "natural sort" is a big thing 21:40
samcv define that
thundergnat Well, what I want is a transform function, but the array data would allow that
timotimo i.e. sorting 20 after 3 even though 2 comes before 3
samcv so you want numeric sort?
thundergnat m:gist.github.com/thundergnat/3d71a3...d7e2fa94e6
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.
samcv is that all we're talking about?
thundergnat m: gist.github.com/thundergnat/3d71a3...d7e2fa94e6
camelia (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…
samcv just .collate but sorting numbers differently?
thundergnat The first list is collated, the second is naturally sorted and collated ^^ 21:41
samcv well i could just add that feature 21:41
that seems like a much easier way to do things
though it sounds slightly annoying but. i mean implementing the UCA in perl6 again would be a pain 21:42
it took me months to write it. so the raw data is really i mean. idk how useful it is
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:42
samcv also. what about data of multiple codepoints in a row? 21:43
how would that be accessed?
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>"
samcv but i'd ask you to read github.com/MoarVM/MoarVM/blob/mast...n.asciidoc
timotimo kyan_: can you start out by telling us what "perl6 --version" gives you?
kyan_ This is Rakudo version 2017.05 built on MoarVM version 2017.05
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
kyan_ Ah, thanks. I'll try one from around then.
timotimo good luck!
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
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
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 :)
timotimo cool 21:47
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
but i could figure out a way to do it if it seems important enough
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)
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
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
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"
samcv well 21:50
thundergnat *quite
timotimo my constant LIB = ( 'readline' );
samcv doesn't seem that unneccisary. seems to be a common use case to sort numbers properly
timotimo it could be enough to change that to ( 'readline', v6.3 )
timotimo who here is good with the nativecall library finding code? 21:50
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.
samcv of digits length. and do we accept unicode digits too, or just numbers
no i would never do that thundergnat :)
slow down the general case
kyan_ Ok, I just changed that line... 21:53
samcv i'm just saying it could be done
kyan_ Now it wants "ufo" or "panda" to build it :P
samcv and i'd rather do that then expose the data. since that would be much more work than that one line of code...
thundergnat You worked too hard to make it so good, don't make it worse on my behalf. Kudos, by the way.
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
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.
kyan_ heh, ~/.perl6/bin/zef install ufo worked
ugexe m: use NativeCall; sub foo() is native("xxx", v1.2) { }; foo()
camelia 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…
kyan_ Hm, didn't work, trying ~/.perl6/bin/zef install panda instead :) 21:55
timotimo no, not ufo
you can just "zef install ." inside the folder
we should throw ufo and panda out of the readme
kyan_ Oh, ok, thanks!
thundergnat samcb or you could use something similar to the &natural transform in that gist.
timotimo haha 21:56
i opened an issue about "shouldn't mention ufo any more" in november 2016
i should open a pull request instaed so the repo owner can just casually click "merge" and be done with it
kyan_ Yay, Readline working in perl6 repl now! Thanks :) 21:57
timotimo done 21:58
timotimo DrForr: github.com/drforr/perl6-readline/pull/19 - if you would? :) 21:59
samcv thundergnat, 23:11
this is acceptable order? (Autumn Bald aether apple außen ball evoke Æon Évian æon 2 3rd 17th 32nd 95 144th) 23:12
thundergnat samcv Traditionally numerics sort before alphabetics but that wouldn't be the end of the word. 23:16
*world
samcv but something similar to that? 23:17
thundergnat Yes
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
the numbers are sorting right is the main thing
(æon Æon aether apple außen Autumn Bald ball Évian evoke 2 3rd 17th 32nd 95 144th) 23:20
ok there we go
thundergnat m: gist.github.com/thundergnat/3d71a3...d7e2fa94e6 23:21
camelia (2 3rd 17th 32nd 95 144th æon Æon aether apple außen Autumn Bald ball Évian evoke)
samcv well UCA sorts numbers after letters so that's why it sorts numbers last 23:22
though i did do some quick hacks for numbers
samcv so it seems to be doable 23:26
so it will likely get implemented. sometimes soonish
thundergnat Cool. would it deal with numbers embedded in alphabetic strings? 23:28
m: gist.github.com/thundergnat/3d71a3...d7e2fa94e6
camelia (2 3rd 17th 32nd 95 144th æon Æon aether apple außen Autumn Bald ball Évian evoke file3 file17 file21)
samcv thundergnat, yes 23:29
thundergnat samcv++
awesome
samcv thundergnat, if you want to try it out github.com/samcv/MoarVM/tree/natural 23:33
let me know if there's any issues, aside from numbers sorting after letters
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:35
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
within string and end of string etc being the differing codepoints between the two strings for example
i tested this at least and seems to work: 23:37
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" } }
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
thundergnat I really didn't mean for you to have to implement it, I was just really asking somewhat uninformed questions... but thanks. 23:50
timotimo another case of perl6 devs underpromising and overdelivering? %) 23:56
timotimo disappears into bed