»ö« 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.
AlexDaniel m: loop (my $x = 0, $x < 10, $x++) {} 00:00
camelia rakudo-moar 61d231: OUTPUT«5===SORRY!5=== Error while compiling /tmp/UkpsfHYHv1␤Malformed loop spec␤at /tmp/UkpsfHYHv1:1␤------> 3loop (my $x = 0, $x < 10, $x++7⏏5) {}␤»
AlexDaniel ↑ I wonder if there is any way to create a better error message here 00:01
although it is not too bad, it is not awesome too
Xliff_ *sigh* 00:06
Windows paste just died... WTF?
BRB
timotimo wtf is windows paste?
Xliff_ CTRL-V 00:07
timotimo oh
00:07 Xliff_ left 00:09 Majora320 joined
Majora320 /join #perl7 00:10
00:10 Majora320 left 00:11 labster left 00:12 Amnez777 joined
AlexDaniel huh? 00:12
00:12 labster joined 00:15 BenGoldberg joined
timotimo a funny joke, i guess? 00:15
00:18 Xliff joined
Xliff Wheee... 00:18
Rebooting is always fun.
OK. Due to metachars, there is no way to get this any cleaner, right? 00:19
s| \</p\>\v\</body\>\v\</html\>$||;
And actually, P6 really wants this:
s| \<\/p\>\v\<\/body\>\v\<\/html\>$||;
timotimo of course it can be cleaner
AlexDaniel ‘’
timotimo you can use quotes
Xliff Even with the Alternative delimeter on the substitution operator.
AlexDaniel just quote it! 00:20
Xliff s|' </p>\v</body>\v\</html>$'||; ?
ZoffixWin s| '</p>' \v '</body>' \v '</html>' $||;
Xliff OK. Thankee.
ZoffixWin s| "</p>\v</body>\v</html>" $||; # May work too
timotimo no, i don't think it would work
inside quotes, backslash sequences mean what they mean outside regexes 00:21
ZoffixWin timotimo, right, so won't that mean \v => vertical whitespace?
timotimo m: say "\v"
camelia rakudo-moar 61d231: OUTPUT«5===SORRY!5=== Error while compiling /tmp/xlcJeHGjMT␤Unrecognized backslash sequence: '\v'␤at /tmp/xlcJeHGjMT:1␤------> 3say "\7⏏5v"␤ expecting any of:␤ argument list␤ double quotes␤ term␤»
ZoffixWin Xliff, and here's the mandatory regexes for HTML thing: stackoverflow.com/questions/1732348...54#1732454
m: say so /\v/ 00:22
camelia rakudo-moar 61d231: OUTPUT«False␤»
ZoffixWin What's a \v?
timotimo m: "\x01".."\x30" .grep(/\v/).say
camelia rakudo-moar 61d231: OUTPUT«WARNINGS for /tmp/KlyolXYKZE:␤Useless use of ".." in expression "\"\\x01\"..\"\\x30\" .grep(/\\v/)." in sink context (line 1)␤()␤»
ZoffixWin I guess vertical whitespace... K... never mind me :D
AlexDaniel ZoffixWin: but you can parse html with a perl6 grammar, can't you?
timotimo m: ("\x01".."\x30").grep(/\v/).say
camelia rakudo-moar 61d231: OUTPUT«(␤
timotimo m: ("\x01".."\x30").grep(/\v/).&uniname.say
camelia rakudo-moar 61d231: OUTPUT«Cannot call uniname(Seq); none of these signatures match:␤ (Str:D $str)␤ (Int:D $code)␤ in block <unit> at /tmp/TQCKACclT4 line 1␤␤»
timotimo m: ("\x01".."\x30").grep(/\v/).map(&uniname).say 00:23
camelia rakudo-moar 61d231: OUTPUT«(LINE FEED (LF) LINE TABULATION FORM FEED (FF) CARRIAGE RETURN (CR))␤»
timotimo those are \v
ZoffixWin I get my mistake now.
Xliff ZoffixWin, ahh! Thanks! Bookmarking now.
timotimo AlexDaniel: yes, you very much can
Xliff And I'm not using rexexp to parse HTML. I am using it to REMOVE XML. 00:24
timotimo you can only remove XML properly if you parse it properly :P
ZoffixWin :P
timotimo otherwise you'll easily get confused by smileys that include > and <
ZoffixWin Xliff, sure, that's why I merely mentioned and not shouted at you ^_^
Xliff If the problem-set requires that the program needs to grok XML. 00:25
If the XML is just the same as any other text, it isn't parsing.
There is a difference, even if it's splitting hairs.
And I'm assured that I do not have to worry about smileys.
AlexDaniel .tell jnthn hey. Perhaps leave this in a terminal for several minutes or something: 「while :; do perl6 -e 'await (start { print ‘x’; sleep 1; } for ^100); say ‘’;'; done」 00:27
yoleaux AlexDaniel: I'll pass your message to jnthn.
AlexDaniel .tell jnthn also, there's one thing that I've noticed. Maybe that will tell you something, who knows. See this screenshot: files.progarm.org/2016-04-08-03282..._scrot.png . So, it looks like there's a maximum number of threads or something, so these ‘x’-es are appearing in batches. It crashes only during the second batch, hmmm… 00:30
yoleaux AlexDaniel: I'll pass your message to jnthn.
AlexDaniel .tell jnthn that is, the exception always appears after exactly 32 ‘x’ characters
yoleaux AlexDaniel: I'll pass your message to jnthn.
ZoffixWin New post: Perl 6 Is Slower Than My Fat Momma! blogs.perl.org/users/zoffix_znet/20...momma.html 00:32
Xliff Directive d not applicable for type Str
???
ZoffixWin Xliff, forgot .IO? 00:33
Xliff Nope. Not using any of the IO ops.
Just filehandles.
ZoffixWin Are you able to pastebin the code in question? 00:34
Xliff My biggest problem is that's all I'm getting. I'm not getting a location so I can isolate and fix on my code.
Yeah. One sec.
pastebin.com/gWpZaV0e 00:36
ZoffixWin++ -- Loved that blog post. 00:38
sortiz ZoffixWin++ # blog
Xliff Heh
ZoffixWin No idea why that code shows that error :S
Xliff Yeah. Figured it out. 00:41
"$newIndexF.defined" was what was throwing the error. Replaced with "$newIndex === Nil" fixed it. 00:42
Still, I would expect a better error to be emitted for that.
ZoffixWin, another datapoint. If I do "if (!$indexF.defined) { ... }" it works as opposed to "{...} if !$indexF.defined" 00:55
ZoffixWin Xliff, it's ... if blah, not { ... } if blah
Xliff, or you can use: do { ... } if blah 00:56
00:58 vendethiel- joined
Xliff ZoffixWin, Yes. 00:59
ZoffixWin, (corrected) another datapoint. If I do "if (!$indexF.defined) { ... }" it works as opposed to "... if !$indexF.defined"
What I meant was not what I typed...
ZoffixWin *shrug*
00:59 vendethiel left
Xliff goes for beer. 00:59
01:08 cdg left 01:13 Skarsnik left
Xliff The one thing Windows (with proper utilities) does better than the Linux CLI -- mass renaming. 01:14
timotimo huh? "with proper utilities"? 01:15
that's not a fair comparison. you can get good utilities for the linux cli, too 01:16
ZoffixWin huh?
timotimo goes to bed 01:17
ZoffixWin Xliff, Linux has `rename`... what does Windows have, even with "proper utilities"?
sortiz timotimo, o/
01:19 BenGoldberg left
Xliff ZoffixWin, BulkRename. 01:19
It's cumbersome, but powerful.
ZoffixWin Never heard of it.
Xliff www.bulkrenameutility.co.uk/Main_Intro.php
01:20 BenGoldberg joined
ZoffixWin Can't recall a time when Linux's `rename` wasn't powerful enough for me, since it can do directories too 01:20
Xliff Yikes!
How did I miss 'rename'?
01:21 Actualeyes joined
ZoffixWin ¯\_(ツ)_/¯ 01:21
Takes a while to learn everything.
Xliff (It's because I'm always translating 'rename' to 'mv' when I'm on a Unix shell.... *sigh*)
¯_(ツ)_/¯
indeed!
Hmm....
Script is borked.
¯\_(ツ)_/¯ 01:22
There we go.
01:28 raoulvdberge left 01:33 telex left 01:34 telex joined
ZoffixWin We reached 600 modules in ecosystem! :) 01:36
AlexDaniel now let's remove some! 01:38
Xliff \o/
01:41 skink joined 01:42 vendethiel- left, vendethiel joined 01:44 skids joined 01:45 kid51 joined 01:46 ilbot3 left 01:47 ilbot3 joined
skink Is there a performance-optimal means of string concatenation? 01:47
skids Theoretically the "rope" system should prevent reallocs internally. 01:50
Not sure how smart it is yet.
Xliff ♥s rename. 01:51
skink I've a UUIDv4 implementation. Does 300+ hex strings per second, but two different ways of inserting the dashes reduces it to just over 100 per second 01:52
skids Could be in the splitting as well. 01:54
timotimo a --profile should be able to tell you whether it's in "split" or "join" or "infix:<~>" or what else 01:58
timotimo AFK for sleep
Xliff night "timo" x 2 01:59
skids m: 0xde305d5475b4431badb2eb6b9e546014.polymod(0x100000000,0x10000,0x10000,0x10000).reverse».base(16).join("-").say
camelia rakudo-moar 61d231: OUTPUT«DE305D5475B4-431B-ADB2-EB6B-9E546014␤»
skids m: 0x100000000000000000000000000000000.rand.polymod(0x100000000,0x10000,0x10000,0x10000).reverse».base(16).join("-").say 02:01
camelia rakudo-moar 61d231: OUTPUT«58ADBD9D01B-DE80-0-0-0␤»
skids m: 0x100000000000000000000000000000000.rand.Int.polymod(0x100000000,0x10000,0x10000,0x10000).reverse».base(16).join("-").say
camelia rakudo-moar 61d231: OUTPUT«441CC60BAB09-9800-0-0-0␤»
Xliff Can you refer to a previously matched pattern in the same regexp? 02:02
So...
m/ '<' (.+? '>' (.+?) '</' $0 '>/ 02:03
skids m: (0..^0x100000000000000000000000000000000).pick.polymod(0x100000000,0x10000,0x10000,0x10000).reverse».base(16).join("-") for 0..1000; say now - INIT now
camelia rakudo-moar 61d231: OUTPUT«0.4205267␤»
Xliff m: "<p>This is a test</p> ~~ m/ '<' (.+? '>' (.+?) '</' $0 '>/
camelia rakudo-moar 61d231: OUTPUT«5===SORRY!5=== Error while compiling /tmp/kfVTT09G0z␤Unable to parse expression in double quotes; couldn't find final '"' ␤at /tmp/kfVTT09G0z:1␤------> 3/p> ~~ m/ '<' (.+? '>' (.+?) '</' $0 '>/7⏏5<EOL>␤ expecting any of:␤ post…»
TimToady missing )
Xliff m: "<p>This is a test</p>" ~~ m/ '<' (.+? '>' (.+?) '</' $0 '>/
camelia rakudo-moar 61d231: OUTPUT«5===SORRY!5=== Error while compiling /tmp/eyOpvFmxGY␤Unable to parse expression in single quotes; couldn't find final "'" ␤at /tmp/eyOpvFmxGY:1␤------> 3p>" ~~ m/ '<' (.+? '>' (.+?) '</' $0 '>/7⏏5<EOL>␤ expecting any of:␤ sing…»
skink --profile's output is so neat
Xliff m: "<p>This is a test</p>" ~~ m/ '<' (.+? '>' (.+?) '</' $0 '>'/ 02:04
camelia rakudo-moar 61d231: OUTPUT«5===SORRY!5=== Error while compiling /tmp/rCzqizYC3t␤Unable to parse expression in metachar:sym<( )>; couldn't find final ')' ␤at /tmp/rCzqizYC3t:1␤------> 3p>" ~~ m/ '<' (.+? '>' (.+?) '</' $0 '>'7⏏5/␤ expecting any of:␤ infi…»
Xliff m: "<p>This is a test</p>" ~~ m/ '<' (.+?) '>' (.+?) '</' $0 '>'/
camelia ( no output )
TimToady you have to say it
ZoffixWin m: "<p>This is a test</p>" ~~ m/ '<' (.+?) '>' (.+?) '</' $0 '>'/
camelia ( no output )
Xliff m: say "<p>This is a test</p>" ~~ m/ '<' (.+?) '>' (.+?) '</' $0 '>'/;
camelia rakudo-moar 61d231: OUTPUT«「<p>This is a test</p>」␤ 0 => 「p」␤ 1 => 「This is a test」␤»
Xliff YAY! 02:05
ZoffixWin Xliff, do I have to link to the HTML regex parsing thing again? :D
Xliff LOL!
ZoffixWin, nope. This is pushing the parsing argument, but it really isn't.
=-D
ZoffixWin :)
02:05 araujo left
Xliff Besides, I don't know what I'd do if I really would need to parse HTML. 02:06
libxml2?
02:06 araujo joined
skids (0..^0x100000000000000000000000000000000).pick.polymod(0x100000000,0x10000,0x10000,0x10000).reverse».base(16).join("-").say for 0..10; # Hrm lots of 0s in there. 02:06
m: (0..^0x100000000000000000000000000000000).pick.polymod(0x100000000,0x10000,0x10000,0x10000).reverse».base(16).join("-").say for 0..10; # Hrm lots of 0s in there.
camelia rakudo-moar 61d231: OUTPUT«320000000118-F168-5000-0-4AD4029B␤6B00000006FF-D09E-6000-0-2E58B5C9␤F80000000508-30AC-C000-0-356F0756␤D600000006A6-A2F4-F000-0-2CD562DE␤D400000000B9-9DD4-4000-0-42052CC6␤C20000000760-AA36-6000-0-40B801F7␤47000000057A-5F9F-8000-0-5A354726␤B300…»
ZoffixWin I see Gumbo in the ecosystem, though personally, I just use Mojo::DOM via Inline::Perl5... It's hard to beat the awesomeness of that module.\
Xliff looks at Mojo::DOM. 02:07
02:07 BenGoldberg left
ZoffixWin metacpan.org/pod/Mojo::DOM 02:07
Xliff Problem is, I am trying to do this as light weight as possible. Including DOM/XML parsing modules add significant weight.
02:07 BenGoldberg joined
Xliff Although.... 02:08
ZoffixWin++ # Mojo::DOM
ZoffixWin use Mojo::DOM:from<Perl5>; say Mojo::DOM.new('<p>This is a test</p>').at('p').all_text 02:09
beats messing around with regexes that have flaws.
02:10 dvinciguerra__ left
Xliff Hmph! My regexes don't have flaws! --- after I've fixed them. 02:10
skink skids, Slightly more complicated since I'm actually reading bytes out of a buffer to convert to hex
skids Ah, are you usin subbuf?
02:12 kid51 left, perlawhirl joined
sortiz skink, I'm interested in any solution you find, I need the same in DBIish. 02:12
02:13 notostraca joined
skink Actually I have a buffer of 16 bytes which I .unpack("H16") and then use .substr-rw() to insert the dashes 02:13
Reference implementation used bytes[a..b].fmt ~ "-" and so on
perlawhirl .tell Ulti Ulti++ for getting Rakudo on glot.io... and a bonus point for ruining the sites perfect 7x4 grid :D
yoleaux perlawhirl: I'll pass your message to Ulti.
skids substr-rw is likely to still be a very naive implementation.
skink Yup :D 02:14
02:14 TEttinger left
skink sortiz, I'm writing this for the Extra module in Crypt::Random 02:15
(Which needs Windows testing, if anyone's interested)
There's also P6-UUID already on the modules list 02:16
Unless you were referring to fast concat in general
sortiz Nope, today only in a fast UUID.Str 02:17
Need 02:18
to see the current options.
02:19 kid51 joined, jeek left, jeek joined
sortiz For UUID storage the best option is a Buf[uint64], imo. 02:20
skink P6-UUID gives me... exactly the same performance as mine. Interesting. 02:23
02:23 BenGoldberg left
skink My base function, crypt_random_buf(), returns Buf[uint8] 02:24
02:24 BenGoldberg joined
sortiz I'm working on DBIish's type system, and there is a standard SQL UUID type that need to support, but nothing in core. 02:24
02:25 labster left
sortiz Any Buf is ok. 02:25
02:26 cdg joined
skink If you just want a Buf, you can call crypt_random_buf(16). 02:27
I just imagined most would want an Str.
skids m: my @dashes = "" xx 16; @dashes[3,5,7,9] = "-" xx *; (flat buf8.new(1..16)».fmt("%2.2x") Z @dashes).join for 1..1000; say now - INIT now;
camelia rakudo-moar 61d231: OUTPUT«4.8246475␤»
skink Hm. 02:28
02:29 labster joined 02:36 noganex joined
skink skids, That gets 11s on my somewhat older machine 02:37
skids ah so slower.
skink My substr-rw is actually 2-3s faster for me, funny enough. 02:38
02:39 noganex_ left, yqt left, kid51 left
skink Don't suppose I could get the bot to 'use UUID;' for comparison, eh? 02:41
Xliff skink: If you need Windows testers, please let me know.
skink Xliff, I absolutely do. For *nix I just read from /dev/urandom. Windows I have to use NativeCall for CryptGenRandom()/RtlGenRandom(). 02:43
skids hrm. 02:44
m: use experimental :pack; buf8.new(1..16).unpack("H16") for 0..1000; say now - INIT now; # just the unpack takes lots of time.
camelia rakudo-moar 61d231: OUTPUT«4.6388444␤»
AlexDaniel ZoffixWin: is there anything Mojo::DOM does that you can't do with Gumbo?
skink I just pushed an RtlGenRandom() bind earlier. Originally I was going to bundle a compiled form of getentropy_win.c from LibreSSL.
github.com/skinkade/crypt-random
AlexDaniel ZoffixWin: Gumbo returns an XML thingy, so you can use any other XML:: module to work with that 02:45
Xliff Cloning.
D'oh! 02:49
No panda in rakudo-star distribution for Win.
skids m: use experimental :pack; my @dashes = "" xx 16; @dashes[3,5,7,9] = "-" xx *; (flat :256[buf8.new(1..16).values].base(16).comb(/../) Z @dashes).join for 1..1000; say now - INIT now; # use that :256[buf8.new(1..16).values].base(16) with substr-rw maybe.
camelia rakudo-moar 61d231: OUTPUT«3.1112866␤»
Xliff Used rakudo-star-2016.01-x86_64 (JIT).msi
02:52 yurivish joined 02:53 notostraca is now known as TEttinger, johndau joined
Xliff skink, pastebin.com/9UwCHYd6 02:55
No "if" ??? WTH?
skink Heh. 02:56
There's an 'if' module :)
use if; 02:57
use Crypt::Random::Win:if($*DISTRO.is-win);
use Crypt::Random::Nix:if(!$*DISTRO.is-win);
That's probably not the best way to do that, I admit.
Xliff (Windows)$ c:/rakudo/bin/perl6.bat -e 'use experimental :pack; my @dashes = "" xx 16; @dashes[3,5,7,9] = "-" xx *; (flat :256[buf8.new(1..16).values].base(16).comb(/../) Z @dashes).join for 1..1000; say now - INIT now; # use that :256[buf8.new(1..16).values].base(16)'
>> 3.701469
skids just ran that here and it returned --> <camelia> rakudo-moar 61d231: OUTPUT«3.1112866␤» 02:58
skids m: my @dashes = "" xx 16; @dashes[3,5,7,9] = "-" xx *; (:256[buf8.new((^256).pick xx 16).values].fmt("%32.32x") ~~ /(........)(....)(....)(....)(............)/).join("-") for 1..1000; say now - INIT now; # who woulda thunk rx would be faster
camelia rakudo-moar 61d231: OUTPUT«0.80267970␤»
Xliff skink: Isn't that deployed with rakudo? If not I need to figure out the best way to get a package manager for Windows. 02:59
Xliff is now playing: Sub Focus - Turn Back Time (Special Request Remix) 03:00
skink Nope 03:01
I can probably remove the Subsets::Common dependency. Really only added it to promote that package's use. 03:03
dalek rl6-most-wanted: 1872d8d | (Rich Loveland)++ | most-wanted/modules.md:
Update link to File::Find module
rl6-most-wanted: fd34725 | azawawi++ | most-wanted/modules.md:
Merge pull request #24 from rmloveland/file-find-fix

Update link to File::Find module
skink The 'if' module stuff I'll happily replace if someone knows a better way.
Xliff is now playing: Prince - TIME 03:07
OMG.... Most underrated Prince song... EVAH!
skink, pastebin.com/dUDKNKWY 03:12
I don't seem to have the best Windows environment for Perl6.
Probably pathing issues.
But that's what I got when I was finally able to run the first test.
Looks more like an error in Win.pm6 than in Crypt::Random. 03:13
skink Where it says <HERE>, there's supposed to be a closing paren :)
Woopsie 03:14
Xliff Oh. LOL.
D:\SVN\Github\crypt-random\lib\Crypt\Random\Win.pm6:31 <--- I see now!
I will add paren and retest.
All tests now complete fine. 03:15
skink Really??
I mean, yeah, they totally should.
Xliff Will pastebin output.
skink *cough*
Xliff LOL!
skink++ # That's his story and he's sticking to it!!!
Updated with all results - pastebin.com/dUDKNKWY 03:16
skink Neat. If you add the api version like it's suggesting, does anything, well, break? 03:18
The 'native(Advapi32, v1)' bit
03:19 Actualeyes left
skink Else I think that NativeCall message will get to be incessant. 03:20
Xliff is now playing: Keeno - Nocturne (Frederic Robinson Remix) 03:21
skids There's an underhanded way to get rid of that message, IIRC.
Xliff skink: Will check. One sec. 03:22
Xliff is all in for underhandedness.
skink This is a crypto lib. Let's try to be at least somewhat clean, eh?
Xliff LOL 03:25
Nope. Blows up every time I try that or a variant.
skink Right. iirc when I was doing something with that, adding 'v1' would make it search for lib.so.1 and it'd blow up. 03:26
Xliff However, this worked:
sub SystemFunction036(CArray[uint8], uint64)
returns Bool
is native('Advapi32', v1)
{ * }
skids is native('crypto', v0 but False)
I don;t know if that trick still works.
Xliff And the suggestion is not emitted with that change. 03:27
This, however... didn't:
is native ('Advapi,v1')
Lemme try
is native ('Advapi32,v1')
skink No, they're separate params 03:28
Xliff Yeah. That last blew up.
So...
is native('Advapi32', v1)
skids If you're good with v1.
skink The API is the same since Win XP. 03:29
Xliff LOL
I am good if you are. :D 03:30
skids Is the lib major also the same?
Xliff I have no clue.
My abilities to "slurp clue" are diminishing by the second.
Fuck beer. Got RUM!
Dude. If you are able at all... 03:31
Listen:
Xliff is now playing: Keeno - Nocturne (Frederic Robinson Remix)
Xliff bops.
OK -- question. I assume if an IO::Path object points to a file, you can .open and get an IO::Handle? 03:32
Will test. One sec.
skids It's kinda sad if you type "clue" and then any other word into google all the results are for people cheating on crossword puzzles.
skink skids, The situation with RtlGenRandom() is... odd. It uses the same CSPRNG as CryptGenRandom(), yet isn't defined in any sys headers
It's only available through dynamically loading that dll. 03:33
I'm using it for the moment because it's a lot simpler to bind to.
Xliff I blame you not. 03:34
Laziness. It's a programmer's virtue.
03:36 cdg left
Xliff What does the error "Missing block!" mean? 03:40
skink I pushed, btw, Xliff.
03:41 _28_ria left
Xliff skink: Cool. I'll sync in a sec. 03:41
skink: *purrrr* -- Tests complete fine. 03:42
skink Could you run the functions and see if their outputs seem sane?
03:43 Dunearhp left
Xliff skink: Elaborate, please? 03:43
Do you want me to run the individual functions and check output rather than run the t/* files?
Halp! 03:45
pastebin.com/Mciba552
Something THAT simple should not be generating errors.
03:45 dvinciguerra__ joined
Xliff Especially errors where the monkey can't clearly point to the line in question. 03:46
skink Yup. Shouldn't be necessary if the tests passed, but I just wanna make sure since I can't set up a Win install for myself atm.
Xliff is now playing: DJ CLART/MSDOS - Funk Incentive
skink: OK. One sec.
skink c:/rakudo/bin/perl6.bat -e 'use Crypt::Random; say crypt_random(); say crypt_random_uniform(10000); say crypt_random_buf(16);' 03:47
That help?
Xliff LOL! 03:49
>perl6 -Ilib -e "use Crypt::Random; say crypt_random_buf(64); say crypt_random_buf(32); say crypt_random_buf(23);"
Buf:0x<91 53 26 d4 e2 ab 20 83 35 40 dd 63 25 be 4c 17 03 de 46 08 a4 64 3a 89 c5 55 9c ee f5 c1 ff 79 b2 83 61 a2 0d c3 8e fd b5 bf f6 97 61 02 58 a2 a5 71 c34c 5c 04 cf 70 ff 15 77 b6 04 42 ed c7>
Buf:0x<bd d0 d7 2e cd 70 ae be 64 33 46 70 7d 9b 84 8d df d6 56 f3 27 7e 2c 8b e4 66 14 ac b5 95 ba 8a>
Buf:0x<e4 d9 9f 46 14 4a 41 36 e5 67 33 40 95 69 d7 9f 0c ed 20 0e 0f 8b 48>
Do you really want me to do 10000, skink? ..... R..e..a..l..l..y?
I threw in the 23, just to see how it handled a prime.
m: say 23.is-prime 03:50
camelia rakudo-moar 61d231: OUTPUT«True␤»
Xliff OK. Just checking.
03:52 khw left
BenGoldberg Shirley a function named crypt_random_uniform(10000) would return a (single) random Num in the range [0,10000), no? 03:53
BenGoldberg wanders off to go read some docs. 03:54
Actually, it being past my bedtime, I'd better go sleep, instead.
03:54 BenGoldberg left
skink Xliff, See the README ya silly. 03:55
10000 is the $upper_bound for that function, like Ben was thinking.
Xliff LOL. 03:56
I did say "RUM", remember?
"RUM".reverse === the first syllable of "MURDER" 03:57
¯\_(ツ)_/¯
Ahh... using crypt_random_buf() doesn't have that upper limit. 04:03
Xliff is now playing: The Time - Ice Cream Castles 04:04
skink Originally it had a 256 bytes limit because some syscalls I was thinking of using had that. 04:06
RtlGenRandom() actually takes a uint64 for its length option, amazingly. 04:08
Xliff for dir(test => /:i '.' html $/) -> $file { say $file } --> Missing block error. Any ideas?
skink To quote you: ¯\_(ツ)_/ 04:09
Xliff Heh! Fair enough.
skink That was strangely difficult to copy. Kept morphing as I tried to highlight it.
Xliff m: for <a b c> -> $l { say $l; } 04:10
camelia rakudo-moar 61d231: OUTPUT«a␤b␤c␤»
Xliff Odd. When I try to do that locally, I get the Missing Block error.
Lemme update rakudo. 04:11
skink While it's an unreasonable hour to do so now, who would I talk to about reviewing Crypt::Random and getting it added?
Xliff Oh FFS! --- ')' instead of '}' 04:16
I blame my fonts!
04:23 Cabanossi left 04:25 Cabanossi joined
Xliff m: use Mojo::DOM:from<Perl5>; my $m = Mojo::Dom.parse('<p>This is a test</p>'); for $m.find('p') -> $p { say $p; } 04:32
camelia rakudo-moar 61d231: OUTPUT«===SORRY!===␤Please install Inline::Perl5 for Perl 5 support. ␤»
Xliff Ah.
See, THIS is the reason I wanted to use regexes for this.  04:42
Sometimes even the best modules have quirks that don't have a reasonable solution. Especially when changing object models, ala perl5 -> perl6
Crap. I might need the call() format. 04:47
04:49 skink left
Xliff Or Inline::Perl5::run 04:52
04:58 Actualeyes joined
dalek rl6-most-wanted: 9766349 | (Rich Loveland)++ | most-wanted/modules.md:
Update link to Shell::Command module
04:58
rl6-most-wanted: 741b7cd | azawawi++ | most-wanted/modules.md:
Merge pull request #25 from rmloveland/shell-command-fix

Update link to Shell::Command module
05:08 _nadim left, _nadim joined
Xliff OK. 05:14
Looks like we have a really weird situation going on with regexes. 05:15
36k file.
for $contents ~~ m:g/ '<' (.+?) '>' (.+?) '</' $0 '>'/ -> $t {
... } <--- Seems to be an endless loop.
AlexDaniel Xliff: maybe you'll finally stop trying to parse html yourself? :D 05:17
Xliff AlexDaniel: I've tried using Mojo::DOM and it didn't work.
AlexDaniel Xliff: good. Just use Gumbo
Xliff Gumbo might not work. Mainly because I might not have a good enough understanding of Inline::Perl5. 05:18
Gumbo is perl6 native though, right?
But that's really not the issue.
The above for loop never completes and it should.
Dropping the length of $contents from 36k to 500, the loop completes immediately. 05:19
AlexDaniel Xliff: Gumbo is a Perl 6 module
Xliff AlexDaniel, good to know. That's next.
Dropping the length of $contents to 5k... the loop still never completes.
Could be the regexp? But why work at 500, and not 5k? 05:20
AlexDaniel Xliff: I don't think that it is a bug. Most likely it starts backtracking and it just takes time…
Xliff OK. Can I turn off backtracking?
Xliff looks at docs.
AlexDaniel Xliff: perhaps you can make its life easier by doing something like '<' (<-['>']>+) '>' 05:21
skids Some of that works. Like use an empty closure e.g. "{ 1; }" as a sequence point
Xliff m/ '<' (.+:?) '>' (.+:?) '</' $0 '>'/ <-- ? 05:22
I'm getting this at the end of execution:
"Cannot convert string to number: base-10 number must begin with valid digits or '.' in '...'"
Where "..." is the rest of $contents 05:23
Definitely an improvement --> m:g/ '<' (<-[>]>+) '>' (.+?) '</' $0 '>'/ 05:25
05:26 cdg joined 05:31 cdg left
Xliff OK. Maybe my code was REALLY borked but still parsed. 05:31
Yup. Seems to be working now. Weird little performance loop due to a single line. Wow. 05:33
Hrm. Gumbo is just a parser. I was hoping for a DOM manipulation tool. 05:41
Still might work, though.
05:45 buharin joined
Juerd Note that you can also write 'between <>' using the ~ operator: /'<' ~ '>' .+?/ 05:49
Note that you can also write 'between <>' using the ~ operator: /'<' ~ '>' <-[>]>+/ # more fair comparison 05:50
perlawhirl Juerd++ I didn't know that
Juerd I like it because it keeps the pair of brackets together
perlawhirl yeah it's nice
05:55 _28_ria joined
ufobat tadzik, here is your friendly daily reminder to criticize my PR :D 05:59
05:59 CIAvash joined
ufobat morning perl6 :D 05:59
06:00 geekosaur left 06:01 geekosaur joined 06:05 domidumont joined 06:08 skids left 06:12 domidumont left
Xliff Juerd: Can you do /'<' (~) '>'/ and have that captured properly? 06:17
06:20 AlexDaniel left 06:23 domidumont joined 06:24 domidumont left 06:25 domidumont joined 06:31 nakiro joined 06:32 labster left 06:33 geekosaur left 06:34 geekosaur joined 06:35 geekosaur left 06:36 geekosaur joined 06:52 fireartist joined 06:55 labster joined
dalek Iish: e3e7d99 | (Salvador Ortiz)++ | / (3 files):
Pg: Add Date and Timestamp (DateTime) support

See t/37-pg-datetime.t for examples. Closes #41
07:00
07:00 buharin left 07:11 yeahnoob joined 07:13 wamba joined
Xliff Anyone awake? 07:16
moritz Xliff: just us bots
07:17 nakiro left
Xliff LOL 07:17
Why doesn't this work as expected?
pastebin.com/npQxBzry
moritz m: constant %h = 1, 2; say %h.WHAT
camelia rakudo-moar 61d231: OUTPUT«5===SORRY!5=== Error while compiling /tmp/aSpNlgLrjR␤Type check failed in constant declaration of %h; expected Associative but got List (List)␤at /tmp/aSpNlgLrjR:1␤------> 3constant %h = 1, 27⏏5; say %h.WHAT␤»
sortiz \o
Xliff I accept answers from bots.
I am a believer in beneficial artificial intelligence. 07:18
moritz diakopter: why did you resolve RT#111944?
synopsebot6 Link: rt.perl.org/rt3//Public/Bug/Displa...?id=111944
moritz diakopter: the problem (no coercion) still persists
Xliff I do this because trying to use Mojo::DOM from Perl6 results in undefined values from routines that should return lists. 07:19
The pastebin code returns:
Can't call method "find" on an undefined value at (eval 6) line 3.
07:20 nakiro joined
moritz so, what's in $m? 07:21
Xliff: uhm, do you know perl 5? :-)
sortiz Xliff, In L#21 are you sure that $m is defined?
moritz sub mojo_find($m, $t) {
that looks like Perl 6 code, not like Perl 5
(perl 5 has experimental subroutine signatures in the newest versions, but I believe you have to explicitly enable them, no?) 07:22
sub mojo_find { my ($m, $t) = @_; ... }
sortiz Yep! Don't see that! (Too much perl6 ;-)
07:24 rindolf joined, abraxxa joined
Xliff LOL! 07:25
07:26 yeahnoob left
Xliff <--- BEER AND RUM 07:26
Tha's my excuse and I'm sticking to it!
(Yes, I do know P5)
OK. Shit just got real. I am going to pastebin. 07:28
pastebin.com/npQxBzry 07:29
Minor note: If I was sober, I would have long since given up on the frustration. 07:30
Which is why.... BEER AND RUM!
YAZ.
Xliff should really be sleep now, even if he has to have a BOOT TO THE HAID!
Which, I probably should, since I spelled "HEAD" as "HAID". 07:31
( ಠ益ಠ)
Cray cra updated: pastebin.com/npQxBzry 07:35
07:35 fireartist left 07:36 fireartist joined
Xliff Cray cra even moar updated: pastebin.com/npQxBzry 07:36
The reason I am using the p5 sub is because when I try to use $m.find() in a P6 context, I don't get anything back, and I should. 07:38
moritz is that because of list vs. scalar context?
Xliff Even using $m.children() returns nothing, and I know that there are <p> tags in $content.
moritz: An earlier version did "my @tags = $m.children('p')" with no results. 07:39
Timbus the error indicates that, somehow, $m is undefined. at least from perl5's point of view 07:40
Mojo::DOM source confirms that its trying to do $_[0]->_css 07:41
Xliff Timbus: I can confirm that $m is "Inline::Perl5::Perl5Object.new(ptr => NativeCall::Types::Pointer.new(211119144), perl5 => Inline::Perl5.new)" before the $p5.call()
Timbus which is what initially failed in find()
why not print out what $m is from your perl5 sub
Xliff OK
07:43 zakharyas joined
Timbus at a guess its like.. a blessed undef? because the -> part works.. 07:43
Xliff Updated pastebin: pastebin.com/npQxBzry 07:45
the "Inline::Perl5::Perl5Object.new(ptr => NativeCall::Types::Pointer.new(216816896), perl5 => Inline::Perl5.new)" says that $m is not undefined.
At least not according to P6 07:46
Timbus i know that part, but yeah, something happens to it when you pass it back
garbage collection?
Xliff OK. Just as long as I am not making an obvious mistake. 07:47
.....am I?
Now H
*ggrrrr*
Now GC would be non-obvious. I wouldn't expect GC to hit the way the scoping should work.
Depends on how Inline::Perl5 works. 07:48
Timbus I mean the perl 5 GC. like you even get some crazy double-free thing going on after it crashes
and youre clearly calling methods on undefs, which should definitely be defined
Xliff Timbus, JINX! --> *punch*]
Timbus :/ 07:49
Xliff LOL
Seriously. I appreciate the help.
Timbus you might wanna uhh.. make your Mojo::DOM in the perl5 sub, or not use .call ?
Xliff You mean use "Mojo::DOM" in the p5 scope?
Timbus I mean, that's not really what you should do, but if you have to... 07:50
Xliff Can't NOT use call, since I tried it that way at first and got Nil as a result.
Timbus Nil seems saner than your other attempts, tbh 07:51
Xliff "$m.children('p')" should have returned a list of Mojo::Collection, but did not. It returned undef. 07:52
Or Nil, if you want to be technical. But it should not have returned that.
I know what the XML/HTML looks like. I did not get the results that I expected. 07:53
07:53 domidumont left 07:54 domidumont joined
Xliff Please note: that does not mean my expectations were correct. Just that they did not match what I got. 07:54
Timbus hmmm. but it doesn't crash. maybe your input string is the problem? I wish I could run this code but my perl is built without a linkable library
so I have no inline:p5
what even -is- .slurp-rest 07:56
oh you use it on open handles vs IO's, gotcha. 07:58
08:01 zakharyas left 08:02 sftp left
Xliff YYes. 08:03
Err...Yes. That is correct.
08:03 sftp joined
Xliff That part seems to work. It is the call to Mojo::DOM::children that does not. 08:04
08:04 labster left
Timbus yeah just making sure no lazy list magic or something is going on 08:04
08:04 perlawhirl left
Xliff OK. 08:05
I thought that might be the case, too. Hence the $p5.run() call.
08:09 CIAvash left
Xliff Must be something I am missing about Mojo::DOM which I am just now learning. 08:10
08:11 zakharyas joined 08:12 labster joined 08:13 darutoko joined 08:18 nadim joined 08:21 _nadim left 08:28 sdo joined
sdo hello 08:28
08:28 RabidGravy joined
sdo I am trying to recompile Perl 6 Racudo. Everything is fine. 08:29
I am on Mac OS X 10.11.4 is the Mac OS version.
One question struggle me. Why it needs Java 7 at least to compile? I don't understand why it needs Java... Can you tell me why? Thx very much... 08:30
El_Che sdo: you're maybe compiling the jvm backend? you can specify to only compile moarvm 08:31
jnthn sdo: It only needs Java/JVM if you want to build it with support for compiling to the JVM. If you don't want that, just configure with --backend=moar or so 08:32
yoleaux 00:27Z <AlexDaniel> jnthn: hey. Perhaps leave this in a terminal for several minutes or something: 「while :; do perl6 -e 'await (start { print ‘x’; sleep 1; } for ^100); say ‘’;'; done」
00:30Z <AlexDaniel> jnthn: also, there's one thing that I've noticed. Maybe that will tell you something, who knows. See this screenshot: files.progarm.org/2016-04-08-03282..._scrot.png . So, it looks like there's a maximum number of threads or something, so these ‘x’-es are appearing in batches. It crashes only during the second batch, hmmm…
00:30Z <AlexDaniel> jnthn: that is, the exception always appears after exactly 32 ‘x’ characters
sdo thanks
Ulti out of curiosity what is the reducing bracket [] metaop doing? because its quite often incredibly unreasonably fast compared to loops 08:33
yoleaux 02:13Z <perlawhirl> Ulti: Ulti++ for getting Rakudo on glot.io... and a bonus point for ruining the sites perfect 7x4 grid :D
Ulti Yeah I felt bad pushing swift out of the grid 08:34
Xliff lol
Ulti Swift is like the corporate sister to Perl 6 in my mind especially around some of its bigger opinion pieces like unicode support 08:35
jnthn Ulti: It's probable that it's using the iterator API directly and making assumptions a loop cannot and perhaps saving the invocation overhead of the loop body
Ulti jnthn the difference is almost impossible to believe though like really fast for numeric things over a range 08:36
jnthn Ulti: Oh...for [+] 1..100000 ?
Ulti yeah
jnthn I think it calls .sum for that case :P
Ulti well whats .sum doing??
jnthn That math trick that lets you add up a contiguous range of integers in O(1) 08:37
Ulti aha
that still counts towards my comment to the reddit around zoffix post
jnthn github.com/rakudo/rakudo/blob/nom/...ge.pm#L653 08:38
hah, reddit...bet that's a hotbed of positivity :P
Ulti that Perl 6 where it does have optimisations does really well its just the optimisations haven't been going on for a decade so that they are smooth over the whole language and any possible code path
jnthn not really :'(
08:38 pmurias joined
Ulti its almost the definition of navel gazing around "why is Perl dead" despite the obvious reality of everyone there using it every day 08:39
jnthn But yeah, we do well in various places that have gotten optimization effort
Ulti out of curiosity does it have to be a literal?
Ulti will read the code 08:40
dont tell me :)
jnthn: this also explains why Rakudo does so well once into the bigint range too :) its not creating the bigints 08:41
or at least only two of them
08:42 TEttinger left 08:44 sdo left 08:46 _28_ria left 08:48 _28_ria joined 08:49 _28_ria left, _28_ria joined
grondilu is there an advantage as defining an array constant with the @ sigil? 'constant @a = ...' as opposed to 'constant a = ...'? 08:52
09:00 Actualeyes left 09:04 ely-se joined, llfourn joined 09:05 ely-se left
llfourn o/ #perl6 09:05
RabidGravy erp 09:06
09:07 torbjorn joined 09:20 kid51 joined 09:21 espadrine joined
gfldex m: constant @a = 1,2,3; say " @a "; 09:21
camelia rakudo-moar 61d231: OUTPUT« @a ␤»
llfourn m: my @a = 1,2,3; say " @a "; 09:22
camelia rakudo-moar 61d231: OUTPUT« @a ␤»
El_Che is "constant @a" even supported? 09:23
constant data containers are confusing
ok, it works :) 09:24
although I prefer constants without @ 09:25
(stop me before I say ALL CAPITALS :) )
llfourn stops El_Che
El_Che thx :) 09:26
grondilu just reported a bug. 09:27
Once again I've tried to do something in Perl 6 and was stopped by a bug. :(
El_Che are you sure it wasn't a feature? :) 09:28
llfourn m: constant @a = map { (1 +< $_) => 1 }, ^3; say @a.perl # +< ? 09:29
camelia rakudo-moar 61d231: OUTPUT«(1 => 1, 2 => 1, 4 => 1)␤»
grondilu FYI: #127858
synopsebot6 Link: rt.perl.org/rt3//Public/Bug/Displa...?id=127858
llfourn a bitshift? 09:30
grondilu just realized the => is not necessary 09:31
09:31 johndau left
grondilu m: constant @a = map { 1 +< $_ }, ^3; say @a.perl 09:31
camelia rakudo-moar 61d231: OUTPUT«(1, 2, 4)␤»
09:32 Xliff_ joined
llfourn I reported a similar bug a while ago #127034 09:33
synopsebot6 Link: rt.perl.org/rt3//Public/Bug/Displa...?id=127034
09:34 Xliff left 09:36 labster left 09:39 labster joined
grondilu hum apparently it's not specific to +<. {$_**2} would cause the same error. 09:42
or just {$_*2} 09:43
llfourn grondilu: try it with "no precompilation" I bet it will work 09:44
there a bunch of bugs related to precomp and constant/BEGIN blocks
grondilu what's that option? 09:45
09:45 wamba left
llfourn usually they are to do with closures 09:45
it's a pragma to turn precompilation off
RabidGravy jnthn, have you tested OO::Monitors recently? The tests emit "Weird node visited: QAST::BVal" several time
llfourn so put "no precompilation;" as the first line of the exporting module
jnthn RabidGravy: I'm aware of that, yeah...
grondilu llfourn: you're right. "no precompilation;" makes it work. 09:46
jnthn RabidGravy: Other than spewing the warning, it seemed to work OK though
RabidGravy yeah, seems fine
jnthn I tracked it down to the use of macros for the condvar feature
masak good noon, #perl6 09:47
dalek Iish: c725f70 | (Salvador Ortiz)++ | / (3 files):
mysql: Add Date and DateTime support
09:49
abraxxa sortiz++ 09:50
native Date/Datetime is one of the big features in Perl 6 imho
llfourn grondilu: #125634 is the main ticket for these bugs. They're pretty annoying :\. Your case is the first time I've seen it wrt to a constant = map { ... }. Maybe it's lazy and so is evaluating the closure later. 09:52
synopsebot6 Link: rt.perl.org/rt3//Public/Bug/Displa...?id=125634
sortiz abraxxa, btw, Have you seen the new Oracle OO code? 09:53
abraxxa sortiz: no, haven't had time to look at it
09:53 ocbtec joined
sortiz abraxxa, I appreciate your comments. 09:54
abraxxa specific github commits I should look at?
grondilu llfourn: it's lazy indeed. The error goes away if I write 'constant @a = eager map {...}' 09:56
llfourn grondilu: \o/ I'm glad I was some help!
grondilu well my exemple is just a golfed version of what I was trying to do. I do need an infinite array so making it eager won't help ;) 09:57
but I can use 'no precomp' until it's fixed. 09:58
sortiz abraxxa, Umm, no, for example see github.com/perl6/DBIish/blob/maste...le.pm6#L57
10:01 smls joined
smls Hi all 10:01
llfourn grondilu: ah yep that's tricky :\. I would love this bug to be fixed as well.
smls How does importing individual subs from a module work?
moritz not at all, at the moment :( 10:02
smls m: module Foo { sub a is export(:ALL) { say 42 } }; import Foo <&a>; a
camelia rakudo-moar 61d231: OUTPUT«5===SORRY!5=== Error while compiling /tmp/D2UEyD3QKc␤Error while importing from 'Foo':␤no EXPORT sub, but you provided positional argument in the 'use' statement␤at /tmp/D2UEyD3QKc:1␤------> 3port(:ALL) { say 42 } }; import Foo <&a>7⏏5; a␤»
smls moritz: OK, thanks
m: module Foo { sub a is export(:ALL) { say 42 } }; import Foo :ALL; a
camelia rakudo-moar 61d231: OUTPUT«WARNINGS for /tmp/IxxxVDopSH:␤Useless use of ":ALL" in sink context (line 1)␤42␤»
smls ^^ btw, strange "Useless use" there, TimToady
10:15 vendethiel- joined 10:16 vendethiel left 10:19 beatdown joined, sue joined, sue left, kid51 left 10:21 kid51 joined 10:27 labster left
moritz Useless use of "Useless use". 10:28
10:36 noganex_ joined 10:37 cdg joined 10:38 noganex left 10:43 dogbert1 left 10:47 cdg left 10:48 cdg joined
timotimo o/ 10:55
RabidGravy rarr! 10:56
timotimo hey mister gravy
i've decided against getting a PO. it's a shiny toy, but after i got it and played with it for an hour or two it's likely going to start collecting dust
RabidGravy I've got loads of those 10:58
10:59 noganex joined 11:01 noganex_ left 11:04 wamba joined
timotimo yeah, but you also make music, so it's kind of okay to have too many music toys 11:08
11:09 kaare_ joined 11:15 cdg left 11:16 perlawhirl joined
ZoffixWin .tell AlexDaniel I can't even find any docs for the XML::Document Gumbo returns. By comparison, Mojo::DOM has a polished interface. 11:20
yoleaux ZoffixWin: I'll pass your message to AlexDaniel.
ZoffixWin Ugh. Last time I tried to read Reddit comments. They're one homophobic joke away from uselessness and negativity of YouTube comments. 11:28
dalek Iish: 81e71c5 | (Salvador Ortiz)++ | t/27-mysql-datetime.t:
travis-ci: Skip a failing test.
11:30
Iish: 98c2400 | (Salvador Ortiz)++ | lib/DBDish/Pg/ (2 files):
Pg: Add type code for NULL
timotimo people on the 'ternets can really be kind of terrible :( 11:37
perlawhirl anonymity and an audience is a potent concoction 11:43
11:47 isBEKaml joined
dalek Iish: a8fafac | (Salvador Ortiz)++ | t/27-mysql-datetime.t:
travis-ci: Try 2...
11:47
perlawhirl m: <one one one two two three>.Bag.sort[0].key # <-- seems wordy... is there a nicer way to get the most common element 11:48
camelia ( no output )
perlawhirl m: say <one one one two two three>.Bag.sort[0].key
camelia rakudo-moar 61d231: OUTPUT«one␤»
timotimo m: <one one one two two three>.Bag.max(:by(*.value)).key
camelia rakudo-moar 61d231: OUTPUT«Index out of range. Is: 1, should be in 0..0␤ in block <unit> at /tmp/4XzW4c96la line 1␤␤Actually thrown at:␤ in block <unit> at /tmp/4XzW4c96la line 1␤␤»
timotimo whoops?
11:49 kid51 left
timotimo you can exponentiate all values by a big number and then use .pick to pick out one 11:49
no, actually, use the value as the exponent
:P
psch m: <one one one two two three>.Bag.max
camelia rakudo-moar 61d231: OUTPUT«Index out of range. Is: 1, should be in 0..0␤ in block <unit> at /tmp/mCwauHeLJe line 1␤␤Actually thrown at:␤ in block <unit> at /tmp/mCwauHeLJe line 1␤␤»
psch m: <1 2 3>.max 11:50
camelia ( no output )
psch m: (1,2,3).Bag.max
camelia rakudo-moar 61d231: OUTPUT«Index out of range. Is: 1, should be in 0..0␤ in block <unit> at /tmp/875N7TA6hu line 1␤␤Actually thrown at:␤ in block <unit> at /tmp/875N7TA6hu line 1␤␤»
perlawhirl timotimo: huh... it's been a long week and my brain is a little fried. i'm gonna need an example :D
timotimo i wonder what it's doing there
psch m: (1 => 1, 2 => 2).max
camelia ( no output )
timotimo perlawhirl: i wasn't being serious :D
perlawhirl haha, thank goodness
jnthn m: say <one one one two two three>.Bag.pairs.max(*.value)
camelia rakudo-moar 61d231: OUTPUT«one => 3␤»
psch m: max Bag.new 11:51
camelia ( no output )
perlawhirl hmm, maybe my original way wasn't so wordy after all =D
psch m: max Bag.new(1, 2)
camelia ( no output )
psch m: say max Bag.new(1, 2)
camelia rakudo-moar 61d231: OUTPUT«bag(1, 2)␤»
jnthn m: say <one one one two two three>.max({ (state %){$_}++ }) 11:52
camelia rakudo-moar 61d231: OUTPUT«one␤»
psch m: say Bag.^can('max')[0].signature.perl 11:53
camelia rakudo-moar 61d231: OUTPUT«:($: | is raw)␤»
perlawhirl jnthn: nice one... and i suspect more performant than creating a temporary Bag
jnthn Yeah :)
psch m: say <one one one two two three>.Bag.maxpairs 11:54
camelia rakudo-moar 61d231: OUTPUT«[one => 3]␤»
timotimo didn't know we have that built-in. nice.
perlawhirl psch: *ding ding ding* we have a winner
jnthn I didn't know about that either :P
perlawhirl lol 11:55
psch i was really just looking why max doesn't do anything sensible as method on Bag.. vOv
11:55 g4 joined
psch but then QuantHash has a method maxpairs... 11:55
timotimo yeah, it should probably not die like that
jnthn
.oO( jnthn00b :) )
perlawhirl psch: yeah my first stab was just <..>.Bag.max 11:56
psch m: say <1 1 1 2 2 3>.Bag.cache.elems
camelia rakudo-moar 61d231: OUTPUT«3␤»
psch m: say <1 1 1 2 2 3>.Bag.AT-POS(1) 11:57
camelia rakudo-moar 61d231: OUTPUT«Index out of range. Is: 1, should be in 0..0␤ in block <unit> at /tmp/bB373Qpebr line 1␤␤Actually thrown at:␤ in block <unit> at /tmp/bB373Qpebr line 1␤␤»
psch m: say <1 1 1 2 2 3>.Bag.AT-POS(0)
camelia rakudo-moar 61d231: OUTPUT«bag(1(3), 2(2), 3)␤»
psch .max only sorts Positional
timotimo but it doesn't restrict its invocant to that?
psch yeah
multi method max() {
timotimo a-ha!
hm. should it move to Positional, then? 11:58
psch and Bag confuses it because it says it has 3 elems
perlawhirl hah ,yeah... the Bag.cache is an interesting approach
i never looked at what .cache returns
jnthn On a Bag, I suspect same as .list
perlawhirl yep 11:59
psch: method most() :D 12:00
psch perlawhirl: is that the new huffmanization of .maxpairs..? :) 12:01
perlawhirl well it would also work on an array, so... kinda :) 12:02
psch m: say [0, 1, 2, 3, 4].maxpairs
camelia rakudo-moar 61d231: OUTPUT«Method 'maxpairs' not found for invocant of class 'Array'␤ in block <unit> at /tmp/t03dzMOSYc line 1␤␤»
psch :/ 12:03
12:04 mr-foobar joined
lizmat I guess if we moved out minpairs/maxpairs out of the QuantHash role, into Any-iterable, it would just work 12:05
lizmat will try that
El_Che ZoffixWin++: you've been pretty prolific about perl6 marketing lately. I can't open my twitter feed or my rss reader and you're there :) 12:09
ZoffixWin does work at a Marketing Department...
:)
El_Che you're Perl6 marketing department it seems :) 12:10
12:11 perlawhirl left
timotimo everyone can be the perl6 marketing department. but not everyone can be as good as The Zoffix 12:12
12:19 perlawhirl joined 12:28 sortiz left 12:31 perlawhirl left, perlawhirl joined 12:32 araujo left
perlawhirl is there an env var to control whether error messages are coloured or not? 12:33
timotimo yes
12:34 cpage_ left
timotimo RAKUDO_ERROR_COLOR 12:34
perlawhirl thanks timo
was just playing on glot.io and realised when it errors, the ansi escape sequences make things a little unreadable 12:39
12:45 Amnez777 left 12:48 Amnez777 joined 12:52 pmurias left 12:59 pmurias joined
gregf_ m: say Int.can("rand").^name 13:04
camelia rakudo-moar 0c7818: OUTPUT«List␤»
gregf_ should'nt this return a method? 13:05
psch m: say Int.can("rand")>>.WHAT.say
camelia rakudo-moar 0c7818: OUTPUT«(List)␤True␤»
psch grml
timotimo >>.WHAT may not work
gregf_ m: say Int.can("rand")[0]
camelia rakudo-moar 0c7818: OUTPUT«rand␤»
psch m: say Int.can("rand").map({$_.WHAT})>>.say
timotimo you always get a list, because there could be multiple candidates
camelia rakudo-moar 0c7818: OUTPUT«(Method)␤(Method)␤(True True)␤»
psch -extra say 13:06
gregf_ hmm
13:07 Sgeo left
gregf_ m: say Int.can("sprintf")[0].("%b", 4) 13:07
camelia rakudo-moar 0c7818: OUTPUT«100␤»
psch m: say Int.can("rand")>>.signature.say
camelia rakudo-moar 0c7818: OUTPUT«((Int $: *%_) (Cool $: *%_))␤True␤»
teatime where does the name Cool come from, btw? 13:08
psch C-something O-something Object Loop..?
S99:Cool
synopsebot6 Link: design.perl6.org/S99.html#Cool
perlpilot convienent OO Loopbacks.
psch perlpilot++
teatime ok. I'm glad it wasn't just because it was a cool feature. 13:09
:)
timotimo not just, but also :)
perlpilot or, since we're punny, see S02:1832
synopsebot6 Link: design.perl6.org/S02.html#line_1832
13:10 cdg joined
perlpilot "Convenient" (why is there no bot to correct my spelling? ;) 13:11
teatime perlpilot: some irc clients support spell checking.
mine highlights unknown words in bold red, currently :)
grondilu updated his Clifford module and made a simpler interface (no signature needed): github.com/grondilu/clifford 13:17
13:19 cpage_ joined 13:27 abraxxa left 13:28 isBEKaml left 13:35 sjoshi joined
b2gills m: constant @a = 1,2,3; say " @a[] "; 13:36
camelia rakudo-moar 40a953: OUTPUT« 1 2 3 ␤»
13:43 fireartist left 13:45 Begi joined 13:54 dvinciguerra__ left 13:59 dvinciguerra__ joined 14:00 dvinciguerra__ left 14:01 dvinciguerra__ joined, dvinciguerra__ left 14:02 dvinciguerra__ joined 14:06 khw joined
gregf_ hmm, [] is use for forcing interpolation? 14:07
s/use/used/
MadcapJake m: constant @a = 1,2,3; say " {@a} "; 14:08
camelia rakudo-moar 40a953: OUTPUT« 1 2 3 ␤»
gregf_ m: my %h = Hash.new;for [["foo",1],["bar",2]] ->$a, $b { %h{$a} = $b; }; say "%h{}"
camelia rakudo-moar 40a953: OUTPUT«foo 1 bar 2␤»
moritz gregf_: any expression that starts with a sigil and ends in a postcircumfix can interpolate 14:09
gregf_ moritz: postcircumfix as in {} <- 'curly braces' ? 14:10
*googles
ooh.. <> or << >>
oh no.. curly braces..
MadcapJake gregf_: anything that follows something and surrounds something is a postcircumfix 14:11
gregf_ oh...*too many new terms in Perl6*
MadcapJake [a] <- circumfix; a[b] <- postcircumfix 14:12
14:13 tadzik left, M-matthew left, M-Illandan left
psch m: my @a = 1,2,3; say "@a{}" # /o\ 14:14
camelia rakudo-moar 40a953: OUTPUT«1 2 3␤»
gregf_ nice.. moritz MadcapJake thanks
psch m: sub postcircumfix:<- ->($, $) { }; my @a = ^3; say "@a-2-" # hmm
camelia rakudo-moar 40a953: OUTPUT«5===SORRY!5=== Error while compiling /tmp/9zB9bmM2lR␤Unable to parse expression in double quotes; couldn't find final '"' ␤at /tmp/9zB9bmM2lR:1␤------> 3$, $) { }; my @a = ^3; say "@a-2-" # hmm7⏏5<EOL>␤ expecting any of:␤ doub…»
psch m: sub postcircumfix:<- ->($, $) { }; my @a = ^3; say "@a-2- " # hmm
camelia rakudo-moar 40a953: OUTPUT«5===SORRY!5=== Error while compiling /tmp/I7KlKtJPBj␤Unable to parse expression in double quotes; couldn't find final '"' ␤at /tmp/I7KlKtJPBj:1␤------> 3, $) { }; my @a = ^3; say "@a-2- " # hmm7⏏5<EOL>␤ expecting any of:␤ doub…»
MadcapJake psch: the dash has gotta be protected, it's an allowed char in terms 14:15
grondilu should I start a 'lib/Foo/Bar.pm6' module by 'unit module Bar;' or 'unit module Foo::Bar;'?
MadcapJake Foo::Bar
you have to include the folder chain in your module names
psch m: sub postcircumfix:<´ `>($, $) { }; my @a = ^3; say "@a´1`" 14:16
camelia rakudo-moar 40a953: OUTPUT«@a´1`␤»
14:16 tharkun left
psch m: sub postcircumfix:<´ `>($a, $b) { say "$a and $b" }; my @a = ^3; @a´1` 14:16
camelia rakudo-moar 40a953: OUTPUT«0 1 2 and 1␤»
MadcapJake m: sub postcircumfix:<´ `>($, $) { }; my @a = ^3 + 2; say "{@a´1`}"
camelia rakudo-moar 40a953: OUTPUT«Use of Nil in string context in block <unit> at /tmp/YTzwFvJZHk line 1␤␤»
psch right, postcircumfix weirdness only happens when it reuses existing somethings i guess
MadcapJake: i was just looking for some bugginess i saw with user defined postcircumfix, fwiw 14:17
grondilu MadcapJake: ok, both works though. Not sure if that's normal.
MadcapJake grondilu: not sure either, I thought it was the case that it needed codifying, perhaps it won't work when precomp'd
psch m: sub postcircumfix:<` ->($, $) { "borked" }; say 1`2-
camelia rakudo-moar 40a953: OUTPUT«5===SORRY!5=== Error while compiling /tmp/AOlIaENOQe␤Missing required term after infix␤at /tmp/AOlIaENOQe:1␤------> 3umfix:<` ->($, $) { "borked" }; say 1`2-7⏏5<EOL>␤ expecting any of:␤ prefix␤ term␤»
psch like that
MadcapJake ahh
14:18 tharkun joined
psch that case might be solvable with some parser state along the lines of $*IN_POSTCIRCUMFIX, but that probably doesn't generalize to user defined postcircumfix that *start* with a known op 14:18
MadcapJake is there any way to get a hidden method of a superclass? 14:26
moritz MadcapJake: what's a "hidden method"? 14:27
MadcapJake private
method !private() { ... }
moritz MadcapJake: only if the superclass trust its subclass
MadcapJake how can I gain it's trust? I've already brought it to the movies and bought dinner...
ufobat :D 14:28
timotimo "trusts MySubClass"
MadcapJake oh bummer :(
moritz m: class Subclass { ... }; class Parent { trusts Subclass; method !priv($x) { say $x } }; class Subclass is Parent { method foo() { self.Parent!priv(42) } }; Subclass.new.foo
camelia rakudo-moar 40a953: OUTPUT«5===SORRY!5=== Error while compiling /tmp/DLHMdCfFOp␤No such private method 'priv' for invocant of type 'Subclass'␤at /tmp/DLHMdCfFOp:1␤------> 3arent { method foo() { self.Parent!priv(7⏏0542) } }; Subclass.new.foo␤»
jnthn self!Parent::priv
moritz m: class Subclass { ... }; class Parent { trusts Subclass; method !priv($x) { say $x } }; class Subclass is Parent { method foo() { self!Parent::priv(42) } }; Subclass.new.foo
camelia rakudo-moar 40a953: OUTPUT«42␤»
moritz jnthn: takk
jnthn But yeah, if you want to share it between the two then private may not be the right scope for it 14:29
Alternatives including putting the private method into a role that both classes compose
gregf_ er, does that not break encapsulation?
jnthn gregf_: `trusts` *is* breaking encap, yes
MadcapJake I wanted to use a private method in CompUnit::Repository::FileSystem, so it's a no go all around :P 14:30
jnthn Uh, yeah... :)
timotimo time for a utility class!
jnthn One key thing about private methods is that you know you can refactor them and, provided you keep external behavior the same, it's all good.
MadcapJake truthfully, I probably wouldn't have been able to use it, just got curious if it was possible 14:31
jnthn That is, refactor them without looking beyond the curernt class body
smls Quick question: Is it safe for multiple threads to await() the same Promise simultaneously?
jnthn smls: Yes
smls thanks
gregf_ jnthn: thanks
jnthn Note we make you write `trusts` in the class that is having its encapsulation broken, so you only need to read that class to know you're screwed also :) 14:32
Don't suppose anyone here knows a good amount about file locking on Windows vs POSIX? 14:33
timotimo on linux, mandatory file locking doesn't exist
only advisory file locking does
that's all i know :\ 14:34
jnthn What does that actually mean? :)
timotimo if you lock a file, and another process doesn't look if there is a lock, it can trample you rlock
jnthn That if you don't opt in to the locking scheme you can read the file anyway?
Ah 14:35
And on windows...maybe it's mandatory
That could explain things
14:40 tadzik joined
RabidGravy are there any other ways at getting at a method object at compilation other than in a trait or over-riding the methods in the meta object? 14:41
moritz that's an API "design" that... didn't stood the test of time, if you asked me 14:42
(advisory locking)
RabidGravy: you can use .^can on the type object, at compile time
or even .^find_method
14:42 skink joined 14:44 skids joined
teatime "<branjb> anyone able to point me in the right direction, how many 8 letter combinations could i have from the letters A, B, C, if A and C cannot be next to each other? I got 56, but that seems low." 14:44
sadly this was not the answer #math was looking for: ([X] <a b c> xx 8)».join.grep(* !~~ /ac|ca/).elems
timotimo m: say ([X] <a b c> xx 8)».join.grep(* !~~ /ac|ca/) 14:45
camelia rakudo-moar 40a953: OUTPUT«(aaaaaaaa aaaaaaab aaaaaaba aaaaaabb aaaaaabc aaaaabaa aaaaabab aaaaabba aaaaabbb aaaaabbc aaaaabcb aaaaabcc aaaabaaa aaaabaab aaaababa aaaababb aaaababc aaaabbaa aaaabbab aaaabbba aaaabbbb aaaabbbc aaaabbcb aaaabbcc aaaabcba aaaabcbb aaaabcbc aaaabccb aaa…»
moritz m: say ([X] <a b c> xx 8)».join.grep(* !~~ /ac|ca/).elems
camelia rakudo-moar 40a953: OUTPUT«1393␤»
psch m: say ([X] <a b c> xx 8)».join.squish.grep(* !~~ /ac|ca/) 14:46
camelia rakudo-moar 40a953: OUTPUT«(aaaaaaaa aaaaaaab aaaaaaba aaaaaabb aaaaaabc aaaaabaa aaaaabab aaaaabba aaaaabbb aaaaabbc aaaaabcb aaaaabcc aaaabaaa aaaabaab aaaababa aaaababb aaaababc aaaabbaa aaaabbab aaaabbba aaaabbbb aaaabbbc aaaabbcb aaaabbcc aaaabcba aaaabcbb aaaabcbc aaaabccb aaa…»
psch m: say ([X] <a b c> xx 8)».join.squish.grep(* !~~ /ac|ca/).elems
14:46 g4 left
camelia rakudo-moar 40a953: OUTPUT«1393␤» 14:46
teatime what does squish get you?
psch it demonstrates my lack of paying attention, i suppose :/
moritz nothing, the combinations are already unique
timotimo unless there is a bug :)
teatime it was useful, in so far as it gives him something to check his ultimate result with 14:47
but it was not useful as a way of figuring out the math or math notation for calculating the same
RabidGravy moritz, the background to that question was that I think there is a precomp bug regarding wrap(), such that if the result of said wrapping gets precomped then it doesn't work 14:48
perlpilot teatime: then branjb should have asked a better question ;) 14:50
RabidGravy doesn't work in that WrapDispatcher.enter when it does candidates[0] on the precomped wrapped method doesn't get a callaible object
14:55 zakharyas left 14:57 zakharyas joined
smls jnthn: Given an expensive pure function, is this a sensible way to make it both self-caching and support concurrent calls? gist.github.com/smls/bff79cd0b940f...9126c7ea0b 14:57
moritz smls: looks sensible to me 14:59
grondilu TIL: I can put '*~' in a .gitignore file to mask all Vim's backups.
jnthn smls: Depeds if you want to defer evaluation until first request
moritz grondilu: and *.swp and *.swo :-) 15:00
for the swap files as well
smls jnthn: That's what I'm doing here, isn't it?
or did I make a mistake
teatime grondilu: or just config vim to keep it's backup and swp files somewhere sane
grondilu teatime: that looks overkill
teatime which? 15:01
jnthn smls: Ah, so it is
smls At first I tried to do it without a Promise, using a Hash of locks. But I couldn't wrap my head around how to avoid all possible race conditions.
teatime grondilu: here's the relevant part of my vimrc, for inspiration paste.debian.net/plain/427372 15:02
grondilu I don't want to hide the swap files, but I'm OK to keep my backups in the same directories.
teatime I'm not a fan of editors leaving droppings in random places.
grondilu it's not exactly random since it's where the original file is.
15:02 mcsnolte joined
teatime ok then, I'm not a fan of editors leaving random droppings in places :) 15:03
moritz there's also a trick of adding a second trailing slash to the backup dir, but I forgot what exactly that does
teatime moritz: heh, hence "(trailing slash is NOT a typo)" 15:04
it's documented in the vim help
smls jnthn: Using state $lock = Lock.new; wouldn't be safe because initializing a state var isn't thread-safe in itself, right?
jnthn smls: Correct 15:08
smls ok
jnthn smls: I think when we do `is cached` properly we'll want to make it threadsafe... 15:09
smls Sounds good :)
15:09 Actualeyes joined
gregf_ static variables can mess up threads as the memory is shared 15:12
gist.github.com/anonymous/64a2cc1e...4c5b201f4c <== i just tried this *ignore that its ruby* 15:15
15:16 ggoebel17 joined
smls jnthn: Is there any of documentation/overview on what built-in operations are or are not threadsafe? 15:16
15:17 ggoebel16 left
smls In particular, < reading writing > X < $scalar @array %hash object.attribute > ? 15:17
Pretty sure that writing to any of those things is NOT safe, but which are safe to read from? 15:18
15:18 ptolemarch joined
jnthn smls: Not aware that's well covered...it really should be though. 15:19
smls: In general, scalars (if they're just a boring Perl 6 Scalar, not a Proxy or something) or safe to write. Same goes for Scalar attributes.
15:20 Khisanth left, tadzik left
jnthn smls: Concurrent writes, and reading while writing to, an array or hash isn't safe 15:20
Unless it's a fixed size native array :)
smls What about concurrent reading of array/hash elements? 15:23
jnthn Fine with a hash
With an array - yes provided you're not reading an unevaluated lazy part 15:24
smls makes sense
m: my $x; for ^1000 { start { sleep 0.1; $x = $_ } }; say $x 15:26
camelia rakudo-moar 40a953: OUTPUT«Memory allocation failed; could not allocate 14520 bytes␤»
smls Hm, works locally
15:26 zakharyas left
skink Is there a faster way to derive Ints from Buf[uint8] or an array than .unpack()? 15:28
jnthn smls: I think memory limit or thread limit maybe 15:29
15:30 wamba left
smls jnthn: But that kind of concurrent assignments to a scalar is what you meant with "safe to write", right? 15:31
(i.e. guaranteed not to crash)
RabidGravy jnthn, want a failing test (which is an example of a bug that I'm about to RT) for OO::Monitors?
15:35 Khisanth joined
jnthn smls: You won't get a crash out of that 15:36
RabidGravy: Yes...could you even PR the failing test?
RabidGravy: Or is it a fail in Rakudo rather than OO::Monitors?
RabidGravy it's a fail caused by a precomp bug 15:37
jnthn smls: At a C level, assigning to a Scalar is basically writing a pointer
15:37 domidumont left
smls ok 15:37
jnthn RabidGravy: ah, ok. Then test very welcome.
RabidGravy I'm going to RT a smaller example done in two ways, but bottom line is that the way that OO::Monitors wraps the methods doesn't work in a precomped module 15:38
it seems that the WrapDispatcher "loses" the candidates when precompiled 15:40
15:41 ptolemarch left, nakiro left, ptolemarch joined
smls jnthn: Isn't @x[4] a simple Scalar as well though (provided that no auto-viv or laziness is happening)? 15:42
So shouldn't that be safe to assign to as well?
jnthn smls: Indeed 15:43
smls ok
15:43 wamba joined
jnthn smls: It's the array's body itself that isn't 15:43
smls ?
jnthn An array is a blob of blob that points to Scalar containers 15:44
*blob of memroy
15:44 M-tadzik joined
timotimo memroooooooy ... blobkins!!!k 15:44
Characters simplified : 100.34% 15:46
.... oooooh..kay?
smls But assigning to an already existing element shouldn't modify the array container's state/metadata at all, should it?
ZoffixWin Was this grant approved? Jonathan Worthington / Perl 6 performance. news.perlfoundation.org/2016/02/gra...forma.html 15:47
15:47 sjoshi left
smls m: my @x = 1, 2, 3; for ^10 { start { sleep 0.1; @x[1] = $_ } }; say @x 15:49
camelia rakudo-moar 40a953: OUTPUT«[1 2 3]␤»
15:49 kerframil joined
gregf_ hmm, i just ran this: y $lock = Lock.new; class Foo { has Hash $.h is rw; method reduce(Str $val){ $!h{$val}-=1; $!h{$val}; } }; my $f = Foo.new(h => {foo => 10000, bar => 10, baz => 60}); my @data; await do (^1000).map({ start { push @data, $f.reduce("foo") } }); say @data.min # was expecting 900 15:49
s/^y/my/
pmurias ZoffixWin: yes, it's under way 15:50
ZoffixWin Awesome.
gregf_ s/900/9000/
the mutex should help tho'
15:52 pierrot left 15:55 M-matthew joined, M-Illandan joined
jnthn ZoffixWin: Yeah, my weekly blog posts are my progress reports on that :) 15:55
ZoffixWin Cool.
I should read more stuff :)
timotimo jnthn's blog comes highly recommended, IMO 15:56
mst I highly recommend the bits I actually understand
El_Che mst: lol
the rest of us is to ashamed to say it out loud :)
smls gregf_: You don't use the $lock at all
gregf_: You do $!h{$val} -= 1; simultaneously from multiple threads 15:57
gregf_ smls: yeah, that should return the proper count when used.
smls I don't think it should 15:58
gregf_ well, then why lock a resource ;)
smls you *don't* lock anything 15:59
you just initialize a lock, but never call .protect
gregf_ smls: granted, in the code above.. you can stick in a $lock.protect { # access_chared_resources} *cries*
timotimo why isn't that enough?
16:00 domidumont joined
gregf_ smls: my point was to prove that hashes are no thread safe. as jnthn pointed out 16:00
s/no/not/
smls ah
gregf_ ;)
teatime charred resources? is that what you get when you access resources in an unsafe way? :)
gregf_ would very well be :| 16:01
s/^w/c/
timotimo :D
smls gregf_: But I think the -= operator is already not atomic, so even with a scalar instead of a hash there, it would not work 16:02
m: my $x; for ^10 { start { $x += 1 } }; say $x
camelia rakudo-moar 40a953: OUTPUT«10␤»
smls ^^ I get varying results from 8 to 10 for that 16:03
skink Probably a stupid question: if I'm supplying random numbers, should they be Big Endian or Little?
[Coke] skink: huh? 16:04
skink I'm taking a Buf[uint8] and deriving an Int from it
[Coke] ah, I missed some backscroll, I guess.
skink I was .unpack("L") vs ("N") 16:05
considering*
Well, rather, I was using "L" and then just found a way of doing it that's an order of magnitude faster but it's big endian 16:06
skids If the random number is over the entire binary field and equally distributed, and nothing sees the original buffer, it should not matter. 16:08
skink skids, That last optimization you pasted last night brought me from ~115 UUID/s to ~725 16:09
16:09 sue joined
skids glad to help. I'm sure there must be more to gain. 16:09
RabidGravy if you have four bytes and want to turn then into an Int it's just "my $int = ($buf[0] +< 0x18 ) + ($buf[1] +< 0x10) + ($buf[2] +< 0x08) + $buf[3] 16:10
skink Now I'm optimizing the Int generation and allowing for arbitrary-sized results rather than just 32bit ones.
RabidGravy, That's basically what I'm doing now. 16:11
RabidGravy cool
skink my Int $count = 0;
($count +<= 8) += $_ for crypt_random_buf($length).values;
16:17 perlawhirl left 16:19 smls left 16:20 smls joined
skink > crypt_random(32); 16:20
62674369658089747390211638139662299859186874929303896384935970869933657346211
Yup... I think that'll do.
RabidGravy :) 16:23
16:26 captain-adequate joined
skink On my machine .unpack() gave ~900 numbers/s, this method ~3300 16:26
timotimo jnthn: does anything speak against having an op that feeds a buffer directly into an Int? 16:30
16:33 sue left 16:37 buharin joined 16:40 skink left 16:51 Khisanth left 17:05 Khisanth joined 17:13 boegel left, Xliff__ joined, noganex_ joined
grondilu I've invented a word today: 17:13
ZoffixWin it's very short :)
grondilu ourify (v.): to change a "my" variable into a "our" one.
17:13 kerframil left, kerframil joined
grondilu ^I used it in a commit message :P 17:14
17:15 noganex left, Xliff_ left
grondilu we can do 'my %{Foo};' but why not 'my MixHash ${Foo};'? 17:18
I mean adding a constraint for the type of the keys of a MixHash? 17:19
hoelzro grondilu: wouldn't that look like `my MixHash[Foo] $hash` or something?
grondilu m: my MixHash[Str] $; 17:20
camelia rakudo-moar 40a953: OUTPUT«5===SORRY!5=== Error while compiling /tmp/U8zxQGa1Zy␤An exception occurred while parameterizing MixHash␤at /tmp/U8zxQGa1Zy:1␤Exception details:␤ 5===SORRY!5=== Error while compiling /tmp/U8zxQGa1Zy␤ MixHash cannot be parameterized␤ a…»
grondilu "MixHash cannot be parameterized
"
MixHash is a cool concept: a collection of stuff with auto-removal of nul quantities. I have been trying to do that for my CLifford module. I wish I could use a builtin structure. 17:22
17:22 buharin left
grondilu It's also very close to the concept of linear combinations, which is obviously very useful. 17:23
TimToady to mix in the TypedHash role is probably going to require using real object hashes for Sets etc
17:27 Xliff__ left 17:28 Possum left 17:30 molaf joined
TimToady smls: fixed your useless use 17:30
17:34 espadrine left 17:43 wamba left 17:55 buharin joined
ZoffixWin m: Date.new('2016-04-03').year.say 17:55
camelia rakudo-moar 40a953: OUTPUT«2016␤»
ZoffixWin :S
Camelia is messing with me. I just got "(no output)" for that one several times via /msg :S 17:56
m: Date.new('2016-04-03').year.say
camelia ( no output )
17:56 jdukart joined
ZoffixWin Weird, no? 17:56
TimToady some kind of race with exit() maybe? 17:57
17:57 kurahaupo joined, ackiejoe joined
TimToady I think people have been playing around a bit with output locking lately 17:57
m: Date.new('2016-04-03').year.say; sleep 1 17:58
camelia rakudo-moar 40a953: OUTPUT«2016␤»
TimToady m: Date.new('2016-04-03').year.say; sleep 1
camelia rakudo-moar 40a953: OUTPUT«2016␤»
TimToady m: Date.new('2016-04-03').year.say; sleep 1
camelia rakudo-moar 40a953: OUTPUT«2016␤»
TimToady m: Date.new('2016-04-03').year.say; sleep 1
camelia rakudo-moar 40a953: OUTPUT«2016␤»
TimToady seems a likely explanation
teatime TimToady: stop spamming you might be banned.
;)
ZoffixWin Seems to be. Glad it's not a rakudo bug :) 17:59
TimToady it would be a great relief if I were :P
17:59 jdukart left
perlpilot TimToady: you lack the will power to ignore IRC? 17:59
18:00 ackiejoe left
TimToady I lack the willpower to ignore ignorance. :) 18:00
teatime thankfully.
perlpilot TimToady: btw, have you not been around here much lately? It seems like you're not as active as a couple of months ago, but maybe that's just me. 18:01
TimToady well, we were pushing Christmas pretty hard there for a while... 18:02
that's not sustainable...
perlpilot aye. I was thinking maybe you were feeling under the weather or something. 18:03
18:03 cdg left
TimToady some of that, some of just getting back to doing some things I'd been neglecting to do for 15 years... 18:03
like cleaning out my garage
found some things in there that were left by the previous owner in '91 18:04
ZoffixWin :o
teatime anything cool?
18:05 Possum joined
TimToady a speedometer off a Harvester International tractor 18:05
well, I don't actually know it was off a tractor...
RabidGravy excellent
perlpilot
.oO( little does TimToady realize that that's *his* speedometer and he's just forgotten )
;)
TimToady but it does have their logo on it 18:06
18:06 cpage_ left
grondilu m: class Foo { our sub f { rand }; method f { state $ = f } }; say Foo.f; # wondering if it's a OK to use the same name for a function and a method 18:06
camelia rakudo-moar 40a953: OUTPUT«0.892424967326445␤»
TimToady and this week is taxes, of course...
grondilu: the namespaces are entirely disjoint, by design 18:08
RabidGravy I've spent five days gardening, totally ruined now
TimToady perlpilot: also been working some on a "new camel"
grondilu TimToady: I thought so. I think I will use the same name. It makes some sense.
teatime TimToady: book you mean?
TimToady: I would enjoy that ever so much. 18:09
perlpilot TimToady: ah, how's that coming along?
TimToady well, I have the intros written for various chapters
but I'm not really in book-writing mode yet, or you probably wouldn't see me at all... 18:10
18:10 astj joined
perlpilot TimToady: if you need any reviewers or other feedback, let me know. I'll read anything. :-) 18:10
18:11 labster joined
perlpilot (though, I did have trouble getting through the Silmarillion, so if reads like that ... I'll let you know you need to start over ;) 18:11
TimToady also spending some time thinking about various speeches I'll have to give this year
18:13 FROGGS joined
TimToady
.oO("...after my friends corrected 'little hope' to 'no hope'..." -J.R.R. Tolkien)
18:13
perlpilot: and to be perfectly honest, I suffer a bit from SAD as well, so I'm glad to see the sunshine coming back 18:15
18:15 pierrot joined 18:18 astj left
[Coke] TimToady: welcome back-ish. 18:19
(SAD) hopefully winter is now gone for good this year in NY. :P
perlpilot I thought I saw wintery weather headed that way on the weather channel earlier today 18:20
18:20 ufobat left
[Coke] perlpilot: :P 18:23
RabidGravy yeah, it has felt like winter in London today 18:24
18:25 ufobat joined
RabidGravy it was quite pleasant last weekend 18:25
perlpilot my wife was worried about "all the cold weather" when we moved to north Texas. Her views on "cold" are a little skewed from spending most of her life in south Texas
18:26 labster left 18:28 ocbtec left, vendethiel joined
TimToady [6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~[6~ 18:29
[Coke] perlpilot: I interviewed for a job in houston in february. They apologized profusely for the cold.
perlpilot heh
TimToady oops
18:30 vendethiel- left
mst TimToady: I didn't know you had cats 18:30
18:30 M-tadzik is now known as tadzik
TimToady I had cats :'( 18:30
mst ah. 18:31
[Coke] :(
TimToady not really fair to have cats right now with all the travelling we do 18:32
so we've not restocked...
mst if I get another one, I will be significantly dependent on having lots of friends who're cat people locally 18:34
TimToady speaking of restocking, lunch (and taxes) & 18:35
18:35 cpage_ joined
perlpilot TimToady: have as much fun as possible :) 18:35
teatime Two things in life are inevitable: lunch and taxes.
wait, that's not quite it.. 18:36
18:40 pecastro left, mcsnolte left 18:41 Khisanth left, cpage_ left
ZoffixWin m: sub foo ($x, *%params) {say %params}; my $x = 42; foo 42, $x ?? x => $x !! Empty; 18:43
camelia rakudo-moar 40a953: OUTPUT«Too many positionals passed; expected 1 argument but got 2␤ in sub foo at /tmp/CqhQ9kVcr7 line 1␤ in block <unit> at /tmp/CqhQ9kVcr7 line 1␤␤»
ZoffixWin What's the trick to pass a key/value to %params, but only if the value is True? 18:44
18:44 cpage_ joined
jnthn |(:$x if $x) maybe 18:45
May have to be |%(:$x if $x)
ZoffixWin m: sub foo ($x, *%params) {say %params}; my $x = 42; foo 42, |(:$x if $x)
camelia rakudo-moar 40a953: OUTPUT«{x => 42}␤»
ZoffixWin Thanks, jnthn++
jnthn ah, it's a Pair so works out :)
smls $x 18:46
$x? syntax on caller side would be cute ;)
jnthn :P
ufobat is coding with black tea and pizza. who wanna join in! :D 18:47
teatime I'm down for *at least* half of that.
jnthn just filled himself up with orange lamb :) 18:48
ufobat yummy!
[Coke] may have issues with his job, but they do provide him with lots of toys to work on. 18:51
18:53 _nadim joined
ufobat is it true that a Routine compared to a Block, must have a signature and it is not possible to create a Routine without a signature?? 18:56
18:56 Khisanth joined, xchg_ joined, nadim left
ufobat so either both "return handling" & signatures or just a Block 18:56
18:57 xchg left 18:59 Actualeyes left, dvinciguerra__ left
ZoffixWin m: say ({;}).signature 18:59
camelia rakudo-moar 40a953: OUTPUT«(;; $_? is raw)␤»
19:01 nd3i joined
ufobat i a to new to understand this as an answer :( 19:01
jnthn ufobat: Block and Routine, if you don't specify a signature, get different default signatures 19:02
sub foo { } is identical to sub foo() { }
RabidGravy it's Callable -> Code -> Block -> Routine -> (Method, Sub) in increasing specificity
19:03 Khisanth left
ufobat okay got it so far 19:03
ZoffixWin Sorry, that wasn't an answer from me, I just wanted to see what .signature would give from a block.
RabidGravy and Code has signature
jnthn And yeah, return is scoped to a Routine
19:03 labster joined, labster left, labster joined
ufobat so a Block does not have a own @_, and return does not leave a block but the outer routine 19:04
the (only) way to put something inside into a block would be dynamic scoped variables like $*foo
jnthn No, Block can have a signature 19:05
m: my $a = -> $x { say 2 * $x }; $a(21)
camelia rakudo-moar 40a953: OUTPUT«42␤»
jnthn m: my $a = -> $x { say 2 * $x }; say $a.WHAT
camelia rakudo-moar 40a953: OUTPUT«(Block)␤»
19:08 dvinciguerra__ joined
ufobat soo is the pointy block basically a block with a signature? right? 19:08
jnthn Yeah 19:09
ufobat yay awesome :-)
thanks for your help guys!
19:11 AlexDaniel joined
ufobat another question 19:15
is there something like curry in perl6?
19:15 hankache joined
hankache hola #perl6 19:16
ufobat heya :) 19:17
moritz ufobat: there is .assuming on code objects
ufobat: and the Whatever term can also do some form of currying
m: say &infix:<+>.assuming(40)(2)
camelia rakudo-moar 40a953: OUTPUT«42␤»
moritz m: say (* + 40)(2) 19:18
camelia rakudo-moar 40a953: OUTPUT«42␤»
ufobat m: class Foo { method bla ($there) {say "hey $there"}}; my $f = Foo.new; my $callback = $f.bla.assuming.("you"); $callback() 19:23
camelia rakudo-moar 40a953: OUTPUT«Too few positionals passed; expected 2 arguments but got 1␤ in method bla at /tmp/phbt1kY7BF line 1␤ in block <unit> at /tmp/phbt1kY7BF line 1␤␤»
19:23 smls left
ufobat how to get this right? 19:25
hoelzro I'm wondering which would take more work/be smarter - converting linenoise.c to support multi-byte, or just writing a pure perl6 line editor with the help of NativeCall 19:26
19:26 buharin left, sue joined
hoelzro the latter does have some advantages, for sure 19:26
19:28 hankache left
moritz m: class Foo { method bla ($there) {say "hey $there"}}; my $f = Foo.new; my $callback = { $f.^can('you').assume($f, 'hey there') }; $callback() 19:28
camelia rakudo-moar 40a953: OUTPUT«Method 'assume' not found for invocant of class 'List'␤ in block <unit> at /tmp/MSRr7dt2Z5 line 1␤␤»
moritz m: class Foo { method bla ($there) {say "hey $there"}}; my $f = Foo.new; my $callback = { $f.^find_method('bla').assume($f, 'hey there') }; $callback()
camelia rakudo-moar 40a953: OUTPUT«Method 'assume' not found for invocant of class 'Method'␤ in block <unit> at /tmp/qSewYLA2NW line 1␤␤»
moritz m: class Foo { method bla ($there) {say "hey $there"}}; my $f = Foo.new; my $callback = { $f.^find_method('bla').assuming($f, 'hey there') }; $callback()
camelia ( no output )
moritz m: class Foo { method bla ($there) {say "hey $there"}}; my $f = Foo.new; my $callback = $f.^find_method('bla').assuming($f, 'hey there'); $callback() 19:29
camelia rakudo-moar 40a953: OUTPUT«hey hey there␤»
19:29 sortiz joined
moritz m: class Foo { method bla ($there) {say "hey $there"}}; my $f = Foo.new; my $callback = {$f.bla('hey there')}; $callback() 19:30
camelia rakudo-moar 40a953: OUTPUT«hey hey there␤»
moritz the difficulty here is getting the method object without invok^Hi^Hking it 19:31
ufobat lol, the easy way seems to be right, as always ;)
cool cool :-) 19:32
i <3 perl6
thanks moritz
moritz ufobat: you're welcome
19:34 hankache joined 19:36 Khisanth joined 19:42 Khisanth left
ZoffixWin m: sub foo ($x) { say $x.WHAT }; foo Empty 19:46
camelia rakudo-moar 40a953: OUTPUT«(Slip)␤»
ZoffixWin m: say so |() === Empty 19:47
camelia rakudo-moar 40a953: OUTPUT«False␤»
ZoffixWin m: say so |() == Empty
camelia rakudo-moar 40a953: OUTPUT«True␤»
moritz m: say so |() eqv Empty
camelia rakudo-moar 40a953: OUTPUT«True␤»
moritz ZoffixWin: Empty is just a conveniently named Slip instance
[Coke] m: Empty ~~ Slip
camelia ( no output )
ZoffixWin I see. I was kinda expecting foo Empty to be equivalent to foo() 19:48
[Coke] m: say Empty ~~ Slip
camelia rakudo-moar 40a953: OUTPUT«True␤»
ufobat moritz, what about that: class Foo { method bla ($x, $y) {say "hey $x and $y"}}; my $f = Foo.new; my $callback = { $f.bla("you", |@_)} ; $callback("now leave!") 19:51
doesn't that look more like the curry from perl5 :) 19:52
dalek osystem: accc259 | (Zoffix Znet)++ | META.list:
Add NASA

Implementation of NASA's APIs: github.com/zoffixznet/perl6-NASA
19:53
19:55 Khisanth joined, cpage_ left
ufobat yeah the nasa api :D 19:55
19:58 cpage_ joined 19:59 jercos left, sue left 20:00 jercos joined
ZoffixWin Would be really cool if NASA started using Perl 6 :P 20:01
20:01 cdg joined
ZoffixWin TIL: specifying "key" in .gitignore also blacklists "foo/key" :/ 20:04
20:12 Begi left, Begi joined 20:14 DrForr joined 20:15 hankache left
AlexDaniel . 20:18
yoleaux 11:20Z <ZoffixWin> AlexDaniel: I can't even find any docs for the XML::Document Gumbo returns. By comparison, Mojo::DOM has a polished interface.
ZoffixWin And on that point, IIRC my OS doesn't even have gumbo in repos 20:19
20:19 Begi1 joined
AlexDaniel ZoffixWin: it is right here: github.com/supernovus/exemel 20:19
ZoffixWin: and what's your OS?
20:19 Begi left, Begi1 is now known as Begi
Hotkeys Is nasa using p6? 20:19
or is that just a hope of zoffix
ZoffixWin Ah, I was searching for XML::Document (which I'm guessing is part of XML distro :()
AlexDaniel, Bodhi Linux, which is a fork of Ubuntu. aptitude search gumbo gives me nothing, and if my memory is correct, the story is the same on debian 20:20
20:20 darutoko left
ZoffixWin Hotkeys, just a hope. But they do invite submissions for cool things made with their APIs, so... the door is open :) 20:21
AlexDaniel p
ZoffixWin: the package is called libgumbo1
ZoffixWin: it is only in debian testing, so indeed, not cool enough
ZoffixWin There's also an obvious bias that I'm quite familiar with Mojo::DOM, so going to XML::Document is being faced with a wall of new stuff to learn :) 20:23
mst 20:24
20:26 Khisanth left 20:30 TEttinger joined 20:31 domidumont left
[Coke] O_o; 20:34
20:36 skink joined
skink sortiz, skids was able to speed up the UUID Str generation 6x 20:37
20:38 cdg left 20:41 Khisanth joined 20:42 nd3i left, kerframil left 20:44 ptolemarch left
sortiz skink, \o/ Thanks! 20:45
20:46 woodruffw joined
sortiz I'll check the backlog. 20:46
skink ctrl+f "thunk" 20:47
20:48 kerframil joined, kerframil left 20:49 Khisanth left 20:50 sufrostico left
sortiz found, thanks. 20:52
20:52 sufrostico joined
grondilu off topic: SpaceX did land on a drone ship. 20:53
like five minutes ago
skink m: (:256[(0..255).roll(16)].fmt("%32.32x") ~~ /(........)(....)(....)(....)(............)/).join("-") for 1..1000; say now - INIT now; 20:54
camelia rakudo-moar 40a953: OUTPUT«0.68679003␤»
skink @ sortiz
sortiz skink, Yep, thanks again. 20:55
skink That doesn't include version/variant though, mind you.
ZoffixWin grondilu, awesome 20:56
skink Out of curiosity
m: (:256[(0..255).roll(16)].fmt("%32.32x") ~~ /(........)(....)(....)(....)(............)/).join("-") for (1..1000).race; say now - INIT now; 20:57
camelia rakudo-moar 40a953: OUTPUT«0.4899288␤»
20:57 ChristopherBotto joined
skink On my machine for 10,000, it's 17s vs 10.7s 20:57
ChristopherBotto Hello Perl6!
perlpilot ChristopherBotto: greetings
TimToady that...was beautiful...
(SpaceX landing) 20:58
lizmat didn't get the live feed going 20:59
perlpilot ... too beautiful ;)
20:59 espadrine joined
dalek c: 7881a68 | (John Gabriele)++ | doc/Language/containers.pod:
fix typo
20:59
ChristopherBotto Is the END phaser supposed to run even after a Kill signal? 21:00
21:00 skids left
lizmat ChristopherBotto: if the kill is not an -9, I guess so :-) 21:00
ChristopherBotto: are you saying it didn't and it should? or vice-versa ? 21:01
ChristopherBotto It didn't, but I thought it should.
perlpilot I would think it should too. 21:02
21:03 Khisanth joined, sufrostico left
skink sortiz, Are you just gonna include that as a function, or should I make a PR to P6-UUID? 21:03
ChristopherBotto lizmat: perlpilot: I'll double check ....... 21:04
21:05 FROGGS left
perlpilot ChristopherBotto: Though, I note that P5 doesn't seem to run END blocks after a SIGINT or SIGTERM 21:05
sortiz skink, Is a good idea to include it in P6-UUID, try a PR. 21:07
21:08 sufrostico joined
lizmat indeed, the END block does not appear to be run 21:14
ChristopherBotto: this is a workaround:
signal(SIGTERM).act: { exit 1 }; Nil while 1; END say "this is the end, my friend"
m: signal(SIGTERM).act: { exit 1 }; Nil while 1; END say "this is the end, my friend" 21:15
perlpilot would be surpised if that worked in camelia
jnthn I'd expect you'd need to install a handler that calls exit
camelia rakudo-moar 40a953: OUTPUT«(timeout)this is the end, my friend␤»
diakopter ohhh
jnthn Oh, exactly as lizmat showed :)
perlpilot lizmat++
jnthn <-- nearly too tired to read :) 21:16
lizmat jnthn: would you consider that a work around or not ?
jnthn lizmat: I don't mind it being that way, I think 21:17
lizmat neither :-) 21:18
jnthn Installing that handler by default at present would also be rather costly, though that reason won't be with us forever I hope :)
perlpilot ChristopherBotto: what did you want to rely on running in the END phaser anyway? 21:19
ChristopherBotto lizmat++
perlpilot: I want to clean up external resources. I'm actually starting a interactive job on the node of one of our clusters and I want the job reservation to be terminated if the interactive session is terminated. 21:20
diakopter m: use MONKEY-SEE-NO-EVAL; EVAL 1 while 1 # should timeout instead of memeat 21:21
camelia rakudo-moar 40a953: OUTPUT«(timeout)»
diakopter \o/ 21:22
jnthn star: use MONKEY-SEE-NO-EVAL; EVAL 1 while 1
camelia star-m 2016.01: OUTPUT«Memory allocation failed; could not allocate 378368 bytes␤»
jnthn Progress :)
Hadn't occured to me you could demonstrate that fix with camelia... :) 21:23
21:30 Begi left 21:32 Khisanth left 21:34 Xliff joined
grondilu m: my MixHash $a .= new; my MixHash $b = $a.clone; $a<foo>++; dd $b; 21:35
camelia rakudo-moar 40a953: OUTPUT«MixHash $b = ("foo"=>1).MixHash␤»
grondilu ^quite unexpected
m: my MixHash $a .= new; my MixHash $b = $a.pais; $a<foo>++; dd $b; 21:37
camelia rakudo-moar 40a953: OUTPUT«Method 'pais' not found for invocant of class 'MixHash'␤ in block <unit> at /tmp/ei8J_BUgZI line 1␤␤»
grondilu m: my MixHash $a .= new; my MixHash $b = $a.pairs; $a<foo>++; dd $b;
camelia rakudo-moar 40a953: OUTPUT«Type check failed in assignment to $b; expected MixHash but got Seq (().Seq)␤ in block <unit> at /tmp/cHHWRfmwkU line 1␤␤»
skink sortiz, github.com/retupmoca/P6-UUID/pull/1 21:39
grondilu m: my MixHash $a .= new; my MixHash $b = $a.pairs.MixHash; $a<foo>++; dd $b; 21:40
camelia rakudo-moar 40a953: OUTPUT«MixHash $b = ().MixHash␤»
lizmat grondilu: feels to me it needs an RT ticket 21:41
21:41 sufrostico left
grondilu lizmat: I'll make one 21:42
ChristopherBotto lizmat: Thanks so much. I've got it implemented now. 21:43
lizmat: I do get a funny error message though: Unhandled exception in code scheduled on thread 3 Cannot call postcircumfix:<[ ]>(Any, Int); none of these signatures match: (\SELF, Any:U $type, |c is raw) (\SELF, int $pos) .....
sortiz skink++ # Work done on UUID 21:44
lizmat ChristopherBotto: is "exit 1" the code in the signal supply ?
ChristopherBotto lizmat: I have "signal(SIGTERM).act: { exit 1 };" and "signal(SIGINT).act: { exit 1 };" 21:46
dalek Iish: b65013c | (Salvador Ortiz)++ | / (10 files):
Add $drv.version (actual 'client' version)
ChristopherBotto lizmat: I'm not sure what you mean by "signal supply", now that I think of it. I'm a little new at asynchrony. 21:48
skink Would anyone be willing to do some code review for Crypt::Random?
grondilu m: say class { method list { <foo bar> } }.new.list 21:52
camelia rakudo-moar 40a953: OUTPUT«(foo bar)␤»
grondilu m: say class { method list { <foo bar> } }.new[]
camelia rakudo-moar 40a953: OUTPUT«<anon|66568944>.new␤»
ChristopherBotto skink: I don't know if I could do a review, but I was just curious, why do you check both $one and $two in this test from "01-buf.t"? ok ($one.elems == $bytes || $two.elems == $bytes), "crypt_random_buf() outputs hold correct number of bytes"; 21:53
grondilu doesn't postcircumfix:<[]> point to .list with no arguments?
grondilu suddenly vaguely remembers it doesn't.
ChristopherBotto skink: I meant, why do you check $one OR $two? Shouldn't they both hold the same number of bytes? 21:54
sortiz skink, github.com/skinkade/crypt-random/b...tra.pm6#L4 # Not needed now ;-)
ChristopherBotto skink: I meant, here (thanks sortiz for showing how to quote line numbers on github). github.com/skinkade/crypt-random/b...-buf.t#L11 21:56
21:56 Khisanth joined
grondilu finds out it's ZEN-POS 21:57
m: say class { method ZEN-POS { <foo bar> } }.new[]
camelia rakudo-moar 40a953: OUTPUT«(foo bar)␤»
ZoffixWin :o 21:58
lizmat ChristopherBotto: you can actually do: signal(SIGTERM,SIGINT).act: { exit 1 }
skink ChristopherBotto, Yeah that should be && 21:59
lizmat I have no idea what could be causing the spurious error... perhaps running it with --ll-exception might help ?
skink sortiz, That's in a cleanup commit I forgot to push
sortiz skink, You can pass a pre-allocated Buf to NC functions and avoid the CArray, for example: sub SystemFunction036(Buf, uint64) is 'native'; my $bytes=Buf.allocate($len); SystemFunction036($bytes,$len). 22:03
22:03 dvinciguerra_ joined
ChristopherBotto lizmat: Thanks! 22:05
sortiz I need to add some doc in NC about Blob/Buf uses… 22:06
22:06 dvinciguerra__ left 22:07 sufrostico joined 22:12 rindolf left
skink sortiz, Neat, I'll try it out 22:13
sortiz, Which would also render the carray-to-buf unneeded 22:17
sortiz skink, yep. For native types, using preallocated bufs is better that CArray. Think in Buf[foo].allocate as Perl6's calloc. 22:20
skink So Buf[uint8].allocate? 22:21
sortiz Buf by default is Buf[uint8] :-)
skink Alrighty then
pushed 22:22
lizmat m: dd Buf.allocate(5)
camelia rakudo-moar 40a953: OUTPUT«Buf.new(0,0,0,0,0)␤»
lizmat m: dd Buf[int8].allocate(5)
camelia rakudo-moar 40a953: OUTPUT«Buf[int8].new(0,0,0,0,0)␤»
lizmat m: dd Buf[uint8].allocate(5)
camelia rakudo-moar 40a953: OUTPUT«Buf[uint8].new(0,0,0,0,0)␤»
lizmat hmmm
lizmat goes to sleep over this 22:23
good night, #perl6!
sortiz o/ lizmat
m: Buf.new.of.say;
camelia rakudo-moar 40a953: OUTPUT«(uint8)␤»
skink Anything else? 22:26
22:27 spintronic left
sortiz Yep, in general native types are faster, so when possible use uint64 over UInt64. 22:28
22:28 firstdayonthejob left, pmurias left 22:29 sufrostico left
skink I figured. 22:29
sortiz Moreover UInt and variants are subtypes so even there are more expensive. 22:30
skink I was wondering what the performance impact of those was. Comparison for every value? 22:31
22:32 sufrostico joined
sortiz See ZoffixWin++ latest blog. 22:33
22:33 ChristopherBotto left
skink I read that earlier. It has native types but not subsets. 22:34
sortiz, Because left-shift adding was faster than .unpack() I had decided to return Int for random(_uniform). Should I change that behavior? 22:35
22:35 kalio left
sortiz Ahh, Are you talking about the subtypes, yes, every assignation should be checked. 22:35
22:36 sufrostico left
sortiz skink, dunno for that particular case, so you should benchmark that. 22:36
sortiz need a coffee, bbl 22:38
skink Well that spouts an error trying to <+= and += the uint64, and returning and taking uint64 makes a whopping 1% performance difference 22:42
22:43 skids joined, Sgeo joined, RabidGravy left
sortiz The error can be a bug, I've seen other. And %1 not worth it. 22:47
skink I'm defaulting to 32bit to mimic arc4random()'s native behavior, but I like the idea of being able to return 8/16/32/64/any from a single short function. 22:48
Taking a uint64 is actually optimal though, since that's actually the number of bytes. 22:50
sortiz, Think the module's ready to add to the list? 22:56
sortiz Sure! 22:57
dalek Iish: 3c302e5 | (Salvador Ortiz)++ | t/27-mysql-datetime.t:
travis-ci: Try a different mysql SQL type
skink Sweet :D 22:58
22:59 sufrostico joined
sortiz skink, Totally unrelated: are you in linux? if so, what distro are you using? 22:59
skink Ubuntu atm 23:00
sortiz Version?
skink 14.04
sortiz Thanks, I need help from someone with 12.04 (Precise) 23:05
Timbus how involved is it? i have a VPS using 12.04 23:06
23:10 kid51 joined
sortiz Timbus, not code related, but mysql related. Seems (via travis-ci) that mysql shipped with Precise don't like DATETIME with precision as a column definition. 23:11
Timbus hmmm let me see if it has mysql. i think i opted for pgsql for my wordpress
nope it has mysql. what you need me to copy/paste for ya 23:12
hopefully SQL?
sortiz can you successfully create a table like: 'CREATE TABLE test( date DATETIME(6))' ? 23:14
Timbus ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(6))' at line 1 23:21
sorry, was semi-afk
hope that helps?
sortiz Timbus, Yep, that confirm my suspicions. Is version related, my 10.0.23.MariaDB accepts that without problems. Thank you. 23:25
23:25 kerframil joined 23:28 kid511 joined, BenGoldberg joined, kid51 left
sortiz So no DATETIME with subsecond precision support in DBIish for legacy mysql. :-) 23:29
23:30 BenGoldberg left 23:32 BenGoldberg joined 23:35 vike left
skink Can someone confirm whether or not I'm crazy? 23:35
cvsweb.openbsd.org/cgi-bin/cvsweb/~...text/plain
>min = -upper_bound % upper_bound;
Won't that always be 0?
23:37 espadrine left, perlawhirl joined
teatime as far as I can see.. 23:37
23:37 Khisanth left
teatime the return for upper_bound < 2 is also weird.. wouldn't 1 be a valid upper bound? 23:39
skink It's exclusive, so if you set upper_bound to 1 it can only possibly return 0 23:40
So it just skips the math
teatime oh ok
skink And an upper_bound of 0 would just break it
23:41 AlexDaniel left
teatime yeah it does explicitly say [0, upper_bound) doesn't it 23:41
you know, I've seen algos for exactly this that didn't require recursion (non-deterministically-deep recursion, even) 23:42
23:43 BenGoldberg left
teatime oh nm 23:44
I quit, I can't read today
skink: if you say unary - on a uint32 what type does it get upgraded to? 23:46
a longer signed int type? I don't know the answer, but if it's something unexpected maybe it's just very 'clever' code that does something useful. 23:47
skink m: my uint32 $test = 93; say -$test; 23:49
camelia rakudo-moar 40a953: OUTPUT«-93␤»
teatime heh, I don't think you can use perl to answer that question. 23:51
23:51 Khisanth joined
timotimo m: my uint32 $test = 93; my uint32 $other = -$test; say $other 23:53
camelia rakudo-moar 40a953: OUTPUT«4294967203␤»
teatime apparently unary minus on an unsigned type does something surprising
^^ 23:54
timotimo we don't keep unsignedness around for you
skink Hm... 23:55
23:56 johndau joined
teatime m: my uint32 $test = 93; my uint32 $other = ~ $test; say $other 23:56
camelia rakudo-moar 40a953: OUTPUT«===SORRY!===␤Unknown coercion case for str; got: 19␤»
teatime m: my uint32 $test = 93; my uint32 $other = +^ $test; say $other 23:58
camelia rakudo-moar 40a953: OUTPUT«4294967202␤»
timotimo oh my
yeah, for 2's complement you have to add 1
23:58 wamba joined
skink So if I wanna use an Int as input I'll have to emulate that behavior in a different way. 23:58
teatime I was actually trying to see if www.codingstandard.com/rule/5-3-1-d...gned-type/ were actually equivalent operations. 23:59
timotimo yeah, i think our UInt is just Int with a refinement that complains if it's a negative value
skink Well, I'm dumb.
/* 2**32 % x == (2**32 - x) % x */
It's right there.