»ö« 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. |
|||
timotimo | i'm not going to take a chance on that | 00:00 | |
teatime | timotimo: wait, when I said Red and Blue, I only meant to choose two random colors, i.e. items with qualitative rather than quantitative differences. | ||
I hope I didn't accidentally reference something bad. | |||
00:00
Kyo91 left
|
|||
teatime | (like Pokémon) | 00:00 | |
TEttinger | teatime: it's more the two-party system in US politics | ||
timotimo | i'd prefer not to spoil your innocence | 00:01 | |
or faith in humanity or whatever | |||
teatime | TEttinger: Dear god man, you had to keep talking about it until I looked, didn't you? | ||
TEttinger | I told you! | ||
I was trying to suggest why you shouldn't look! | |||
00:02
xaltotun joined
|
|||
TEttinger | well since your innocence gauge has dropped to 0, red is the party color for the US Republican party, blue for the US Democratic party, so red and blue would have political connotations | 00:03 | |
chartreuse and taupe, less so | |||
(especially because you can't really find a taupe flag in use, because no one can settle on what taupe looks like) | 00:04 | ||
00:05
Guest18 joined
|
|||
timotimo | TEttinger: that's not the connotation i was going for at all | 00:09 | |
anyway, let's forget about it | 00:10 | ||
TEttinger | oh, the halo thing | 00:11 | |
Perl Behemoth and Perl Leviathan | 00:12 | ||
(referring to the evenly-matched great beasts from the biblical Book of Revelations, also the scope of both languages is large) | 00:13 | ||
which fits with the Apocalypses term used in early Perl 6 lit, right? | |||
geekosaur | except "apocalypse" was used more in the technical sense | 00:14 | |
00:23
Guest18 left
00:27
Guest18 joined
|
|||
titsuki | zef doesn't show the alternatives when installing Term::termios by "zef install Term::termios": gist.github.com/titsuki/a5ece19802...1a3165ebd9 | 00:35 | |
Should I delete my module? | |||
00:42
Rawriful left
00:56
pecastro left
01:01
markong left
01:02
Cabanossi left
|
|||
titsuki | ok. I reported the above behavior: github.com/ugexe/zef/issues/227 | 01:03 | |
01:03
jeek left,
jeek joined
01:05
Cabanossi joined
01:06
aborazmeh joined,
aborazmeh left,
aborazmeh joined
|
|||
psch | fwiw, behemoth and leviathan are coded as first and second in the (really quite amazing) webserial Worm | 01:15 | |
so that's still at least some cultural remnant that makes these two ordered | 01:16 | ||
...but then they're both city busting monsters vOv | |||
teatime | psch: I really like The Zombie Knight. it isn't finished though and I ran out of pages again this morning. | 01:17 | |
psch | teatime: i think i read the first ~5 chapters or so, didn't really grip me | 01:18 | |
teatime | fair enough | ||
psch | teatime: i did enjoy super powereds a fair bit, until there was the reveal that something big had been going on and then the backlog was gone and i didn't keep up with the weekly chapter releases... :S | 01:20 | |
midnight moonlight was really great too, and i'm really upset that the author had to drop it for the time being | 01:21 | ||
01:21
Thrush joined
|
|||
teatime | I'm scared that will happen to zombie knight. He disappears occassionally for months at a time, presumably eventually he'll not come back. | 01:21 | |
psch | well, upset that the event that made her drop it happened, to be clear | ||
teatime | ah | 01:22 | |
Thrush | Hello! What's the best way to compare two boolean variables in Perl6? Should I use "$var1 == $var2" or "$var1 eq $var2" or something else? | ||
psch | Thrush: to be clear, you want True when both are True or both are False? | 01:23 | |
Thrush | Psch: Last week I needed to check two booleans, when they agreed. I can't remember the exact context, though, but I remember that an xor would not have worked. | 01:25 | |
01:26
cgfbee left
|
|||
psch | Thrush: that sounds like an interesting special case, which probably the context would reveal the details of :) | 01:26 | |
gfldex | Thrush: see docs.perl6.org/type/Junction | ||
psch | Thrush: in general, &infix:<==> should be fine | 01:27 | |
m: say True == True, True == False, False == False | |||
camelia | TrueFalseTrue | ||
psch | Thrush: i am definitely curious why xor/&infix:<^^> didn't work though | ||
teatime | psch: I assume the worry is that they may not be actual booleans, just something that can coerce to bool | ||
psch | oh | 01:28 | |
teatime | you could so($a) == so($b) or whatever | ||
but presumably there's a cleaner way? | |||
01:28
Zoffix joined
|
|||
Zoffix | m: gist.github.com/zoffixznet/8391d05...840c2bc6ca | 01:28 | |
camelia | Glass half full Glass half full Glass half empty |
||
Zoffix | m: gist.github.com/zoffixznet/8391d05...840c2bc6ca | ||
camelia | Glass half full Glass half full Glass half full |
||
Zoffix | Weird. It's just three calls to nqp::rand_n, but it's *always* producing `full` for the first two prints. | 01:29 | |
Thrush | pcsh: True == True worked for me, but I'm concerned that == is for numbers, which eq is for strings. (True eq True also worked for me.) | ||
Zoffix | What am I doing wrong? | ||
01:29
wamba left
|
|||
Thrush | which => while | 01:29 | |
psch | m: say Bool.^mro | ||
camelia | ((Bool) (Int) (Cool) (Any) (Mu)) | ||
gfldex | m: say so True & True; | ||
camelia | True | ||
psch | Thrush: Bool isa Int | ||
gfldex | if you care about true boolean values use a Junction | 01:30 | |
psch | m: my $a = 0 but True; say $a & $a | ||
camelia | 0 0 |
||
psch | m: my $a = 0 but True; say so $a & $a | ||
camelia | True | ||
psch | still have to coerce though | ||
teatime | Zoffix: did you know that you only have the string 'Glass half empty' one time in that script? | 01:31 | |
01:31
cgfbee joined
|
|||
teatime | gfldex: there's not an all-or-none() junction tho | 01:31 | |
psch .oO( one(all(), none()) ) | 01:32 | ||
definitely needs a builtin | |||
>_> | |||
Zoffix | teatime++ thanks | ||
teatime | Zoffix: sometimes you need a simple mind to find a simple problem :) | 01:33 | |
Zoffix | :) | 01:34 | |
psch | Thrush: in any case, &infix:<==> should work unless your operands have their own .Int | ||
Thrush: well, or they inherit one somewhere i suppose | |||
Thrush: alternatively you can use the wonderfully concise and comprehensible infix operator [&({$^a.so eqv $^b.so})] | 01:35 | ||
...you probably shouldn't though, instead maybe implement .Bool on your classes and then use &infix:<^^> | |||
i'm making bad jokes, i probably shouldn't have logged in anymore, given the time and all, g'night~ | 01:36 | ||
Zoffix | m: for True, True, False, False, True, False -> $a, $b { say ($a + $b) %% 2 } | 01:37 | |
camelia | True True False |
||
Zoffix | m: for True, True, False, False, True, False -> $a, $b { say ?$a === ?$b } | ||
camelia | True True False |
||
01:38
Zoffix left
|
|||
gfldex .oO( One needs to dig deep into the typesystem to tell what is true. ) | 01:40 | ||
the docs are quite thin in that area | 01:42 | ||
they don't really tell where a True is comming from. They just state: There is an enum of True and False. Good luck! | 01:43 | ||
I think I better practice with a blogpost first before I take that topic on in the docs. | 01:44 | ||
Xliff | If I have a class that does List, can I override methods? | 02:00 | |
m: class A { also does List; method first(+@a) { say "Hi!" } } | 02:01 | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> List is not composable, so A cannot compose it at <tmp>:1 |
||
Xliff | m: class A { also is List; method first(+@a) { say "Hi!" } } | 02:02 | |
camelia | ( no output ) | ||
Xliff | m: class A { also is List; method first(+@a) { say "Hi!" } }; A.new.first; | ||
camelia | Hi! | ||
Xliff | Ah! | ||
02:15
Zoffix joined
02:32
cdg joined
|
|||
Zoffix | New core hacking blog post: "Perl 6 Core Hacking: QASTalicious": rakudo.party/post/Perl-6-Core-Hack...STalicious | 02:33 | |
02:37
Zoffix left,
cdg left
02:46
ilbot3 left
02:48
itaipu left,
Thrush left
02:57
ilbot3 joined,
ChanServ sets mode: +v ilbot3
03:07
aborazmeh left
04:25
Cabanossi left
04:27
Cabanossi joined
04:47
eliasr left
05:12
ramortegui joined
05:20
aborazmeh joined,
aborazmeh left,
aborazmeh joined
05:31
Guest18 left
|
|||
buggable | New CPAN upload: Terminal-Getpass-0.0.5.tar.gz by TITSUKI cpan.metacpan.org/authors/id/T/TI/...0.5.tar.gz | 05:35 | |
05:36
opollen joined
05:49
khw left
05:55
opollen is now known as mpollen
05:57
cdg joined,
aborazmeh left
05:59
mpollen is now known as lpollen
06:02
cdg left
06:07
lpollen left
06:29
darutoko joined
07:01
Eddward joined
|
|||
Eddward | Where's the best place to open a github issue for the latest star? I'd think rakudo, but last time I saw a problem like this the right answer was moarvm. | 07:04 | |
# generate sample input | |||
cat > /tmp/sample.input <<EOF | |||
Musopen%20DVD/Brahms%20-%20Symphony%20No%201%20in%20C%20Major/Symphony%20No.%201%20in%20C%20Minor,%20Op.%2068%20-%20IV.%20Adagio%20-%20PiuC%80%20andante%20-%20Allegro%20non%20troppo,%20ma%20con%20brio.mp3 | |||
EOF | |||
# generate sample output | |||
perl -E 'print chr for 77,117,115,111,112,101,110,32,68,86,68,47,66,114,97,104,109,115,32,45,32,83,121,109,112,104,111,110,121,32,78,111,32,49,32,105,110,32,67,32,77,97,106,111,114,47,83,121,109,112,104,111,110,121,32,78,111,46,32,49,32,105,110,32,67,32,77,105,110,111,114,44,32,79,112,46,32,54,56,32,45,32,73,86,46,32,65,100,97,103,105,111,32,45,32,80,105,117,204,128,32,97,110,100,97,110,116,101,32 | |||
,45,32,65,108,108,101,103,114,111,32,110,111,110,32,116,114,111,112,112,111,44,32,109,97,32,99,111,110,32,98,114,105,111,46,109,112,51,10' > /tmp/sample.output | |||
# attempt translate | 07:05 | ||
perl6 -e 'S:g/"%" ( <xdigit>**2)/{ :16(~$0).chr }/.say given "/tmp/sample.input".IO.slurp()' | diff -sq - /tmp/sample.output | |||
# legacy translare | |||
perl -MFile::Slurp -e 'print(read_file("/tmp/sample.input") =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/egr)' | diff -sq - /tmp/sample.output | |||
That didn't work. The generated /tmp/sample.output was wrong when I copied it out of irc. | 07:06 | ||
teatime | umm, Eddward | 07:08 | |
there are better ways to paste (use a paste site) | |||
Eddward | yeah. Sorry. I'm up too late. Let me do that right, | 07:09 | |
This works. pastebin.com/3xEHcLD5 | 07:11 | ||
The perl6 version results in "Files - and /tmp/sample.output differ". The perl5 gets (the expected) "Files - and /tmp/sample.output are identical" | 07:13 | ||
I'm probably doing it wrong but I've never found the right way. | 07:14 | ||
07:22
Zoffix joined
|
|||
Zoffix | Eddward: the difference in in your Perl 5 version, you're just working on bytes, while in Perl 6 version you're working on utf8-decode and normalized strings. | 07:23 | |
teatime | hrm, I'm not so sure | 07:24 | |
Eddward | right. | ||
teatime | in your sample input you have, at one point, "Piu%CC%80" | ||
What should that become? | |||
Eddward | The target has an encoding that perl6 considers "wrong" but that's the name of a file on disk. | ||
Zoffix | Eddward: the first problem you can solve by just using a module, e.g. `use URI::Encode; "/tmp/sample.input".IO.slurp.&uri_decode.say`, but you'll still have the issue with normalization, unless you work with bytes in Perl 6 as well and IIRC there's no simple way to do so right now (like, no same convenince as just running a regex on a bunch of bytes) | 07:25 | |
Eddward: what's the encoding? | |||
Eddward | Musopen DVD/Brahms - Symphony No 1 in C Major/Symphony No. 1 in C Minor, Op. 68 - IV. Adagio - PiuxCCx80 andante - Allegro non troppo, ma con brio.mp3 | ||
teatime | Eddward: No, I don't mean post the output, I mean reason about what it should become. | ||
I think you're working in UTF-8 in Perl6, but not in Perl5. | |||
(but yeah, the sane thing to do is use a decoding module.) | 07:26 | ||
Eddward | I don't know the encoding specifically. The are multiple ways to represent the accented u. | ||
teatime | oh, hrm, I take that back. | 07:27 | |
Eddward | I'm trying to read it from a database and open it in the file system, | ||
teatime | 0xCC 0x80 would indeed be a combining grave | 07:28 | |
Eddward | I think perl5 is just pushing bytes, I don't know how to do that in p6. | ||
teatime | that doesn't seem right to me... | ||
yeah, I guess Zoffix was right. My apologies, Zoffix :) | 07:29 | ||
Eddward | URI::Encode doesn't handle other URLs right. (or rather it handles them right but mono doesn't do it right when creating the database. | 07:31 | |
07:32
ramortegui left
|
|||
Eddward | The only problem I see when I use the regex to decode the url is the normalizing. | 07:33 | |
I think think the source db has urls with + or something in them. URI::Encode turns them into spaces. | 07:34 | ||
teatime | well, when you do chr() separately on CC and 80 you get 2 characters, an I with an accent U+00CC, and an illegal character U+0080 | ||
Zoffix | m: say "u\x[300]".chars | 07:35 | |
camelia | 1 | ||
Eddward | It's a legal filename. | ||
teatime | any series of bytes is a legal filename | ||
as long as it doesn't have / or NUL. at least on Unix. | 07:36 | ||
BUT, that only happens in your Perl6 version. | |||
Eddward | I didn't create the file or the db. | ||
teatime | chr() in Perl5 seems to do something... different. | ||
Eddward | So no easy way to do this for now? | ||
teatime | ah, I'm sure you can do it. | ||
Zoffix | Eddward: "this" being what? Are you just trying to read the file or are you doing the decoding too? | 07:37 | |
Eddward: are the names percent-encoded in the DB? | |||
Eddward | Read input data like the sample and produce the expected sample.output. | 07:38 | |
Yes. They are file:// url. It trimmed the input to simplify it. | 07:39 | ||
It's a sqlite3 db produced by banshee. I'm just trying to port my script for exporting playlists. | 07:40 | ||
07:41
darutoko left
07:42
darutoko joined
|
|||
Eddward | I had this old issue I was never able to figure out : github.com/MoarVM/MoarVM/issues/525 | 07:42 | |
I saw p6 was getting faster and thought I'd give it another try. | 07:43 | ||
teatime | "call uri_unescape() (we get 2 byte 'ù' here)" that's normalization again | 07:45 | |
Zoffix | Eddward: lemme try something | ||
Eddward | ok. Thanks | ||
07:46
darutoko left
|
|||
teatime | "I wonder if I should be using some datatype other than Str to store path data since Str seems to enforce rules that the filesystem does not." Yes, exactly. | 07:46 | |
Eddward | I'm using 2017.10 & 6.c | ||
teatime | How come you dropped the utf8-c8 solution? afaik that's still valid. | 07:49 | |
specifically uri-decode($string, :enc('utf8-c8')) | 07:50 | ||
Eddward | I never got it to work. | ||
I'll try again. | 07:51 | ||
I don't really understand what utf8-c8. Will that work for any byte string or will it fail with some other encoding? | 07:52 | ||
teatime | it exists almost entirely because normalization breaks filenames :) | 07:53 | |
07:53
wamba joined
|
|||
Zoffix | It won't work. utf8-c8 is just utf8 except instead of exploding on invalid utf8, it will shove the bad bits as as is | 07:53 | |
teatime | "UTF-8 Clean-8 is an encoder/decoder that primarily works as the UTF-8 one. However, upon encountering a byte sequence that will either not decode as valid UTF-8, or that would not round-trip due to normalization, it will use NFG synthetics to keep track of the original bytes involved. This means that encoding back to UTF-8 Clean-8 will be able to recreate the bytes as they originally existed." | 07:54 | |
Eddward | ok | ||
Zoffix | Oh | ||
teatime | docs.perl6.org/language/unicode | ||
Zoffix | m: say buf8.new(0xCC, 0x80).decode: 'utf8-c8' | 07:55 | |
camelia | rakudo-moar 9bc26ec3c: OUTPUT: «̀» | ||
Zoffix | m: say buf8.new(0x75, 0xCC, 0x80).decode: 'utf8-c8' | ||
camelia | uxCCx80 | ||
Zoffix | m: say buf8.new(0x75, 0xCC, 0x80).decode('utf8-c8').chars | ||
camelia | 3 | ||
Eddward | perl6 -MURI::Escape ? | ||
Zoffix | teatime: so uri-decode :enc works? | 07:56 | |
teatime | Zoffix: samcv says it does in the ticket from a year ago | ||
Zoffix | Ah, cool | ||
teatime | I'm at a bit of a loss for how to plug the pieces together properly, though. | ||
Eddward | I never got it to work. | ||
The behavior changed, but I just got a different encoding of the bytes. | 07:57 | ||
Looks like I need to install URI::Escape. It's not panda any mor, right? | 07:58 | ||
Zoffix | zef install URI::Escape | ||
Eddward | thanks | 07:59 | |
Says it is installed already. | |||
Zoffix | Eddward: yeah, teatime++'s way works. Just need to write to STDOUT in bin mode: $ perl6 -e 'use URI::Escape; $*OUT.write: "/tmp/sample.input".IO.slurp.&uri-unescape(:enc<utf8-c8>).encode("utf8-c8")' | diff -sq - /tmp/sample.output | ||
Files - and /tmp/sample.output are identical | |||
Eddward | cool! Thanks! | 08:00 | |
I'll wrap that into my p6 version of the export script. I want to see how it performs. It was slow a year ago. | |||
teatime | Also, I feel better seeing that samcv was confused for a moment in the same way I was by 0xCC 0x80 :) | 08:01 | |
Eddward | It sounds like it's a screwy file. I just hate editing originals though. | 08:02 | |
samcv | hello :) | ||
teatime | oh, hey. Sorry to ping you :) | ||
samcv | does anyone have a question though :) | ||
teatime | Eddward: which? | ||
samcv: not anymore I don't think :) | |||
samcv | aww. | ||
if you have one go ahead and let me know :) | |||
teatime | samcv: your comments on a ticket lead us to solve it. | ||
Eddward | I dug up an old problem. | ||
samcv | ah | 08:03 | |
teatime | samcv++ | ||
samcv | oh URI::Escape? | ||
teatime | yes | ||
samcv | yeah i added utf8-c8 capabilities to that module :) you're welcome! | ||
someone else had that issue a while ago and so i took the steps to add that functionality in. since i deemed it pretty essential | |||
Eddward | Once I got an updated star it didn't work. Looks like I missed the binary output. | 08:04 | |
teatime | Eddward: Your filenames on disk aren't wrong. Your database is kindof annoying, but not wrong per-se. | ||
and as you say, it's the data you have. | |||
Eddward | samcv I was me. I never got it to work before. I'm getting back to it now. Sorry to be a pest. | 08:05 | |
samcv | ah | ||
Eddward | Looks like we have it worked out. | ||
samcv | no worries | ||
teatime | Eddward: there's just more than one correct utf8 encoding for most strings, and filenames are in bytes, not any specific normalization etc. | ||
Eddward | Thanks again everyone | ||
samcv | yep filenames are decoded with utf8-c8 always since we can't assume anything | ||
teatime | Zoffix: Did you ever figure out the answer to the question you had that day... it wasn't actually about receiving multiple ^D from stdin, but that was part of the question/example. | 08:08 | |
I ended up researching and getting re-educated about ^D, which is always welcome, and now I'm curious about the original question. I can find it in the log probably if you don't recall. | 08:10 | ||
Zoffix | teatime: irclog.perlgeek.de/perl6/2018-01-20#i_15714540 | 08:13 | |
08:14
Zoffix left
|
|||
teatime | well, that's the one :/ | 08:15 | |
08:25
Zoffix joined
|
|||
Zoffix | Eddward: FWIW this version is benching to be 2x faster and doesn't need a module: gist.github.com/zoffixznet/7d0aaef...5477b71ee9 | 08:25 | |
Eddward | cool | 08:26 | |
I'd need to adapt it. | 08:27 | ||
At the moment I'm trying to figure out "No such method 'IO' for invocant of type 'Blob[uint8]'" | 08:30 | ||
$fh.write: $sth.allrows.map( *.subst: /^ 'file://' /, '' ) | 08:31 | ||
.map( { S :g / '+' /{uri-escape('+')}/ } ) | |||
.map( *.&uri-unescape(:enc('utf8-c8')).encode("utf8-c8") ) | |||
.map( *.IO.relative($library_root.IO.absolute) ) | |||
.map( * ~ "\n" ) | |||
.join; | |||
Zoffix | Eddward: remove `.encode("utf8-c8")` | 08:32 | |
Eddward | I can probably get away with moving the rel->abs before the url unescape since I know the prefix shouldn't be escaped. | ||
Type check failed in binding to parameter '$buf'; expected Blob but got Str ("mod/demo/skaven/seve...) | 08:33 | ||
encode at the end? | |||
08:33
ZzZombo joined
|
|||
Eddward | That ran... | 08:34 | |
Zoffix | That's a lot of .maps... why not write a single one? | 08:35 | |
Eddward | I tried that. Broke it a apart to debug and because I don't really know what I'm doing. | 08:36 | |
I'll try to collapse them. | |||
btw, the p6 result watches the p5 result for my entire music library now. | 08:37 | ||
Zoffix | Eddward: also `.subst: :g, "+", "%2b"` will be orders faster than using a regex and sub call | ||
Eddward | err watches=> matches | ||
Zoffix | * instead of { S :g / '+' /{uri-escape('+')}/ } I meant | ||
Also, I imagine `.starts-with 'file://' ?? .substr: chars 'file://' !! $_` would be loads faster than `*.subst: /^ 'file://' /, ''`. And if they all start with `file://` just use .substr without the conditional | 08:38 | ||
Eddward | subst: :g, "+", "%2b" was actually slower. 0m29.627s v 0m32.654s | 08:39 | |
I'll work on collapsing first. | 08:40 | ||
Zoffix | 0_0 | ||
ZofBot: IMPOSSIBRU! | |||
ZofBot | Zoffix, 'Sixty-fower, sixty-fower, sixty-fow--' The kitchen door opens, and Juliet emerges | ||
ZzZombo | "Cannot put a type constraint on an 'our'-scoped variable" | ||
why is that O_o | |||
Zoffix | m: my $s = "foo+bar+ber" ~ rand; for ^1000_00 { s:g/ '+' /{'%2B'}/ }; say now - INIT now | 08:42 | |
camelia | 7.9058585 | ||
Zoffix | m: my $s = "foo+bar+ber" ~ rand; for ^1000_00 { .subst: :g, '+', '%2B' }; say now - INIT now | ||
camelia | 1.38105620 | ||
Eddward | I'm doing something stupid... | ||
$fh.write: $sth.allrows.map( *.subst: /^ 'file://' /, '' | 08:43 | ||
.subst: :g, "+", "%2b" | |||
.&uri-unescape(:enc('utf8-c8')) | |||
.IO.relative($library_root.IO.absolute) | |||
~ "\n" ) | |||
.join.encode("utf8-c8"); | |||
Malformed postfix call (only alphabetic methods may be detached) | |||
I need parens somewhere. | |||
Zoffix | Yes, everywhere you've used `:` instead of `()` for a method call | ||
Eddward | cool | 08:44 | |
.⏏&uri-unescape(:enc('utf8-c8')) | 08:45 | ||
Still doesn't like this. | |||
Zoffix | Eddward: oh, right | ||
Eddward | Can't use method syntax? | 08:46 | |
Zoffix | Eddward: can't break up method chains that contain non-alphabetic methods | ||
like &uri-unescape | |||
Eddward | So one line, no spaces? | 08:47 | |
$fh.write: $sth.allrows.map( *.subst(/^ 'file://' /, '') | 08:48 | ||
.subst(:g, "+", "%2b") | |||
.&uri-unescape(:enc('utf8-c8')) | |||
.IO.relative($library_root.IO.absolute) | |||
~ "\n" ) | |||
.join.encode("utf8-c8"); | |||
$fh.write: $sth.allrows.map( *.subst(/^ 'file://' /, '').subst(:g, "+", "%2b").&uri-unescape(:enc('utf8-c8')).IO.relative($library_root.IO.absolute) | 08:49 | ||
~ "\n" ) | |||
.join.encode("utf8-c8"); | |||
that works | |||
ugly, but works. | |||
08:50
rindolf joined
|
|||
Eddward | 0m31.993s | 08:50 | |
08:53
dogbert11 joined
08:55
setty1 joined,
dogbert17 left
|
|||
Zoffix | Eddward: you don't need to write it all in one line. Just don't put whitespace between method call dots (or use unspace (`\`)). gist.github.com/zoffixznet/5f8e4f6...dc9463cb54 | 08:57 | |
08:57
Zoffix left
|
|||
Eddward | got it | 08:58 | |
09:00
syntaxman left
09:02
cgfbee left,
syntaxman joined
09:03
syntaxman is now known as Guest79180
|
|||
Eddward | A little faster ... 0m25.846s | 09:07 | |
09:07
statisfiable6 left,
statisfiable6 joined,
ChanServ sets mode: +v statisfiable6
09:08
cgfbee joined
09:20
parv joined
09:23
greppable6 left,
greppable6 joined
09:24
ZzZombo left
|
|||
AlexDaniel | reportable6: uptime | 09:28 | |
reportable6 | AlexDaniel, 1 day, 17 hours, 20 minutes, and 16 seconds, 1566.617188MiB maxrss. This is Rakudo version 2018.01-29-ga2499c90f built on MoarVM version 2018.01 implementing Perl 6.c. | ||
AlexDaniel | uhhh… | ||
09:28
reportable6 left,
bisectable6 left,
unicodable6 left,
reportable6 joined,
ChanServ sets mode: +v reportable6,
bisectable6 joined,
unicodable6 joined
09:29
ZzZombo joined
09:36
lasse_ joined
09:37
Eddward left
|
|||
lasse_ | Hi, I have a PHP job scheduling system. I want to call perl6 from it. PHP arrays carring needed info, Those can be serialized or var_exported and written to disk before perl6 invokation and read back after return. Can anyone advice how to do this? | 09:38 | |
09:53
Zoffix joined
|
|||
Zoffix | lasse_: do you have PHP end sorted? What about using json_encode() on the data and sending it to perl6 to STDIN, and then reading it from STDOUT. Then on perl6 end, you'd do `use JSON::Fast; my @data := from-json $*IN.slurp; .... process it....; put to-json @result' | 09:57 | |
m: use QAST:from<NQP>; BEGIN $*W.compile_time_evaluate: $, QAST::Op.new: :op<call>, :name<&say>, QAST::Op.new: :op<call>, QAST::Block.new: QAST::SVal.new: :value<meows> | 09:59 | ||
camelia | meows | ||
Zoffix | Is it mandatory that QAST::Blocks be declared somewhere and then cloned and p6capturelex'ed into a QAST::WVAL? Is the above call fine? (also, does it need p6capturelex?) | 10:00 | |
m: use QAST:from<NQP>; BEGIN $*W.compile_time_evaluate: $, QAST::Stmts.new: QAST::Op.new(:op<bind>, QAST::Var.new(:name<$foo>, :scope<lexical>, :decl<var>), QAST::SVal.new: :value<meows>), QAST::Op.new: :op<call>, :name<&say>, QAST::Op.new: :op<call>, QAST::Block.new: QAST::Var.new: :name<$foo>, :scope<lexical> | 10:02 | ||
camelia | meows | ||
lasse_ | What do you mean by PHP end sorted? Yes I can Json_encode. Bus how do i invoke Perl6 and make it read my JSON? | ||
Zoffix | Seems to work, but I wonder if it's doing too much work with QAST::Block | 10:03 | |
lasse_: just like any other program. ##php would be able to give more competent advice than me, but quickly glancing at the docs, looks like proc_open() can get the job done: php.net/manual/en/function.proc-ope...ample-4258 | 10:05 | ||
lasse_: you'd just `fwrite($pipes[0], json_encode($the_stuff));` and then `$result = stream_get_contents($pipes[1]);` to get the results | 10:06 | ||
+ `fclose($pipes[0]);` in between :) | |||
PHP++ # easy to program-by-googling | |||
10:07
lookatme left,
lookatme joined
|
|||
lasse_ | Tx Zoffix, I try it. Now I just have to learn Perl 6:) | 10:09 | |
Zoffix | :) | 10:10 | |
lasse_: this seems to work (reverses the array and uppercases the stuff in it): gist.github.com/zoffixznet/ef6dd97...f0e9e1d5d6 | 10:20 | ||
Hope that helps \o | |||
10:20
Zoffix left
10:36
ZzZombo left
10:37
ZzZombo joined
10:43
leah2 left
10:48
shinobi-cl left
11:05
lookatme left
11:06
lookatme joined
11:08
markong joined
11:11
quotable6 left
11:13
lookatme left
11:14
lookatme joined
11:17
Grauwolf left
11:18
Grauwolf joined
|
|||
Geth | doc: 9292ce5b45 | (JJ Merelo)++ | t/pod6.t Refactor to turn into a single test And maybe it should be merged into another file to make tests a bit faster. |
11:27 | |
11:34
wamba left
11:35
quotable6 joined
11:36
itaipu joined
11:37
setty1 left
11:39
eliasr joined
11:40
quotable6 left
11:42
quotable6 joined
11:46
quotable6 left
11:51
wamba joined,
lookatme left
11:52
lookatme joined
12:10
parv left
12:12
lookatme left
12:14
quotable6 joined,
ChanServ sets mode: +v quotable6
12:21
lookatme joined
12:36
|oLa|1 left
12:43
rindolf left
|
|||
ZzZombo | <ZzZombo> "Cannot put a type constraint on an 'our'-scoped variable" | 12:57 | |
<ZzZombo> why is that O_o | |||
moritz | 'our'-scoped variables are globals, so no one piece of code has authority over it | 12:59 | |
ZzZombo | what do you mean global?? | 13:00 | |
moritz | m: { our $x = 42 }; { say our $x } | ||
camelia | 42 | ||
moritz | our $x creates a lexical $x that is an alias for $x in the current namespace | 13:01 | |
ZzZombo | Anyway, I don't get it why does that change anything regarding "no one piece of code has authority over it". | 13:02 | |
moritz | change from what? | 13:03 | |
ZzZombo | Err? That shouldn't change anything, and constrained `our` variables should work like any other type of them. | 13:04 | |
El_Che | that's the point of being global | 13:05 | |
moritz | ZzZombo: so, if you have a lexical variable "my Int $x = 42", there can be only one declaration of it, and its type is clear | 13:06 | |
but, globals aren't like that, tied to a lexical location of your program | |||
13:07
shinobi-cl joined
|
|||
moritz | they just come into existence whenever somebody references it | 13:07 | |
which access determines its type, then? | |||
multiple declarations or run-time reads and writes could have conflicting or more narrow or more specific types | 13:09 | ||
13:09
markong is now known as supernaut,
supernaut is now known as suprnaut
|
|||
moritz | and in the end, globals are simply not such a good idea for most purposes, so it doesn't seem to be worth it to come up with an elaborate scheme for dealing with it all | 13:09 | |
13:10
suprnaut is now known as markong
13:14
ChoHag joined
|
|||
ZzZombo | Sorry, I don't follow you. I have a package X with a variable `our y`, to use it I need to import the said package first, while to use a true global variable I just reference it. | 13:15 | |
And there can only be one package named such. | 13:16 | ||
moritz | I don't understand your distinction between a package variable a "true global variable" | ||
m: say $X::y | 13:17 | ||
camelia | (Any) | ||
13:17
jeromelanteri joined
|
|||
moritz | see? I could reference that before doing any use or import | 13:17 | |
before any type constraint for it could even be known | |||
m: $Just::discovered = 42; | 13:18 | ||
camelia | ( no output ) | ||
ZzZombo | Why does that not fail the same way as accessing undeclared `my` variables? | ||
moritz | if i run that, and *then* load module Just, which declares "our Array $discovered"; what then? | ||
13:18
p6lert left
|
|||
moritz | because it's a global | 13:18 | |
and globals don't need declarations | |||
ZzZombo | ugh | ||
moritz | only their lexical aliases | 13:19 | |
if you don't like 'em, don't use 'em :) | |||
ZzZombo | except I have to? | ||
13:19
p6lert joined
|
|||
ZzZombo | what kind of response is that? | 13:19 | |
moritz | what do you need them for? | ||
ZzZombo | I want to store some state in my package. | ||
moritz | there are lots of ways to do that | 13:20 | |
singletons come to mind, for example | |||
ZzZombo | Singletons are for classes, right? | 13:21 | |
moritz | and classes are a nice way to store structured, type-safe data | ||
which seem to do want to do | |||
ZzZombo | No, I don't need nor want any initialization/clean up that using objects brings. | 13:22 | |
moritz | I don't think I can help you, nor do I feel this discussion is being productive for anybody | 13:23 | |
ZzZombo | what | ||
fuck this shit as well, holy crap, what a load of bullshit was that?? | 13:24 | ||
13:29
shinobi-cl left
13:33
camelia left
13:35
jeromelanteri left
13:41
leah2 joined
13:46
leah2 left
13:57
shinobi-cl joined,
Eddward joined
|
|||
teatime | Eddward: Welcome back! | 13:58 | |
14:02
aborazmeh joined,
aborazmeh left,
aborazmeh joined
14:03
moritz joined
14:09
aborazmeh left
|
|||
Eddward | teatime: Good morning! | 14:10 | |
14:22
Guest79180 left
14:23
syntaxman joined,
cgfbee left,
syntaxman is now known as Guest77349
14:24
Eddward left
14:29
cgfbee joined
14:42
itaipu left
14:54
itaipu joined
14:55
Ven`` joined
14:57
pecastro joined
15:01
cdg joined
15:02
itaipu left
15:03
cdg left,
cdg joined
15:06
rindolf joined
15:07
cdg left
|
|||
shinobi-cl | hi all... what is the X:: exception for Out Of Memory? I could not find it in docs.perl6.org | 15:23 | |
El_Che | shinobi-cl: does it exist? | 15:24 | |
timotimo | shinobi-cl: when you run out of memory, moarvm just exits | ||
El_Che | Out of memery is mostly too late | ||
o | |||
shinobi-cl | oh, ok. | 15:25 | |
timotimo | an out-of-memory situation is exceedingly difficult to properly recover from | ||
15:25
BuildTheRobots joined
|
|||
El_Che | most likely the kernel will kill your process | 15:25 | |
timotimo | especially when you're dealing with multiple threads; we always have the spesh thread | ||
oh, hold on | |||
m: my $foo = buf8.allocate(999999999999); CATCH { .perl.say } | |||
evalable6 | (exit code 1) MoarVM panic: Memory allocation failed; could not allocate 999999999999 bytes | ||
timotimo | hm, ok | 15:26 | |
i thought perhaps we throw that kind of error | |||
i mean, when you're requesting 1 gig of memory and the system can't give you what you want, that doesn't mean that the next 8 byte allocation will also fail | |||
m: say 999999999999 / 1024 / 1024 / 1024 | 15:27 | ||
evalable6 | 931.32257461455 | ||
timotimo | in this case, though, i was requesting almost a terabyte of ram | ||
shinobi-cl | I have a big table, and the user has the chance to request creation of indexes for all the columns if he/she wants to. I was thinking on returning a False if the index ended being too big for RAM. | 15:29 | |
timotimo | you can check if asking for a given chunk of memory would succeed by NativeCalling into malloc (and of course free right after that) and deciding based on the result | 15:30 | |
shinobi-cl | obviously it is better to return a False before trying to allocate too much memory, but in the meantime i thought that capturing the exception would have been good enough. | ||
timotimo | actually, if your index data is a buf8 or blob8 or similar already, you can just use what malloc gives you | 15:31 | |
El_Che | will the application be portable? | ||
timotimo | malloc is available everywhere we have moarvm, i believe | 15:32 | |
El_Che | aren't you binding libc? | 15:33 | |
(aka will it work on Windows?) | |||
timotimo | if you "is native(Str)" it will use what's loaded in the process already | ||
shinobi-cl | the data is not buf8 of blob8. It is actually anything that perl6 can represent. I will skip this for the moment i guess. BTW i'm developing on Linux 64bit. | ||
timotimo | oh, in that case calculating what the necessary size would be for the buffer is rather difficult | 15:34 | |
if your index is just like an array of native ints or nums it'd be simple, but with proper objects you'll go through moarvm's own gc-managed heap | |||
shinobi-cl | Well... the index is just a .Str of the data in the cells, and the contents are just Ints indicating the row number where the value can be found | 15:35 | |
like "A" -> (1, 3, 4, 1000) | 15:36 | ||
like "A" => (1, 3, 4, 1000) | |||
we can found the value "A" in the rows 1, 3, 4 and 1000 for that column. | |||
timotimo | so a list of pairs from Str to a list of Int? | ||
shinobi-cl | yes | 15:37 | |
timotimo | if you want to be memory-efficient and don't mind a bit of extra work, you can make that a list of strings and three lists of ints | ||
the list of strings is what has your "A" and friends in it, the first list of ints tells you where in the third list your actual data begins and the second list of ints tells you how many entries belong to that | 15:38 | ||
i.e. for just the A example you have it would be ["A"], [0], [4], [1, 3, 4, 1000] | |||
15:38
Rawriful joined
|
|||
shinobi-cl | %index<ColumnA> = :A(1,3,4,100), :B(2,500), :C(9,10,11,540) .... etc | 15:38 | |
thanks timotimo, i will see how i can make it work. will try to use the least amoung of hashes and only use arrays when possible. Just one last question. Is there a method or way to ask the acual size of an object? | 15:42 | ||
actual size* | |||
timotimo | apart from taking heap snapshots and measuring memory usage before and after creating it, not really, no | 15:43 | |
Ulti | ///^H^H^H^H/win 5 | ||
timotimo | especially since if you recently freed objects of the "right size", you'll fill slots back up that were used before, so memory usage will appear to be 0 | ||
shinobi-cl | that sounds fine for a test i am doing. What can i found docs about this (my guess is that this has to be done in NQP) | 15:44 | |
Where can i find* | |||
(sorry my english sucks today :P ) | |||
timotimo | which do you mean? | 15:46 | |
measuring memory usage before and after? | |||
shinobi-cl | yes | ||
timotimo | the telemetry module in rakudo exposes that, for example | ||
shinobi-cl | I will use that one, seems ok for what i need :) thanks timotimo++ | 15:49 | |
timotimo | good luck! | 15:50 | |
i'll be afk for a bit | |||
15:52
cdg joined
|
|||
wictory[m] | where is &next defined? | 15:59 | |
moritz | src/core/control.pm | 16:00 | |
wictory[m] | thanks! | ||
moritz | found through "git grep 'sub next'" :-) | ||
you're welcome | |||
16:01
setty1 joined
|
|||
wictory[m] | hmm, I was grepping but I didnt find it through that .. I'm probably getting tired. Also good to hear that other people use the same method as I do :) Thanks again! | 16:02 | |
16:09
esh left
|
|||
timotimo | s: "next", \() | 16:10 | |
SourceBaby | timotimo, Something's wrong: ERR: Cannot resolve caller sourcery(Str, Capture); none of these signatures match: ($thing, Str:D $method, Capture $c) ($thing, Str:D $method) (&code) (&code, Capture $c) in block <unit> at -e line 6 | ||
timotimo | s: &next, \() | ||
SourceBaby | timotimo, Sauce is at github.com/rakudo/rakudo/blob/c6cc...rol.pm#L80 | ||
timotimo | wictory[m]: ^ | ||
16:10
esh joined
|
|||
moritz never figured out how to use that bot | 16:13 | ||
wictory[m] | timotimo: 👍 | ||
16:17
igor__ joined
|
|||
igor__ | Hi everyone! Can my someone explain why sort(@a) ~~ sort(@a) is False? | 16:18 | |
What comparison operator should use in this case? | |||
psch | igor__: depending on the contents, probably &infix:<eqv> | 16:19 | |
igor__ | I just want to compare these two lists | ||
I don't understand why ~~ doesn't work here | |||
psch | igor__: the content dependency is "are there custom classes in there that maybe eqv weirdly" | ||
psch wonders where camelia fluttered off to | 16:20 | ||
evalable6: help | |||
evalable6 | psch, Like this: evalable6: say ‘hello’; say ‘world’ # See wiki for more examples: github.com/perl6/whateverable/wiki/Evalable | ||
psch | evalable6: my @a = 3,1,5,2,4; say sort(@a) ~~ sort(@a) | ||
evalable6 | False | ||
geekosaur | also ~~ is not a short way to say eqv. it has special behaviors that may be getting in the way | 16:21 | |
do NOT assume it's the way to write a generic "=="! | |||
psch | yeah, i was wondering if the LHS topicalization is to blame | ||
geekosaur++ | |||
El_Che | eqv also is False | ||
igor__ | Yes, eqv works indeed | ||
psch | evalable6: my @a = 3,1,5,2,4; say sort(@a) eqv sort(@a) | ||
evalable6 | True | ||
igor__ | I know that it is not a short way, I thought that ~~ is used to compare elements | 16:22 | |
and if elements are equal, then ~~ is true | |||
psch | igor__: smartmatch is not comparison. it's asking the RHS if the LHS is acceptable | ||
evalable6: my &h = -> $a { $a.uc }; say &h ~~ &h | 16:23 | ||
evalable6 | (exit code 1) No such method 'uc' for invocant of type 'Block' in block <unit> at /tmp/Ki1IIGAwks line 1 |
||
psch | evalable6: my &h = -> $a { $a.gist.uc }; say &h ~~ &h | ||
evalable6 | -> $A { #`(BLOCK|94066313049264) ... } | ||
igor__ | Quote from a Perl6 book that I'm reading now: "To know whether they contain the same elements, use the smart match operator" | 16:24 | |
timotimo | evalable6: my @a = 3,1,5,2,4; say sort(@a).List ~~ sort(@a).List | ||
evalable6 | True | ||
El_Che | evalable6: my @a = 3,1,5,2,4; @a ~~ @a | ||
evalable6 | |||
timotimo | igor__: ^ | ||
El_Che | evalable6: my @a = 3,1,5,2,4; say @a ~~ @a | 16:25 | |
evalable6 | True | ||
timotimo | evalable6: my @a = 3,1,5,2,4; say @a.sort.WHAT | ||
evalable6 | (Seq) | ||
psch | timotimo: ah, so it's Seq.ACCEPTS that's surprising? | ||
timotimo | i think so | ||
igor__ | Ok, that means that I have to add .List here | ||
timotimo | i don't know what Seq.Accepts should do, in general | ||
igor__ | convert to a list explicitly | ||
psch | it does Cool.ACCEPTS currently, apparently | ||
timotimo | igor__: or assign to an @ variable earlier | ||
psch | as in, Seq.pm doesn't have a definition | ||
+src/core/ | 16:26 | ||
oh hm, maybe Iterable or Sequence have one | |||
El_Che | it true it's not alway straight forward when a .List convertion is required | ||
timotimo | psch: sourcery can help us with that :) | ||
s: (1,2,3).sort, "ACCEPTS", \() | 16:27 | ||
SourceBaby | timotimo, Something's wrong: ERR: Could not find candidate that can do \() in sub sourcery at /home/zoffix/services/lib/CoreHackers-Sourcery/lib/CoreHackers/Sourcery.pm6 (CoreHackers::Sourcery) line 29 in block <unit> at -e line 6 | ||
timotimo | er, of course | ||
s: (1,2,3).sort, "ACCEPTS", \(Seq) | |||
SourceBaby | timotimo, Sauce is at github.com/rakudo/rakudo/blob/8afd...Any.pm#L19 | ||
psch | ah, Any | ||
timotimo | oops | ||
that's an undefined seq right there | |||
psch | timotimo: yeah i stopped looking manually after checking Seq, Sequence, and Iterable | ||
timotimo | s: (1,2,3).sort, "ACCEPTS", \(Seq:D) | ||
SourceBaby | timotimo, Sauce is at github.com/rakudo/rakudo/blob/8afd...Any.pm#L19 | ||
timotimo | s: (1,2,3).sort, "ACCEPTS", \(Seq.new()) | ||
SourceBaby | timotimo, Something's wrong: ERR: Too few positionals passed; expected 2 arguments but got 1 in block <unit> at -e line 6 | ||
timotimo | s: (1,2,3).sort, "ACCEPTS", \((1,2,3).sort) | ||
SourceBaby | timotimo, Sauce is at github.com/rakudo/rakudo/blob/8afd...Any.pm#L18 | ||
timotimo | multi method ACCEPTS(Any:D: Mu:D \a) { self === a } | ||
that's the one it uses | 16:28 | ||
psch | mhm, eqaddr should probably fail there | ||
...unless we started interning Seqs? :o | |||
igor__ | Is there any universal method to say, when I should convert something to a list and when not? | ||
psch | igor__: i'm not quite sure the current behavior you observed should stay like this | 16:29 | |
igor__ | By the way, it is enough to convert the RHS only | ||
16:29
Rawriful left
|
|||
psch | as in, at least fully reified Seqs should probably ACCEPTS like List does | 16:29 | |
igor__ | so sort(@a) ~~ sort(@a).List is True | ||
psch | says my gut | ||
mst | psch: I think <thing> ~~ <thing> for any value of <thing> should be expected to be true unless you've got a *really* good reason for it not to be, yeah | 16:31 | |
psch | mst: like <thing> being a Routine | ||
El_Che | mst++ | 16:32 | |
igor__ | mst: I agree, that Is what I expected | ||
16:32
domidumont joined
|
|||
psch | evalable6: say Regex.^mro | 16:33 | |
evalable6 | ((Regex) (Method) (Routine) (Block) (Code) (Any) (Mu)) | ||
mst | psch: because putting a Routine on the RHS of smartmatch is explicitly asking for it to be invoked and its result used, right/ | ||
psch | well, Code is probably the type graph diversion that makes it special | ||
mst | ah, yeah, it's marked as "(Code) method ACCEPTS" but it's in the Routine docs, hence me getting the wrong one | 16:34 | |
igor__ | Is there any method shat I should use for reliable comparison of tqo seqs? Just convert the RHS to a List? | ||
psch | mst: to be fair, i think that really is the one execption, Code being magically as smartmatch RHS | 16:35 | |
igor__: eqv as suggested earlier seemed to work? | |||
teatime wonders if the similarity between Seq and Sikh is one of those odd Perl/Larry jokes or not | |||
mst | or "you made an object of a class where you defined your own ACCEPTS method in order to intentionally alter the behaviour" | ||
Code behaving magically is really just a shorthand way of doing that | 16:36 | ||
(arguably, in my head) | |||
16:36
chakli joined
|
|||
igor__ | eqv will not work if you compare sorted([1,2,3,4]) with [1,2,3,4] though elements are equal | 16:36 | |
psch | oh, yeah, but Code is the one exception we have in CORE afaik | ||
igor__: but that's not two Seqs ;) | |||
igor__: i see your point though. | |||
igor__ | yes, I said it wrong | 16:37 | |
two iterables or whatever | |||
mst | I guess the problem is that you can't be consistent for all Seqs, because not all Seqs can be effectively compared, because they could be lazy and/or infinite? | ||
chakli | Is there a builtin class/function to measure time elapsed | ||
timotimo | mst: Seq is a stateful thing, so checking against another thing should consume the seq and you're screwed :) | ||
chakli | m: my $start = time; sleep 3;say time -$start | ||
evalable6 | 3 | ||
chakli | like this? | 16:38 | |
timotimo | m: my @a = 9, 4, 2, 5, 6; my $foo = @a.sort; say $foo ~~ $foo; .say for $foo | ||
evalable6 | True (2 4 5 6 9) |
||
psch | m: my $start = now; sleep 1; say now - $start | ||
16:38
domidumont left
|
|||
evalable6 | 1.0017287 | 16:38 | |
timotimo | but apparently we cache that? | ||
oh, we don't compare at all, right | |||
m: my @a = 9, 4, 2, 5, 6; my $foo = @a.sort; say $foo ~~ $foo.List; .say for $foo | |||
evalable6 | (exit code 1) False The iterator of this Seq is already in use/consumed by another Seq (yo… |
||
timotimo, Full output: gist.github.com/c10d4b00c8389e82e5...eb534a78d2 | |||
timotimo | mst: ^- check it out | ||
16:38
evalable6 left,
evalable6 joined,
domidumont joined
|
|||
moritz | chakli: I think lizmat built something for instrumentation/timing, but I can't remember what it's called | 16:39 | |
timotimo | moritz: it's "Telemetry" and "snapper" | 16:40 | |
i.e. if you -Msnapper your script it'll give you a nice table/summary at the end | |||
igor__ | So, may I think that the best method is to ~~ + convert RHS into a list? | ||
16:40
zakharyas joined
|
|||
psch | the build-in module for timing is Telemetry, isn't it | 16:41 | |
timotimo | yes | ||
chakli | Telemetry seems more like perf :) ill stick to "time - $start" :) | 16:46 | |
Thanks | 16:47 | ||
psch | m: say time.WHAT; say now.WHAT | 16:48 | |
evalable6 | (Int) (Instant) |
||
psch | chakli: &now gives you milliseconds, fyi | ||
moritz | m: say now | 16:49 | |
evalable6 | Instant:1517158200.001190 | ||
chakli | oh, thanks. ill use that then | ||
moritz | looks like microseconds, even | ||
chakli | is there something like c++ destructor for perl6 classes? | 16:52 | |
moritz | there's DESTROY, but it only runs when the GC reclaims the object | ||
psch | object destruction isn't deterministic | 16:53 | |
there's probably a long explanation by jnthn++ somewhere in the irclog | |||
all i know is "spooky lowlevel magic happens sometimes" | 16:54 | ||
chakli | not when it the object goes out of scope | ||
timotimo | correct | ||
geekosaur | it becomes *eligible* if it goes out of scope with no remaining references. gc will happen when memory is needed at some point afterward | 16:55 | |
I don;t know exactly what gc strategy or mechanism moarvm uses | 16:56 | ||
timotimo | if the object dies young, the gc that will get it will happen rather a bit sooner, because moarvm does minor and major collections | ||
wictory[m] | is there any nice way to format a Duration as hh:mm:ss, for example, or does everybody roll their own formating every time? | 17:00 | |
17:02
Cabanossi left,
zakharyas left
17:03
khw joined
|
|||
wictory[m] | p6: say(DateTime.new(DateTime.now.later(:1day)-DateTime.now).hh-mm-ss) | 17:03 | |
17:04
Cabanossi joined
|
|||
wictory[m] | m: say(DateTime.new(DateTime.now.later(:1day)-DateTime.now).hh-mm-ss); | 17:06 | |
evalable6 | 23:59:59 | ||
17:09
itaylor57 joined
|
|||
psch .o( days are only 23:59:59 long??! ) | 17:10 | ||
moritz | seems about right :-) | ||
17:10
khisanth__ left
|
|||
moritz | the two execution of DateTime.now won't return the same result | 17:10 | |
*executions | |||
wictory[m] | a day is actually something like 23:59:59.999287, depending on your perl6 build.. | 17:13 | |
moritz | m: given DateTimew.now { say DateTime.new(.later(:1day)-$_).hh-mm-ss | ||
evalable6 | (exit code 1) 04===SORRY!04=== Error while compiling /tmp/bhWVSLxhbq Missing… |
||
moritz, Full output: gist.github.com/49ade66e5ef99e603c...d68d53f6b0 | |||
igor__ | Ok, thank you very much for the help! I created a question on Stackoverflow (before joining this channel), so if you have time and want to answer it for all, please: stackoverflow.com/questions/484883...n-operator | ||
moritz | m: given DateTimew.now { say DateTime.new(.later(:1day)-$_).hh-mm-ss } | ||
evalable6 | (exit code 1) 04===SORRY!04=== Error while compiling /tmp/WWT6E4x5xo Undeclared name: DateTimew used at line 1. Did you mean 'DateTime'? |
||
igor__ | And thank you very much for the help once again | ||
moritz | m: given DateTime.now { say DateTime.new(.later(:1day)-$_).hh-mm-ss } | 17:14 | |
evalable6 | 00:00:00 | ||
17:14
leah2 joined
17:22
khisanth__ joined
17:23
igor__ left
|
|||
moritz | igor__: I've written an answer, though I suspect it might not be very satisfactory to you | 17:23 | |
Geth | doc: f74384849d | (Moritz Lenz)++ | doc/Type/Any.pod6 &sort actually returns a Seq, not a List see stackoverflow.com/questions/48488381 |
17:27 | |
synopsebot | Link: doc.perl6.org/type/Any | ||
17:28
leah2 left
|
|||
teatime | moritz: from the other guy: "It would not make sense to run through two Seqs to see if they equivalent because then they'd be exhausted." seems like there would be plenty of situations where that's all you want/need to know about two seqs, and are happy to let them be exhausted after comparison. *shrug* | 17:30 | |
timotimo | teatime: then you can still use .List on them and discard the result immediately, or use something like >>==<< | 17:31 | |
moritz | teatime: the other option would be to use .cache in ACCEPTS | ||
teatime: for the plenty of cases where you don't want the Seq to be exhausted | |||
the other question is: is it really worthwhile to return a Seq from sort, and not just a List? | 17:32 | ||
you have to exhaust the input list anyway for sorting, so the performance gains from returning a lazy list are limited by nature | |||
teatime | timotimo: to your first point, they might be really long. but >>==<< would seem to satisfy me. | 17:33 | |
17:33
zakharyas joined
|
|||
moritz | m: say (1, 2) >>==<< (1, 2, 3) | 17:34 | |
evalable6 | (exit code 1) Lists on either side of non-dwimmy hyperop of infix:<==> are not of the same length left: 2 elements, right: 3 elements in block <unit> at /tmp/bhurDAHHbt line 1 |
||
moritz | might not be what you want | ||
psch | m: say (1,2) <<==>> (1,2,3) | ||
evalable6 | (exit code 1) 04===SORRY!04=== Error while compiling /tmp/esu9jrTNFo Unsuppo… |
||
psch, Full output: gist.github.com/f8e42d06acaa84869d...6336373a25 | |||
psch | oh can't dwim both sides or something..? | 17:35 | |
ah, no | |||
m: say (1,2) <<[==]>> (1,2,3) | |||
evalable6 | (True True False) | ||
17:37
trnh joined
18:00
leah2 joined
18:03
zakharyas left
18:08
domidumont left
18:09
domidumont joined
18:16
zakharyas joined,
domidumont1 joined
18:18
domidumont left
18:20
Ven`` left
|
|||
lizmat | Files=1233, Tests=76124, 302 wallclock secs (15.06 usr 5.48 sys + 2070.09 cusr 200.43 csys = 2291.06 CPU) | 18:22 | |
wow ^^^ | |||
18:32
igor__ joined
|
|||
igor__ | It's me again (the question about ~~ of seqs) | 18:33 | |
Probably you knew it, but it was a surprise for me, | |||
result of ~~ depdends on implementation: Perl6 from Debian returns True, | 18:34 | ||
psch | igor__: that's the same implementation, just an older version | ||
igor__ | and perl6 that I built using rakudobrew returns False | ||
psch | bisectable6: help | ||
bisectable6 | psch, Like this: bisectable6: old=2015.12 new=HEAD exit 1 if (^∞).grep({ last })[5] // 0 == 4 # See wiki for more examples: github.com/perl6/whateverable/wiki/Bisectable | ||
teatime | igor__: it might be such an old version that sort doesn't return a seq. | 18:35 | |
psch | bisectable6: old=2015.12 new=HEAD my @a = 2,4,1; say sort(@a) ~~ sort(@a) | ||
bisectable6 | psch, Bisecting by output (old=2015.12 new=8afd791) because on both starting points the exit code is 0 | ||
psch, bisect log: gist.github.com/455b8ae06915031698...7da6b2cbef | |||
psch, (2016-12-28) github.com/rakudo/rakudo/commit/43...296ecab5be | |||
igor__ | yes, you seem to be right | ||
ic$ perl6 --version This is Rakudo version 2017.12 built on MoarVM version 2017.12.1 implementing Perl 6.c. ic$ /usr/bin/perl6 --version This is perl6 version 2015.11 built on MoarVM version 2015.11 | |||
AlexDaniel | 6c: my @a = 2,4,1; say sort(@a) ~~ sort(@a) | ||
committable6 | AlexDaniel, ¦2015.12,2016.01.1,2016.02,2016.03,2016.04,2016.05,2016.06,2016.07.1,2016.08.1,2016.09,2016.10,2016.11,2016.12: «True» ¦2017.01,2017.02,2017.03,2017.04.3,2017.05,2017.06,2017.07,2017.08,2017.09,2017.10,2017.11,2017.12,2018.01,HEAD(8afd791): «False» | ||
psch | AlexDaniel++ | ||
igor__ | wow | 18:36 | |
that was cool | |||
AlexDaniel | .oO( what am I being ++-ed for? The bots are doing all the work ) |
||
igor__ | 6c makes magic | ||
6c: my @a = 2,4,1; say sort(@a) ~~ sort(@a).List | |||
committable6 | igor__, ¦6c (27 commits): «True» | ||
psch | AlexDaniel: knowing and working on the bots :p | 18:37 | |
igor__ | Wow, that was cool | ||
How can I use this bot offline? Or better to say, how can I use without IRC? | |||
Just to check my dumb question before asking them | 18:38 | ||
AlexDaniel | psch: what I find more impressive is that evalable6 figured out by itself that camelia is not here, and started responding to m: | ||
18:38
kjk joined
|
|||
AlexDaniel | never thought that this feature would be as useful :) | 18:38 | |
18:38
zakharyas left
|
|||
AlexDaniel | igor__: unfortunately there is no way currently, I have some ideas on how to make that happen but not much done yet | 18:39 | |
psch | yeah, that's pretty great | ||
AlexDaniel | igor__: you can of course compile rakudo on every release, that by itself will take a bit of time | ||
igor__ | Yes, I would do it | ||
And provide a public service doing this | |||
AlexDaniel | mm what do you mean? :) | 18:40 | |
igor__ | I'm working on a documentation service for different languages (cheat.sh; just do curl cheat.sh to see what it looks like) | ||
psch | igor__: maybe make it an irc bo- wait a second | ||
18:41
Kyo91 joined
|
|||
igor__ | perl6 is not yet integrated, but I'm working on it now | 18:41 | |
18:41
rindolf left
|
|||
igor__ | so it will be possible to get perl6 doc using cheat.sh (and all its interfaces like vim plugins, emacs plugins etc.). Probably it is not really useful for perl6, | 18:42 | |
teatime | igor__: nice. | ||
igor__ | because it has its own documentation mechanisms and they are really cool, | ||
psch | igor__: nah, it sounds like it could be useful | ||
igor__ | BUT | ||
AlexDaniel | interesting project | ||
igor__ | I want to integrate perl6 support in cheat.sh anyway, | ||
and now I had an idea: | |||
kjk | hello, 10.rand works but shouldn't rand(10:) also work? | 18:43 | |
igor__ | integrate not only doc, but execution also | ||
AlexDaniel | huggable: eval | ||
huggable | AlexDaniel, nothing found | ||
igor__ | and this feature (something like c6) | ||
psch | kjk: i think you mean 'rand 10:' | ||
igor__ | would be really cool here | ||
18:43
rindolf joined
|
|||
teatime | igor__: I'm actually rather impressed, because the commands I've tried so far actually have useful cheatsheets already. | 18:43 | |
psch | m: say rand 10: | ||
kjk | psch: doesn't work either | ||
evalable6 | (exit code 1) 04===SORRY!04=== Error while compiling /tmp/qRLhDwjZ8w Unsuppo… |
||
psch, Full output: gist.github.com/7cef0e5f02b365d844...d99f22e40f | |||
psch | kjk: ah, precedence there probably | 18:44 | |
m: say rand 10:: | |||
evalable6 | (exit code 1) 04===SORRY!04=== Error while compiling /tmp/TMhaVa_tKI Unsuppo… |
||
psch, Full output: gist.github.com/bf49a5fdc984c3984a...7a79330489 | |||
18:44
leah2 left
|
|||
psch | hmm, maybe not vOv | 18:44 | |
ooh, it's a per5-ism warning there | |||
kjk: yeah, it should work but we don't reach the... whatever we call the : there during parse because we hit a perl5-ism complaint first | 18:45 | ||
m: say 10: | |||
evalable6 | 10 | ||
kjk | perl5-ism warning messes up the grammar? | ||
igor__ | teatme: you cal try cheat.sh/perl/ by the way | ||
psch | kjk: FSDO "mess up," i suppose :) | ||
...i think that colon is also an invocant marker? the term seems bound to signatures in my head though | 18:46 | ||
18:50
igor__ left
|
|||
kjk | psch: rand being a term gives it higher precedence than calling like rand(10:) ? | 18:51 | |
psch | kjk: the parens are always wrong i think | ||
m: say(10:) | 18:52 | ||
evalable6 | 10 | ||
psch | uh | ||
...or i'm just confused | |||
m: class A { method foo { say "foo" } }; foo(A:) | |||
evalable6 | foo | ||
kjk | m: pick(^10:) | ||
evalable6 | |||
psch | kjk++ | ||
of course the parens are allowed, because : is just an invocant marker and it's still a normal invocation... >_> | 18:53 | ||
m: say &rand | 18:54 | ||
evalable6 | sub rand ( --> Num:D) { #`(Sub+{Callable[Num:D]}|93966989900360) ... } | ||
psch | m: say &term:<rand> | ||
evalable6 | (exit code 1) 04===SORRY!04=== Error while compiling /tmp/JuJI2NSlYq Undeclared routine: term:<rand> used at line 1. Did you mean 'term:<time>', 'term:<now>'? |
||
psch | kjk: rand doesn't seem to be a term | ||
well, we have a 'token term:sym<rand>' in Perl6::Grammar | 18:55 | ||
that's why we compile-time SORRY | |||
kjk | saw this in the doc: sub term:<rand> (--> Num:D) | ||
psch | huh, i wonder why that's there | 18:56 | |
the impl of &rand is a normal sub | |||
github.com/rakudo/rakudo/blob/mast....nqp#L3426 is the relevant bit of the core grammar | |||
that's where we compile-time bail | 18:57 | ||
kjk | I don't really understand the difference between a term and a normal sub. is it precedence? | ||
psch | terms have different parsing rules | 18:58 | |
and allow more than subs as their identifier too | 18:59 | ||
...actually i think that is the parsing difference | |||
i might be getting tired :) | |||
m: sub term:<dice> { 1..6 .pick }; say dice + dice | |||
evalable6 | 12 | ||
psch | m: sub dice { 1..6 .pick }; say dice + dice | ||
evalable6 | (exit code 1) Too many positionals passed; expected 0 arguments but got 1 in sub dice at /tmp/DJhj6EhYGP line 1 in block <unit> at /tmp/DJhj6EhYGP line 1 |
||
psch | kjk: ^^^ that's another difference actually | 19:00 | |
from docs.perl6.org/routine/term:%3C%3E | |||
kjk | psch: oh ic, thanks | 19:01 | |
TEttinger | m: sub term:<dice> { 1..6 .pick }; say dice + dice + dice + dice | 19:03 | |
evalable6 | 12 | ||
TEttinger | m: sub term:<dice> { 1..6 .pick }; say dice + dice + dice + dice | ||
evalable6 | 12 | ||
TEttinger | uh | ||
kjk | ha I think (1..6).pick is needed | ||
teatime | TEttinger: abhishekkr.github.io/slides/slide-...random.gif | ||
psch | oh right | ||
prefix:<^> vs infix:<..> | |||
TEttinger | but that wouldd be 3 right? | 19:04 | |
psch | the former has the space trick | ||
...or something? | |||
i give up, time for bed o/ | |||
TEttinger | m: sub term:<dice> { (1..6).pick }; say dice + dice + dice + dice | ||
evalable6 | 14 | ||
TEttinger | better | ||
m: sub term:<dice> { (1..6).pick }; say dice + dice + dice + dice + dice | |||
evalable6 | 17 | ||
TEttinger | still statistically unlikely | ||
err no | 19:05 | ||
that's average, or close | |||
m: sub term:<dice> { (1..6).pick }; say dice + dice + dice + dice + dice | |||
evalable6 | 15 | ||
TEttinger | ok, good | ||
19:10
leah2 joined
19:12
kjk left
19:29
leah2 left
19:34
greppable6 left
19:35
greppable6 joined
19:37
pecastro left
19:41
domidumont1 left
19:51
Rawriful joined
20:12
leah2 joined
20:30
ChoHag left
|
|||
DrForr | m: sub infix:<d>($a,$b){[+]{(1..$b).pick) xx $a}} | 20:32 | |
evalable6 | (exit code 1) 04===SORRY!04=== Error while compiling /tmp/sS0f4AFe1Y Unable … |
||
DrForr, Full output: gist.github.com/b84be515d7b8a115c4...fa8ddee656 | |||
20:33
Kaiepi left
20:36
Kaiepi joined
|
|||
AlexDaniel | m: sub infix:<d>($a,$b){[+]{(1..$b).pick xx $a}} | 20:36 | |
evalable6 | |||
20:55
teatime left
21:00
rindolf left
21:02
rindolf joined
21:05
|oLa| joined
21:07
markong left
21:13
colomon left
21:14
colomon joined,
MasterDuke joined
21:22
MasterDuke left
21:33
lasse_ left
21:40
rindolf left
21:45
MasterDuke joined
21:56
MasterDuke left
21:58
MasterDuke joined
22:04
markong joined,
MasterDuke left
22:05
Aaronepower joined
22:10
itaipu joined
22:39
setty1 left
22:42
shinobicl joined
22:43
shinobi-cl left
23:04
SourceBaby left
23:05
p6lert left
23:06
synopsebot left,
dalek left,
Geth left,
psch left,
Util left
23:07
sergot left,
masak left
23:09
Ven`` joined,
Ven`` left,
dalek joined,
ChanServ sets mode: +v dalek,
synopsebot joined,
Geth joined,
ChanServ sets mode: +v synopsebot,
ChanServ sets mode: +v Geth,
p6lert joined
23:11
colomon left,
Ven`` joined
23:17
cdg left
23:24
shinobi-cl joined
23:25
shinobicl left
|
|||
buggable | New CPAN upload: P5-X-0.0.1.tar.gz by ELIZABETH cpan.metacpan.org/authors/id/E/EL/...0.1.tar.gz | 23:25 | |
23:25
shinobicl joined
23:28
shinobi-cl left
23:30
Util joined
|
|||
lizmat | ^^ supporting -r -w -x -e -f -d -s -z -l | 23:30 | |
still a WIP, but usable so far | 23:31 | ||
23:31
Eddward joined
23:32
Ven`` left
23:34
wamba left
|
|||
buggable | New CPAN upload: P5built-ins-0.0.3.tar.gz by ELIZABETH cpan.metacpan.org/authors/id/E/EL/...0.3.tar.gz | 23:35 | |
23:50
comborico1611 joined
23:54
colomon joined
23:59
trnh left
|