Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2016-08-06

Perl 6 | Reference Documentation | Rakudo

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

All times shown according to UTC.

Time Nick Message
00:00 zacts joined #perl6
00:13 AlexDaniel tbrowder: hi
00:13 dalek doc/signature-test-option: fbe8525 | Altai-man++ | / (18 files):
00:13 dalek doc/signature-test-option: This commit adds new pod config option: 'signature', and adapts current type documentation to it's usage instead of brackets addition.
00:13 dalek doc/signature-test-option: See https://github.com/perl6/doc/is​sues/794#issuecomment-237981574
00:13 dalek doc/signature-test-option: review: https://github.com/perl6/doc/commit/fbe852570c
00:14 AlexDaniel tbrowder: I see there's “Perl_6” on the experimental page (with underscore)
00:15 AlexDaniel tbrowder: I'm not sure why, but my guess is that you probably mistaken in to   which is displayed as a colored underscore in emacs
00:15 AlexDaniel it*
00:15 AlexDaniel tbrowder:   being non-breaking space
00:15 sena_kun tbrowder, if you're using emacs, you can easily add non-breaking spaces with "C-x 8 space". Just number "8" and then normal space will do the trick.
00:17 AlexDaniel sena_kun: 「C-x 8」, right! I should probably use it more
00:18 tbrowder You both are correct.  Can one of you correct that, please?
00:18 AlexDaniel sure
00:18 cognominal joined #perl6
00:19 sena_kun AlexDaniel, I wonder how people work without emacs. Vim, probably.
00:19 pierre_ joined #perl6
00:20 dalek doc: 6dd293b | (Aleks-Daniel Jakimenko-Aleksejev)++ | doc/Language/experimental.pod6:
00:20 dalek doc: Change Perl_6 to Perl 6
00:20 dalek doc:
00:20 dalek doc: Sometimes it's not too hard to confuse non-breaking space with an underscore
00:20 dalek doc: in emacs, as both are displayed as an underscore (one being different color).
00:20 dalek doc: review: https://github.com/perl6/doc/commit/6dd293b801
00:23 AlexDaniel sena_kun: I'm not sure if I'm with you on this. The thing is, I have solved so many problems that vim/emacs are trying to solve, but I did it on completely different levels (keyboard, layout, OS), so in my view if you do all that, then you don't really need emacs or vim.
00:23 AlexDaniel for example, I don't need 「C-x 8 space」 because I can type it
00:24 sena_kun AlexDaniel, it can be. Anyway, not again this emacs/vim/anything flame.
00:24 AlexDaniel it is not a flame, it is just a different point of view :)
00:26 AlexDaniel my point is that you can like your editor as much as you want, but you should always be open to other solutions to common problems.
00:26 Xliff I'm getting this error "Cannot unbox a type object" when attempting to pass a type object to a nativecall sub.
00:27 Xliff Isn't that allowed?
00:27 sena_kun AlexDaniel, more importangly, can you help me, please, with https://github.com/perl6/doc/pull/814? I'm worring about the CONTRIBUTING.md changes.
00:30 Xliff Rebuilding rakudo... just in case.
00:30 AlexDaniel sena_kun: I don't think that I am more native, but perhaps it would be better if it specified what kind of “body” it is talking about. Or maybe “don't do this” example can help?
00:31 AlexDaniel sena_kun: but it is not that important really, people are more likely to look at other parts of the documentation to see what they should be doing
00:32 BrassLantern joined #perl6
00:32 canopus joined #perl6
00:32 dalek doc: 3f64990 | (Tom Browder)++ | doc/Language/experimental.pod6:
00:32 dalek doc: use title case for title words for consistency
00:32 dalek doc: review: https://github.com/perl6/doc/commit/3f6499097d
00:33 AlexDaniel sena_kun: oh!
00:33 sena_kun AlexDaniel, thanks. What's the matter?
00:33 golee joined #perl6
00:35 travis-ci joined #perl6
00:35 travis-ci Doc build passed. Altai-man 'This commit adds new pod config option: 'signature', and adapts current type documentation to it's usage instead of brackets addition.
00:35 travis-ci https://travis-ci.org/perl6/doc/builds/150192383 https://github.com/perl6/doc/commit/fbe852570cef
00:35 travis-ci left #perl6
00:35 AlexDaniel sena_kun: sorry, nothing :)
00:36 AlexDaniel sena_kun: I was thinking about supporting multiline signatures, but I cannot really find any of these, so OK
00:37 sena_kun AlexDaniel, okay. I'm done for today anyway. If we have multiline signature, then I'll sooner or later rewrite it, since sucn signature won't compile. And we want to compile everything. (:
00:37 AlexDaniel sena_kun: actually, here: https://github.com/perl6/doc/blo​b/master/doc/Type/Str.pod6#L177
00:37 avenj joined #perl6
00:38 AlexDaniel sena_kun: nvm I will leave a comment
00:38 AlexDaniel sena_kun: good night!
00:38 sena_kun AlexDaniel, I haven't touched Str.pod6 yet.
00:39 sena_kun AlexDaniel, my current goal is to make all Type/* compilable, so sooner or later I'll solve this anyway.
00:39 AlexDaniel sena_kun++
00:53 dalek doc: 8d9793b | (Tom Browder)++ | doc/Language/experimental.pod6:
00:53 dalek doc: correct spelling
00:53 dalek doc: review: https://github.com/perl6/doc/commit/8d9793ba54
01:00 tbrowder AlexDaniel: ref emacs: I am still modding my init.el to handle unicode,  and I need to add handling the non-breaking space to show it to me as something other than the underscore.  That can and will be done.
01:01 b2gills .tell bronco_creek Windows has always accepted both kinds of slashes, it's only some programs that have a problem with forward slashes.
01:01 yoleaux b2gills: I'll pass your message to bronco_creek.
01:06 dalek doc: 63b121d | (Tom Browder)++ | CONTRIBUTING.md:
01:06 dalek doc: remove spurious ellipsis
01:06 dalek doc: review: https://github.com/perl6/doc/commit/63b121d841
01:25 BenGoldberg joined #perl6
01:30 araujo__ joined #perl6
01:33 araujo__ joined #perl6
01:40 sufrostico joined #perl6
01:46 kalkin-_ joined #perl6
01:47 ilbot3 joined #perl6
01:47 Topic for #perl6 is now »ö« Welcome to Perl 6! | https://perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:,  or /msg camelia p6: ... | irclog: http://irc.perl6.org or http://colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
01:49 araujo_ joined #perl6
01:51 AlexDaniel tbrowder: just change the face to make it more prominent
01:52 araujo_ joined #perl6
01:53 awwaiid m: say <1/2> ; say < 1/2 > # hm!
01:53 camelia rakudo-moar 589061: OUTPUT«0.5␤1/2␤»
01:53 awwaiid I didn't know that <1/2> was Rat notation
01:54 awwaiid I like having Rat notation
01:54 araujo_ joined #perl6
01:54 AlexDaniel tbrowder: “escape-glyph” is the face in question
01:56 AlexDaniel tbrowder: also see “nobreak-space” face and “nobreak-char-display” variable
01:57 araujo_ joined #perl6
01:59 BenGoldberg m: < 1/2 >.perl.say
01:59 camelia rakudo-moar 589061: OUTPUT«RatStr.new(0.5, "1/2")␤»
01:59 BenGoldberg m: <1/2>.perl.say
01:59 camelia rakudo-moar 589061: OUTPUT«0.5␤»
01:59 awwaiid hmm.
01:59 BenGoldberg m: <1/2>.WHAT.say
01:59 camelia rakudo-moar 589061: OUTPUT«(Rat)␤»
02:00 AlexDaniel hmmm
02:01 BenGoldberg m: say <245850922/78256779> - pi
02:01 camelia rakudo-moar 589061: OUTPUT«0␤»
02:01 AlexDaniel awwaiid: may I ask why do you need Rat notation?
02:01 AlexDaniel I mean, 1/2 is already a Rat
02:01 BenGoldberg m: pi.WHAT.say;
02:01 camelia rakudo-moar 589061: OUTPUT«(Num)␤»
02:01 * awwaiid reads about https://docs.perl6.org/lan​guage/glossary#Allomorph_
02:01 BenGoldberg m: say <245850922/78256779>.Num - pi
02:01 camelia rakudo-moar 589061: OUTPUT«0␤»
02:02 BenGoldberg m: say atan2( -1, 0 );
02:02 camelia rakudo-moar 589061: OUTPUT«-1.5707963267949␤»
02:02 BenGoldberg m: say atan2( 1, 0 );
02:02 camelia rakudo-moar 589061: OUTPUT«1.5707963267949␤»
02:02 BenGoldberg m: say atan2( 1, 0 )*2;
02:02 camelia rakudo-moar 589061: OUTPUT«3.14159265358979␤»
02:02 BenGoldberg m: say atan2( 1, 0 )*2 - <245850922/78256779>;
02:02 camelia rakudo-moar 589061: OUTPUT«0␤»
02:03 BenGoldberg m: say (atan2( 1, 0 )*2 - <245850922/78256779>) * 1e100;
02:03 camelia rakudo-moar 589061: OUTPUT«0␤»
02:03 AlexDaniel m: say <42>.WHAT;
02:03 camelia rakudo-moar 589061: OUTPUT«(IntStr)␤»
02:04 awwaiid AlexDaniel: I accidentally ran into it. But you have a good point that 1/2 is just as good. hmm.
02:04 awwaiid I ran into when building a grammar that could parse fractions and was testing things iirc
02:05 AlexDaniel it looks like other languages need Rat notation, perl 6 doesn't :)
02:05 awwaiid AlexDaniel: I don't think I like <1/2> being different than < 1/2 > though. Actually -- I as I think about it I _don't_ like it because it makes < ... > feel overloaded
02:06 awwaiid I was expecting <...> to reliably be quote-word context
02:06 freezerburnv_ joined #perl6
02:06 AlexDaniel by the way, python 3.6 will support underscores in numeric literals. How cool is that! ;)
02:06 AlexDaniel or at least, that's what I heard
02:07 awwaiid it doesn't already? Ruby does
02:07 AlexDaniel almost every language does.
02:07 FROGGS joined #perl6
02:08 awwaiid I need to get Inline::Python going a bit better. I hooked up travis last weekend at least. All The Libraries!!!
02:08 awwaiid (are belong to us)
02:08 AlexDaniel awwaiid: actually, I'm not sure if it is a bug or not
02:08 AlexDaniel it probably is
02:08 awwaiid that they are different, or that <1/2> _ever_ is automatically a Rat / RatStr?
02:09 AlexDaniel that < 25/2 > is RatStr
02:10 AlexDaniel I don't know, maybe it was done on purpose, but why?
02:10 awwaiid no idea
02:10 AlexDaniel m: say <0.5>.perl
02:10 camelia rakudo-moar 589061: OUTPUT«RatStr.new(0.5, "0.5")␤»
02:10 AlexDaniel m: say < 1/2 >.perl
02:10 camelia rakudo-moar 589061: OUTPUT«RatStr.new(0.5, "1/2")␤»
02:11 AlexDaniel m: say <1/2>.perl
02:11 camelia rakudo-moar 589061: OUTPUT«0.5␤»
02:11 awwaiid sick and wrong
02:11 awwaiid ooo! we should deparse it
02:13 AlexDaniel m: say <42>.perl
02:13 camelia rakudo-moar 589061: OUTPUT«IntStr.new(42, "42")␤»
02:13 AlexDaniel m: say < 42 >.perl
02:13 camelia rakudo-moar 589061: OUTPUT«IntStr.new(42, "42")␤»
02:14 * AlexDaniel submits rakudobug
02:15 BenGoldberg m: 3587785776203/44485467702853
02:15 camelia rakudo-moar 589061: OUTPUT«WARNINGS for <tmp>:␤Useless use of "/" in expression "3587785776203/44485467702853" in sink context (line 1)␤»
02:15 BenGoldberg m: say 3587785776203/44485467702853
02:15 camelia rakudo-moar 589061: OUTPUT«0.080650737453591␤»
02:15 BenGoldberg m: say 3587785776203/1783366216531
02:15 camelia rakudo-moar 589061: OUTPUT«2.01180539529450␤»
02:20 tbrowder AlexDaniel: thanks!
02:25 TimToady is not a bug
02:26 awwaiid What's the concept?
02:26 awwaiid (or link to doc works too of course)
02:26 TimToady we need a literal notation for rats and complex, and <> is it
02:26 awwaiid how about the space vs no-space differene?
02:27 AlexDaniel m: say <42e2i>.perl
02:27 TimToady we don't need an extra literal notation for ints or nums, so we don't bother to treat <> special
02:27 camelia rakudo-moar 589061: OUTPUT«ComplexStr.new(<0+4200i>, "42e2i")␤»
02:27 AlexDaniel m: say < 42e2i >.perl
02:27 camelia rakudo-moar 589061: OUTPUT«ComplexStr.new(<0+4200i>, "42e2i")␤»
02:27 TimToady m: say <42e2+3i>.perl
02:27 camelia rakudo-moar 589061: OUTPUT«<4200+3i>␤»
02:27 awwaiid Right -- so 1/2 is an operation that results in a Rat, whereas <1/2> is a Rat literal.
02:28 awwaiid (compiler optimization excepted)
02:28 TimToady yes, and while you can get away with (1/2), it only works by constant folding
02:28 awwaiid cool
02:28 TimToady and bare 1/2 is a problem if you have a surrounding operator that is tighter than /
02:28 noganex joined #perl6
02:29 TimToady so we just stole <> for those literals, but only when there's no space
02:29 TimToady sure, it's a little inconsistent, but there are reasons
02:29 AlexDaniel m: say <42e2+3i>.perl
02:29 camelia rakudo-moar 589061: OUTPUT«<4200+3i>␤»
02:29 AlexDaniel m: say < 42e2+3i >.perl
02:29 camelia rakudo-moar 589061: OUTPUT«ComplexStr.new(<4200+3i>, "42e2+3i")␤»
02:29 AlexDaniel I see
02:30 TimToady generally, you wouldn't write that
02:30 TimToady it's just a degenerate case of qw
02:30 * AlexDaniel throws away a fully written bug report
02:30 TimToady or more generally, of val()
02:30 awwaiid m: say <1/2>.WHAT ; say < 1/2 >.WHAT ; say "1/2".WHAT ; say qw< 1/2 >.WHAT
02:30 camelia rakudo-moar 589061: OUTPUT«(Rat)␤(RatStr)␤(Str)␤(Str)␤»
02:31 TimToady anyway, it's working as designed, even if you think the designer is an idiot :)
02:31 awwaiid not at all -- just want to understand. In this case :)
02:32 awwaiid (kidding. TimToady++ # awesomesauce)
02:32 AlexDaniel TimToady: it kinda makes sense. “kinda” because it is very confusing at first and now I will be thinking “wait, what am I going to get here?” whenever I use <>, as there's no simple rule.
02:33 TimToady you think <> is inconsistent here, try inside regex :)
02:33 awwaiid so the rule is <> bumping right up against a slashy fraction is a Rat. What's with the RatStr?
02:33 awwaiid best of both worlds I guess
02:33 TimToady allomorphism is for when someone is forced to use a textual representation, and needs a bit of dwimmery
02:34 awwaiid interesting
02:34 TimToady when someone is asked for a number at a prompt, you'd like to be able to treat it like a number
02:34 TimToady likewise, your program is forced to be a textual representation
02:34 BenGoldberg m: num $x = 0; ++$x; say $x;
02:34 camelia rakudo-moar 589061: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3num7⏏5 $x = 0; ++$x; say $x;␤    expecting any of:␤        infix␤        infix stopper␤        statement end␤        statement modifier␤        st…»
02:34 BenGoldberg m: my num $x = 0; ++$x; say $x;
02:34 camelia rakudo-moar 589061: OUTPUT«This type cannot unbox to a native number: P6opaque, Int␤  in block <unit> at <tmp> line 1␤␤»
02:34 TimToady so literals are a bit allomorphic, especially inside <> with multiple vlaues
02:34 BenGoldberg m: my num $x = 0e0; ++$x; say $x;
02:34 camelia rakudo-moar 589061: OUTPUT«1␤»
02:34 BenGoldberg m: my num $x = 0.5e0; ++$x; say $x;
02:34 camelia rakudo-moar 589061: OUTPUT«1.5␤»
02:36 AlexDaniel .tell gfldex see http://irclog.perlgeek.de/p​erl6/2016-08-06#i_12976146 and the discussion that follows. Perhaps you'll have an idea on how we can improve the docs to make it less WATy
02:36 yoleaux AlexDaniel: I'll pass your message to gfldex.
02:37 * BenGoldberg wonders what would break if ++ on a num increased by the smallest amount which results a value greater that the initial num.
02:40 geekosaur everyone expecting $x = 0.5; $x++; to do what it does *everywhere*
02:42 geekosaur also, I defy you to provide a simple, comprehensible explanation of the resulting behavior on floating point numbers (remember that said increase will scale depending on the magnitude of the original value)
02:43 AlexDaniel m: my $x = 9e16; my $y = $x; $x++; say $x == $y   # ;)
02:43 camelia rakudo-moar 589061: OUTPUT«True␤»
02:43 geekosaur yes, but that's at least consistent with floating point everywhere else
02:44 BenGoldberg How about at least provide .smallest-greater and .largest-smaller methods?
02:45 TimToady and what would you do with it?
02:45 BenGoldberg TBH, I'm not sure ;)
02:45 TimToady adding 1 tends to have more real-world application, I suspect
02:46 BenGoldberg Probably
02:47 BenGoldberg m: say first { !(0+"1e-$_") }, ^Inf;
02:47 camelia rakudo-moar 589061: OUTPUT«324␤»
02:47 araujo__ joined #perl6
02:47 BenGoldberg m: my $x = 0; my $y = $x + 1e-323; say $x <=> $y;
02:47 camelia rakudo-moar 589061: OUTPUT«Less␤»
02:48 BenGoldberg m: my $x = 0; my $y = $x + 1e-323; say $x <=> $y but NotByMuch;
02:48 camelia rakudo-moar 589061: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Operators '<=>' and 'but' are non-associative and require parentheses␤at <tmp>:1␤------> 3 = 0; my $y = $x + 1e-323; say $x <=> $y7⏏5 but NotByMuch;␤    expecting any of:␤        infix␤      …»
02:48 BenGoldberg m: my $x = 0; my $y = $x + 1e-323; say (($x <=> $y) but (role NotByMuch {}));
02:48 camelia rakudo-moar 589061: OUTPUT«Less␤»
02:49 araujo__ joined #perl6
02:50 TimToady m: my $x = 10; my $y = $x + 1e-323; say $x <=> $y;
02:50 camelia rakudo-moar 589061: OUTPUT«Same␤»
02:51 BenGoldberg m: <2646693125139304345/842468587426513207> - <139755218526789/44485467702853>
02:51 camelia rakudo-moar 589061: OUTPUT«WARNINGS for <tmp>:␤Useless use of "-" in expression "<2646693125139304345/842468587426513207> - <139755218526789/44485467702853>" in sink context (line 1)␤»
02:51 BenGoldberg m: say <2646693125139304345/842468587426513207> - <139755218526789/44485467702853>
02:51 camelia rakudo-moar 589061: OUTPUT«-1.61109530172737e-28␤»
02:51 BenGoldberg m: say <2646693125139304345/842468587426513207> - pi.Rat
02:51 camelia rakudo-moar 589061: OUTPUT«-2.66764189062422e-07␤»
02:52 araujo__ joined #perl6
02:54 mspo m: my m: my Numeric $x = 0.5; say ++$x;
02:54 camelia rakudo-moar 589061: OUTPUT«5===SORRY!5===␤Type 'm' is not declared␤at <tmp>:1␤------> 3my m7⏏5: my Numeric $x = 0.5; say ++$x;␤Malformed my␤at <tmp>:1␤------> 3my7⏏5 m: my Numeric $x = 0.5; say ++$x;␤␤»
02:54 mspo m: my Numeric $x = 0.5; say ++$x;
02:54 camelia rakudo-moar 589061: OUTPUT«1.5␤»
02:54 BenGoldberg If I've got a Rat which supposedly approximates pi to 37 decimal digits, and rakudo's builtin pi (converted to a Rat) differs by 2e-7, then does that mean our conversion from Num to Rat is deficient, or does it mean our builtin pi is deficient?
02:56 TimToady in that range, Rat has more precision than Num
02:56 TimToady assuming 64-bit Num
02:57 araujo__ joined #perl6
02:58 BenGoldberg m: say log( 1e-323, 2 );
02:58 camelia rakudo-moar 589061: OUTPUT«-1073␤»
03:00 BenGoldberg The wikipedia page on 64 bit doubles mentions that subnormals can be as small as 5 x 10 ** -324, so that's about right.
03:02 BenGoldberg m: log( 2**52, 10 );
03:02 camelia rakudo-moar 589061: OUTPUT«WARNINGS for <tmp>:␤Useless use of "log( 2**52, 10 )" in expression "log( 2**52, 10 )" in sink context (line 1)␤»
03:02 BenGoldberg m: log( 2**52, 10 ).say;
03:02 camelia rakudo-moar 589061: OUTPUT«15.653559774527␤»
03:04 BenGoldberg Would programmers be upset if perl6's builtin pi were a Rat instead of a Num?
03:04 BenGoldberg m: pi.nude.perl.say
03:04 camelia rakudo-moar 589061: OUTPUT«Method 'nude' not found for invocant of class 'Num'␤  in block <unit> at <tmp> line 1␤␤»
03:04 BenGoldberg m: pi.Rat.nude.perl.say
03:04 camelia rakudo-moar 589061: OUTPUT«(355, 113)␤»
03:04 geekosaur practically, it's a rational anyway
03:05 TimToady there's not a lot of point, since almost any calculations involving pi will degrade to Num quickly
03:05 BenGoldberg m: say pi.Rat.Num - pi
03:05 camelia rakudo-moar 589061: OUTPUT«2.66764189404967e-07␤»
03:05 TimToady Rats are really only useful when doing addition/subtraction with limited denominators
03:05 TimToady which is a lot of calculation, but not typically when you're multiplying by pi
03:07 geekosaur also iirc at one point the Rat implementation of pi was a hairier Rat, but that just made all Rat computations using it painful
03:07 geekosaur (hairier but more precise)
03:09 geekosaur although the counterargument there is that if you're doing Rat math involving pi, you're already doing it wrong >.>
03:09 geekosaur or else need something more specific to whatever non-floating approximation you are using anyway
03:09 * BenGoldberg thinks he's got an idea...
03:10 BenGoldberg Would a method pi(Rat:U, $precision) make sense?
03:20 TimToady I don't think we need to build a pi spigot into p6
03:24 kaare_ joined #perl6
03:38 BrassLantern joined #perl6
03:52 CIAvash joined #perl6
04:25 pierre_ joined #perl6
04:36 Cabanossi joined #perl6
04:56 holyghostoo joined #perl6
04:56 holyghostoo left #perl6
04:56 holyghostoo joined #perl6
05:16 obfusk_ joined #perl6
05:18 andrzejku joined #perl6
05:30 pierre_ joined #perl6
05:30 k1lldash9 joined #perl6
05:33 k1lldash9 curious, are there advantages to say vs print "this\n" ?
05:33 k1lldash9 does it implicitly set carriage return and that is essentially it? that's all
05:33 k1lldash9 thanks! :)
05:35 k1lldash9 ahh, nevermind, I found the answer, sorry! ha
05:35 andrzejku hi
05:36 Tonik joined #perl6
05:37 k1lldash9 left #perl6
05:38 pierre_ joined #perl6
05:43 hwcomcn joined #perl6
05:51 hwcomcn joined #perl6
05:53 hwcomcn joined #perl6
05:54 hwcomcn joined #perl6
05:55 hwcomcn joined #perl6
05:56 pierre_ joined #perl6
05:57 hwcomcn joined #perl6
05:58 hwcomcn joined #perl6
06:07 smls joined #perl6
06:08 smls m: say (1.1 .. 10.1).grep(3 < *.Int < 7)
06:08 camelia rakudo-moar 589061: OUTPUT«===SORRY!===␤QAST::Block with cuid 1 has not appeared␤»
06:09 smls ^^ ?
06:12 itaipu joined #perl6
06:18 TimToady m: say (1.1 ... 10.1).grep(3 < * < 7)
06:18 camelia rakudo-moar 589061: OUTPUT«(3.1 4.1 5.1 6.1)␤»
06:19 TimToady m: say (1.1 ... 10.1).grep(3 < * + 0 < 7)
06:19 camelia rakudo-moar 589061: OUTPUT«===SORRY!===␤QAST::Block with cuid 1 has not appeared␤»
06:19 TimToady doesn't like WhateverCode there, I guess
06:19 smls So, Whatever can curry with chaining comparison ops but WhateverCode can't?
06:19 TimToady would seem not
06:20 smls will RT
06:22 smls TimToady: Btw, the reason I was asking why we don't have a .product to go along with .sum, is that the  { [*] |$_ }  is the thing that stands out the most as line noise in http://rosettacode.org/wiki/S​um_and_Product_Puzzle#Perl_6
06:24 ufobat joined #perl6
06:26 ufobat good morning :)
06:44 mohae joined #perl6
06:57 labster joined #perl6
07:12 holyghostoo joined #perl6
07:15 darutoko joined #perl6
07:16 andrzejku joined #perl6
07:25 setty2 joined #perl6
07:29 firstdayonthejob joined #perl6
07:42 pierre_ joined #perl6
07:48 wamba joined #perl6
07:54 smls TimToady: Your grammar-based solution to http://rosettacode.org/wiki/Amb#Perl_6 doesn't work anymore in the latest Rakudo... :(
07:55 smls It simply *stops* after reaching the end of the first branch, and doesn't backtrack, so it prints no solution.
07:56 smls Strangely enough, it works if the  <{...}>  regex EVAL interpolations are replaced with the regex code they produce.
07:56 smls Did something change about the  <{...}>  feature that would prevent backtracking over it?
08:00 smls Here's the code with some cleanup and debug statements added, to show the problem: https://gist.github.com/smls/40​7f65d275810f41014b522148f2312a
08:14 spider-mario joined #perl6
08:35 stmuk joined #perl6
08:38 stmuk_ joined #perl6
08:56 andrzejku joined #perl6
09:06 RabidGravy joined #perl6
09:16 obfusk joined #perl6
09:33 pmurias joined #perl6
09:35 margeas joined #perl6
09:35 tbrowder ufobat: good morning!
09:36 sergot joined #perl6
09:37 pecastro joined #perl6
09:40 stmuk joined #perl6
09:43 margeas joined #perl6
09:47 MorayJ joined #perl6
09:58 pdcawley joined #perl6
09:58 perl666 joined #perl6
10:23 stmuk_ joined #perl6
10:35 * dogbert17 silence reigns
10:41 marcovorg joined #perl6
10:43 dalek doc: eb847e3 | (Jan-Olof Hendig)++ | doc/Type/List.pod6:
10:43 dalek doc: Added docs for List.antipairs
10:43 dalek doc: review: https://github.com/perl6/doc/commit/eb847e36df
10:44 smls Why is  .antipairs  needed if it does the same thing as  .pairs.invert  ?
10:47 timotimo hoh, it is?
10:47 timotimo m: { :1a, :2b, :3c, :4d }.antipairs.perl.say
10:47 camelia rakudo-moar 589061: OUTPUT«(1 => "a", 4 => "d", 3 => "c", 2 => "b").Seq␤»
10:47 timotimo m: { :1a, :2b, :3c, :4d }.pairs.invert.perl.say
10:47 camelia rakudo-moar 589061: OUTPUT«(1 => "a", 4 => "d", 3 => "c", 2 => "b").Seq␤»
10:49 dogbert17 timotimo: there's something fishy here, there is an implementation of 'invert' in List.pm, but it soes not seem to work
10:50 dogbert17 m: say (1,2,3).invert  # ??
10:50 camelia rakudo-moar 589061: OUTPUT«Method 'value' not found for invocant of class 'Int'␤  in block <unit> at <tmp> line 1␤␤»
10:50 timotimo um, that's quite weird
10:50 timotimo to have .invert on list do what antipairs does on a hash, but only if the list is a list of pairs
10:50 wamba joined #perl6
10:50 dogbert17 the code is a one-liner: self.map({ nqp::decont(.value) »=>» .key }).flat
10:51 timotimo right
10:51 timotimo i find that ... weird
10:51 timotimo also, why would it have »=>» there? unless there's more than one key per thing?
10:52 dogbert17 timotimo: it could be I guess, in other places invert drills down into lists
10:53 dogbert17 https://docs.perl6.org/type/Map#method_invert
10:53 dogbert17 I wonder if there is a :kv missing from List.invert
10:54 smls ah.
10:54 timotimo could be, yeah
10:55 dogbert17 where's lizmat when we need her :)
10:56 lizmat I'm here
10:56 lizmat .oO( you rang? )
10:56 lizmat I'm not sure why we have List.invert either.... I don't think I touched it in any opt work
10:57 dogbert17 can you backlog ~15 lines please :)
10:57 lizmat Hash.invert is *not* the same as Hash.antipairs
10:57 dalek ecosystem: 2373470 | RabidGravy++ | META.list:
10:57 dalek ecosystem: Add Doublephone
10:57 dalek ecosystem:
10:57 dalek ecosystem: See https://github.com/jonathanstowe/Doublephone
10:57 dalek ecosystem: review: https://github.com/perl6/e​cosystem/commit/237347001a
10:57 dogbert17 lizmat: agreed
10:58 RabidGravy I'm back!
10:58 dogbert17 m: say (1,2,3).invert  # ??
10:58 camelia rakudo-moar 589061: OUTPUT«Method 'value' not found for invocant of class 'Int'␤  in block <unit> at <tmp> line 1␤␤»
10:58 lizmat RabidGravy++
10:58 lizmat dogbert17: lemme check
10:58 dogbert17 o/ RabidGravy
10:58 RabidGravy (but schwern made me do that one)
10:58 dogbert17 have you managed to stop Brexit ?
10:59 RabidGravy working on it
10:59 lizmat dogbert17: all I can say is that TimToady added/changed it early 2015
10:59 RabidGravy HACKERS FOR EUROPE!
10:59 timotimo HACK THE CONTINENT!!
11:00 dogbert17 lizmat: maybe we'll have to wait for his comments on the matter then
11:00 * lizmat is checking further
11:01 rindolf joined #perl6
11:01 dogbert17 RabidGravy: have you tried your musicstreaming stuff lately. perhaps it works better/faster now thanks to all recent opts?
11:01 lizmat feels to me that .invert on a List *is* the same as antipairs
11:02 dogbert17 lizmat: in which case it would be redundant
11:02 pierre_ joined #perl6
11:02 lizmat well, I guess we want to keep supplying it so you can call .invert on anyhing
11:03 dogbert17 lizmat: in which case we have a bug :)
11:03 lizmat yeah
11:03 lizmat m: dd 42.antipairs
11:03 camelia rakudo-moar 589061: OUTPUT«(42 => 0,).Seq␤»
11:03 lizmat m: dd 42.invert
11:03 camelia rakudo-moar 589061: OUTPUT«Use of uninitialized value of type Any in string context␤Any of .^name, .perl, .gist, or .say can stringify undefined things, if needed.  in block <unit> at <tmp> line 1␤Cannot resolve caller invert(Int); none of these signatures match:␤  in block <u…»
11:05 rpburkholder joined #perl6
11:06 * lizmat tries some patches
11:06 dogbert17 * oO
11:08 * lizmat hopes Apple will come out with a 32core MBP soon
11:09 itaipu joined #perl6
11:12 dogbert17 guess Apple will have something new besides iPhones in September
11:14 lizmat hmmmm  I borked 2 spectests
11:15 dogbert17 uh oh
11:16 smls Having List.invert invert the pairs of a list of pairs, is not that different than other instances where Perl 6 treats lists of pairs specially...
11:16 lizmat apparently you can only List.invert if the List contains pairs
11:18 lizmat dogbert17: so In guess the right course of action would be to rakudobug it as a @LARRY bug
11:19 stmuk joined #perl6
11:20 dogbert17 lizmat: so the bug is that it only handles list of pairs?
11:21 lizmat well, I guess the bug is that the error is really LTA if the list does not consist of pairs *OR* it should call .pairs on itself first before inverting
11:21 lizmat (aka, be the same as .antipairs)
11:22 dogbert17 so a mail to rakudobug@perl.org with [BUG] and @LARRY then?
11:22 dogbert17 in the subject that is
11:24 stmuk_ joined #perl6
11:33 lizmat dogbert17: yup
11:33 lizmat dogbert17: (sorry, was distracted)
11:36 dogbert17 lizmat: https://rt.perl.org/Public/​Bug/Display.html?id=128860
11:37 lizmat dogbert17++
11:38 dogbert17 hooray, thx for the help
11:39 dogbert17 btw, what's the fastest way in Perl 6 to split a string into a list of single characters, comb?
11:40 lizmat yup, .comb
11:41 dogbert17 lizmat: thx, I was working on a Project Euler problem and got the impression that comb is rather slow. Is it a target for opts in the future?
11:41 lizmat I was just looking at it again
11:41 dogbert17 I'm specifically referring to the default case. i.e. "string".comb
11:43 MasterDuke bench: releases .comb for ^100000
11:45 benchable MasterDuke: https://gist.github.com/ee01​73e2863fb8b9444613332eaefd62
11:46 dogbert17 MasterDuke: cool
11:46 MasterDuke looks like it did get twice as fast between 2016.06 and 2016.07
11:46 dogbert17 MasterDuke: indeed
11:47 lizmat yeah, but that was not because of changes to .comb itself
11:47 dogbert17 I was working on https://projecteuler.net/problem=112 in case you're interested
11:48 MasterDuke https://github.com/rakudo/rakudo/commit/efbfdaa
11:48 MasterDuke that's where benchable found the difference
11:49 dogbert17 those bots are nifty
11:51 MasterDuke https://projecteuler.net/problem=60 is what got me started committing to Rakudo
11:51 MasterDuke been stuck/working on that one for a long time now
11:52 dogbert17 That one I haven't solved :(
11:53 MasterDuke it's why i wrote https://github.com/MasterDuke17/List-Combinations
11:54 MasterDuke because the core combinations() was too slow
11:56 dogbert17 nice, I actually managed to solve 112, and comb definitely played a part, but the code took like 6 minutes to run on my machine
11:57 dogbert17 replacing comb with some % and div trickery reduced the time to approx one minute
11:58 MasterDuke nice. my Perl 5 solution takes 6 seconds
11:59 MasterDuke using a 'split //'
11:59 dogbert17 yeah, there's still some work to be done although some other problems which I solved earlier in the year have become much faster thx mainly to lizmat++ and jnthn++
12:05 MasterDuke yep, no arguments there
12:05 moritz m: say 300 / 6
12:05 camelia rakudo-moar 589061: OUTPUT«50␤»
12:06 moritz that's decent. The factor used to be around 100 or 200 for common tasks
12:06 dogbert17 moritz: speed is definitely improving
12:09 kid51 joined #perl6
12:18 smls_ joined #perl6
12:31 pierre_ joined #perl6
12:32 itaipu joined #perl6
12:33 canopus joined #perl6
12:34 MorayJ joined #perl6
12:38 aries_liuxueyang joined #perl6
12:42 cyphase joined #perl6
12:45 stmuk joined #perl6
12:51 freezerburnv_ joined #perl6
13:00 hcit joined #perl6
13:09 canopus joined #perl6
13:11 kid51 joined #perl6
13:21 canopus joined #perl6
13:30 freezerburnv_ joined #perl6
13:32 stmuk_ joined #perl6
13:38 RabidGravy boom!
13:41 canopus joined #perl6
13:43 RabidGravy I was thinking about that metaphone thing and unicode, seeing as metaphone (and soundex) are pretty useless for anything other than ascii words
13:45 RabidGravy is there a reliable way of knowing for a given character whether it is based on a latin character (in the rakudo implementation)?
13:47 lucar joined #perl6
13:47 lucar Hi there
13:48 lucar how does the perl6 repl compare with Common Lisp?
13:48 lucar does it support interactive coding ?
13:49 DrForr As far as I know, yeah. It lets you type in code, read it, eval's it and prints it, just like CL.
13:49 lucar great
13:49 arnsholt The Perl 6 REPL isn't as functional as you'd get from something like SBCL
13:49 lucar ah
13:50 arnsholt You can write code and stuff, but the interactive debugging isn't there
13:50 lucar oh
13:50 lucar is it planned?
13:50 arnsholt I'm pretty sure much of the interactive debugging you get in a CL could be implemented, but we haven't had quite the same amount of development time to implement it either
13:50 lucar so you cannot break in the middle of a stacktrace
13:51 lucar do something similar to "recompile" a form
13:51 arnsholt Exceptions are resumable and such, but there's no infrastructure in the REPL to manipulate it
13:51 lucar and then continue debugging right?
13:51 arnsholt And remember that live programming in a REPL is less useful in Perl 6, since the distributable program is your source code, not a serialized image of the virtual machine state
13:52 arnsholt So you can't really build up a whole app purely by REPL manipulations and then save that out
13:53 lucar interactivity is always useful arnsholt
13:53 arnsholt Sure, but it's a bit different from CL
13:53 skids joined #perl6
13:53 lucar you seem to be very knowledgeablel arnsholt
13:54 lucar are you one of the perl6 core developers?
13:55 arnsholt I wouldn't call myself core, but I've certainly contributed to internals-stuff
13:55 arnsholt (And I've used CL, which helps =)
13:55 lucar that I was able to bet on
13:56 lucar I guess SBCL on Linux
13:56 lucar :P
13:56 arnsholt Allegro Common Lisp, but Linux =)
13:56 lucar ah
13:56 lucar ACL
13:56 lucar ok
13:56 lucar so you do that for a living
13:56 lucar interesting
13:56 arnsholt Not for a living, as such
13:57 lucar and why a commercial distribution then?
13:57 arnsholt I was in academia, and my boss (and advisor) had a site licence for an app he made ages ago
13:57 arnsholt It's still expensive in academia, but not quite as insane as commercially, I b elieve
13:57 lucar ok
13:58 lucar so you did that in a research context
13:58 lucar understood
13:58 lucar as far as you know
13:59 lucar is there anything that is on par with CL interactivity and has good support on windows?
14:00 DrForr A good Linux VM? :)
14:00 arnsholt SmallTalk is pretty neat
14:00 arnsholt I've dabbled with it recently, and the fact that the code lives *in* the image is pretty cool
14:01 DrForr Any of the Scheme environments, what used to be called DrScheme comes to mind.
14:01 arnsholt Especially since it means that the state of your program in the image and the source code will never get desynched, which can happen if you're unlucky in CL
14:01 mst DrForr: yeah, I wish the lisp community would make more of a racket about it
14:01 DrForr Snerk :)
14:01 arnsholt *groan*
14:02 arnsholt Phrao ST should have good Windows support I think
14:02 arnsholt *Pharo ST
14:02 Xliff Hrm.
14:02 Xliff \o #perl6
14:03 arnsholt o/
14:03 Xliff I'm trying to run a nativecall sub that's defined like "sub nca(int32) returns blah is native('bleah') { * }" and I want to pass it a null value.
14:04 arnsholt What do you mean NULL? It's a native =)
14:04 arnsholt You can always pass 0 of course, but natives don't have nulls
14:04 arnsholt Only pointer values have nulls
14:04 Xliff So I do "nca(int32)", which should work. However, I am getting the following error "Cannot unbox a type object
14:04 Xliff in method CALL-ME"
14:04 Xliff Oh, duh
14:05 arnsholt That's an LTA error message, but yeah
14:05 Xliff LTA?
14:05 Xliff This channel needs a glossary. =)
14:06 DrForr Less Than Awesome
14:06 mst Less Than Awesome
14:06 arnsholt Or sucks, if you're feeling impolitic =)
14:07 mst it's the Minnesota Nice way of saying "this error is crap and we hate crap errors and want to keep culturally reinforcing this so people remember to go and un-crap them"
14:07 sjoshi joined #perl6
14:10 arnsholt "Minnesota nice" was a neat term
14:11 pmurias mst: isn't LTA more about error messages (and other things) actually being good rather than barely un-crappy?
14:11 arnsholt And feels quite familiar, to a Scandinavian =)
14:12 mst pmurias: that's hair splitting, really
14:12 smls joined #perl6
14:12 mst I mean, sure, if you don't want to be mean, then you can set the bar for 'crap' low enough that's true
14:13 mst but the whole point of LTA is *it* is the nice version
14:13 mst once you de-nice it, 'barely un-crappy' can be better written as 'crap', and what a nice person would call 'crap' can be written as '-ing terrible'
14:13 mst which is basically the entire point I was making :)
14:23 smls How can I make an IO::Socket::Async server not die with "Unhandled exception: Malformed UTF-8" when a client sends it an invalid byte?
14:23 lucar2 joined #perl6
14:24 smls I tried adding a CATCH to every block, but the exception eludes them... :P
14:30 smls see https://gist.github.com/smls/eb​d59307cb913777d1383708e4358625
14:31 andrzejku joined #perl6
14:38 moritz smls: use it binary mode?
14:38 smls Too cumbersome
14:38 pmurias mst: what I meant is that LTA is often used when a error message that would be acceptable in some other communities can be turned into something awesome
14:39 smls moritz: I don't actually want to do anything with binary data, I just don't want any client to be able to crash the server at will
14:39 mst pmurias: yes, and once you de-nice it, that means "raising the level below which it's considered crap"
14:39 moritz smls: have you tried a try?
14:40 mst pmurias: again, the different conceptualisations are -exactly- that I'm looking at here # http://trout.me.uk/you.jpg
14:40 moritz or isn't there a way to give a supply an error callback?
14:41 smls moritz: 'try' doesn't seem to help
14:43 smls and no error handling mechanism seems to be documented in https://docs.perl6.org/type/IO::Socket::Async
14:49 smls Tried replacing  «whenever $conn.Supply»  with  «$conn.Supply.tap: ..., quit => { .say }»  but that doesn't change anything.
14:49 harmil joined #perl6
14:55 RabidGravy can't you set an unhandled exception handler on the scheduler?
14:56 smls Where do I get IO::Socket::Async's scheduler from?
14:57 RabidGravy by default it's $*SCHEDULER I think ?
14:58 harmil Man, some days you just can't win. Tried to post a little tutorial on defining operators on reddit... end up with someone flaming me over module naming :-( I still think it's important to keep the /r/perl6 active, but man it's draining!
14:59 harmil On another topic, I was playing with introspection and automatic signature documentation yesterday, and I found something odd that I don't understand...
14:59 RabidGravy flamers gonna flame
15:01 DrForr Open source: biting the hand that feeds it for 20 years.
15:02 smls RabidGravy: «$*SCHEDULER.uncaught_handler = { .say }»  at the beginning of the program, doesn't help.
15:02 harmil m: class Foo { method bar() {} }; say Foo.^methods.map: {"{.name}={.WHAT.perl}"}
15:02 camelia rakudo-moar 146e18: OUTPUT«(bar=Method)␤»
15:02 harmil That makes sense to me...
15:02 harmil m: class Foo { method bar() {} }; say Foo.^methods>>.WHAT
15:02 camelia rakudo-moar 146e18: OUTPUT«(List)␤»
15:03 harmil That doesn't. Am I missing something?
15:03 smls harmil: .WHAT doesn't work with hyper operators
15:03 harmil AH
15:03 harmil smls: thanks
15:03 smls because .WHAT is not actually a method, it's special syntax that pretends to be one... :P
15:04 smls Maybe it could be made to work with hypers, but so far that hasn't been done
15:05 smls I suppose it should at least be made an error, though...
15:07 harmil In this  case, I'm getting sensible info:
15:07 harmil m: class Foo { method bar() returns Str:D {} }; say Foo.^methods.map: {"{.name}={.WHAT.perl}, returns {.returns.perl}
15:07 camelia rakudo-moar 146e18: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Unable to parse expression in double quotes; couldn't find final '"' ␤at <tmp>:1␤------> 3e}={.WHAT.perl}, returns {.returns.perl}7⏏5<EOL>␤»
15:07 harmil Opps...
15:07 harmil m: class Foo { method bar() returns Str:D {} }; say Foo.^methods.map: {"{.name}={.WHAT.perl}, returns {.returns.perl}"}
15:07 camelia rakudo-moar 146e18: OUTPUT«(bar=Method+{Callable[Str:D]}, returns Str:D)␤»
15:08 harmil Okay, so that Method+... is there a way to programatically ask for just the non-addition part. In other words, I want something that will Str as "Method".
15:08 smls .^name
15:08 smls I guess
15:08 harmil Also on the Str:D... that type has a "definedness" requirement. Is there a way I can ask for the type and the requirement as separate, testable attributes?
15:09 harmil m: class Foo { method bar() returns Str:D {} }; say Foo.^methods.map: {"{.name}={.WHAT.name}, returns {.returns.perl}"}
15:09 camelia rakudo-moar 146e18: OUTPUT«Cannot look up attributes in a type object␤  in block  at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
15:09 smls hm no, I guess .^name also includes the stuff after the +
15:10 harmil If I have to go scrounging in its inheritance, I can... was just hoping there was a way to ask the simple question directly.
15:10 ugexe i dont even understand your question
15:12 harmil ugexe: I'm asking, given a type that's "Method+{Callable[Str:D]}" I want to know what expression I can apply to that type which will tell me that in essence, it's "Method".
15:12 smls m: my method bar() returns Str {};  say &bar.^name;
15:12 camelia rakudo-moar 146e18: OUTPUT«Method+{Callable[Str]}␤»
15:12 smls m: my method bar(--> Str) {};  say &bar.^name;
15:12 camelia rakudo-moar 146e18: OUTPUT«Method␤»
15:13 harmil Uh... am I misunderstanding what "returns" is for or does that not make any sense?
15:13 smls harmil: Seems weird to me too
15:13 smls A leaking implementation detail maybe?
15:13 harmil methinks
15:14 ugexe there are odd differences between (--> RetType) and returns RetType that shouldnt exist
15:15 ugexe https://github.com/rakudo/rakudo/pull/798
15:15 smls harmil: As a work-around, you can use  .^name.split("+")[0]  I suppose...
15:15 ugexe see the last comment
15:15 smls or  .^name.match(/<-[+]>+/).Str
15:16 harmil Should I rakudobug that?
15:16 sena_kun joined #perl6
15:18 harmil smls: Yeah, text manipulation is definitely doable. I was just seeing if there was a more type-friendly way.
15:18 harmil Looks like no
15:19 smls Yeah, probably good to rakudobug it
15:19 ugexe is .^methods ever *not* going to return something that is /^Method+/ ? Seems implied otherwise
15:20 smls ugexe: Look at the Grammar class, you'll get some NQPRoutine's instead of Method's... :)
15:21 ugexe NQPRoutine is always ruining my fun
15:21 smls see RT #125518
15:21 synopsebot6 Link:  https://rt.perl.org/rt3//Publ​ic/Bug/Display.html?id=125518
15:25 dalek doc: 631c34f | Altai-man++ | htmlify.p6:
15:25 dalek doc: Fix for the fall-out of https://github.com/perl6/doc/pull/632
15:25 dalek doc: review: https://github.com/perl6/doc/commit/631c34feb9
15:26 sena_kun .tell AlexDaniel you can re-run checklink because of https://github.com/perl6/doc/commit/63​1c34feb99f1e49a86cc5282dcc1439aff62f0f - the output should be much better.
15:26 harmil The other item is this one:
15:26 yoleaux sena_kun: I'll pass your message to AlexDaniel.
15:26 harmil m: sub foo() returns Str:D {}; say &foo.signature.returns.^name
15:26 camelia rakudo-moar 146e18: OUTPUT«Str:D␤»
15:27 harmil This is another case where I could regex match the :D, but I'd like to just ask the type if it's definite. Can I do that?
15:28 geekosaur m: my $s; say so $s.DEFINITE
15:28 camelia rakudo-moar 146e18: OUTPUT«False␤»
15:28 telex joined #perl6
15:28 harmil geekosaur: ah, I had not tried all caps, thanks
15:28 geekosaur or maybe you want .defined, there are slight differences
15:28 nowan joined #perl6
15:29 harmil Hmm... nope, DEFINITE and defined are both false
15:29 harmil m: sub foo() returns Str:D {}; say &foo.signature.returns.DEFINITE
15:29 camelia rakudo-moar 146e18: OUTPUT«False␤»
15:29 harmil m: sub foo() returns Str:D {}; say &foo.signature.returns.defined
15:29 camelia rakudo-moar 146e18: OUTPUT«False␤»
15:29 geekosaur oh, the type not a value
15:29 harmil Right
15:32 arnsholt unmatched}: What do you mean "watch our editor grind to a stuttering halt"? Vim handles it fine =p
15:32 llfourn m: sub foo() returns Str:D {}; say &foo.signature.returns.HOW.^name
15:32 camelia rakudo-moar 146e18: OUTPUT«Perl6::Metamodel::DefiniteHOW␤»
15:32 llfourn m: sub foo() returns Str:D {}; say &foo.signature.returns ~~ Metamodel::DefiniteHOW
15:32 camelia rakudo-moar 146e18: OUTPUT«False␤»
15:33 llfourn m: sub foo() returns Str:D {}; say &foo.signature.returns.HOW ~~ Metamodel::DefiniteHOW
15:33 camelia rakudo-moar 146e18: OUTPUT«True␤»
15:33 geekosaur you can also smartmatch it against a type object
15:40 mcmillhj joined #perl6
15:41 brrt joined #perl6
15:42 harmil geekosaur: thanks for the tip. Seems shocking that there's no convenient way to do that (e.g. a method)
15:46 heatsink joined #perl6
15:52 moritz m: sub foo() returns Str:D {}; say &foo.signature.returns.^name
15:52 camelia rakudo-moar 146e18: OUTPUT«Str:D␤»
15:52 moritz m: sub foo() returns Str:D {}; say &foo.signature.returns.HOW.^name
15:52 camelia rakudo-moar 146e18: OUTPUT«Perl6::Metamodel::DefiniteHOW␤»
15:54 mcmillhj joined #perl6
16:00 BenGoldberg joined #perl6
16:00 Some-body_ joined #perl6
16:13 mcmillhj joined #perl6
16:17 Xliff So LTA == Less Than Awesome
16:17 Xliff Wow! Learn something new every day.
16:17 timotimo check out the whole os S99
16:18 timotimo i.e. read S99:everything
16:18 synopsebot6 Link: http://design.perl6.org/S99.html#everything
16:18 Xliff Soooo....
16:18 Xliff If I have a C routine that takes a pointer to an int32, but also allows null.... how would I define that?
16:19 Xliff sub thisTakesIntPtr(int32) returns int32 is native('bleah')
16:19 Xliff That won't work.
16:19 andrzejku joined #perl6
16:19 timotimo yeah, you'd define it as taking Pointer[int32]
16:19 Xliff Ahh...
16:20 Xliff And then passing NULL would be "thistakesIntPtr(Pointer)"?
16:20 Xliff Or
16:20 Xliff And then passing NULL would be "thistakesIntPtr(Pointer[int32])"?
16:20 timotimo probably the latter
16:20 Xliff kk
16:20 Xliff timotimo++
16:20 timotimo BBL
16:20 Xliff (timo++) x 2?
16:21 Xliff But that would be (timo++)(timo++) which isn't arithmatically correct...
16:21 Xliff BUT would it be equivalent to (timotimo++)++ ???
16:21 Xliff =)
16:22 * Xliff goes and sits in a corner.
16:29 mcmillhj joined #perl6
16:41 khw joined #perl6
16:45 mcmillhj joined #perl6
16:50 stmuk joined #perl6
16:55 sena_kun joined #perl6
16:57 andrzejku hello
16:57 smls Hi
16:59 timotimo greetings
17:01 brrt joined #perl6
17:01 andrzejku I am looking for Perl friend
17:04 mcmillhj joined #perl6
17:08 * smls just added http://rosettacode.org/wiki/Chat_server#Perl_6 - please review!
17:11 timotimo i think you should be able to specify an encoding for the connection; utf8-c8 will get you exception-free
17:12 smls Specify how?
17:12 smls $conn.Supply(:enc<utf8-c8>).lines   doesn't help
17:13 timotimo is that the right place?
17:13 smls no idea
17:13 timotimo right, the docs don't say anything about support for that
17:14 smls yeah
17:15 timotimo nqp::asyncreadchars would have to learn about an encoding flag you could pass to it
17:16 smls timotimo: Maybe utf8-c8 should even be the default?
17:16 timotimo don't know
17:16 sena_kun smls, you need to just catch an exception, isn't you? try/catch, you know. Did't read your example properly, though.
17:17 timotimo it isn't that easy, sena_kun
17:17 timotimo smls doesn't control the dynamic environment where the code runs
17:17 timotimo hm, actually
17:17 sena_kun timotimo, ah, then sorry.
17:17 smls sena_kun: Tried that, but is seems uncatchable: http://irclog.perlgeek.de/p​erl6/2016-08-06#i_12977698
17:17 timotimo it's an async thing, so what is the dynamic environment? i suppose it's on the event-loop thread
17:18 timotimo what you can do, however, is give the Supply a custom $*SCHEDULER that has a different unhandled-exception-callable
17:18 timotimo but that seems pretty terrible :)
17:18 mcmillhj joined #perl6
17:18 sena_kun Async exceptions are a land of pain.
17:19 timotimo i'd like someone to file a bug about encoding errors not being catchable from IO::Socket::Async's Supplies. supplies in general already have an error signalling mechanism, but i'm not sure about recovering from that
17:20 smls ok, I'll RT it
17:20 timotimo thank you
17:20 timotimo another ticket should be allowing an encoding to be set for the non-binary cases of that Supply method, too
17:21 smls yeah, if it accepts :bin it could also accept :enc, just like open() and friends.
17:22 timotimo yup
17:22 timotimo maybe someone wants to do a quick scan over the core setting for other cases where we've missed that
17:28 timotimo from what i understand, your code should be thread-safe
17:30 timotimo wow, cool, mozilla gave USD200,000 to the pypy project
17:31 mcmillhj joined #perl6
17:32 smls timotimo: Can any 'whenever' only be entered by one thread at the same time, or only of it is inside a 'react', ot only if it is *top-lvel* inside a 'react'?
17:32 timotimo whenever is - more or less - just sugar for a tap, really
17:33 smls but isn't .act the one that prevents multiple threads from entering at the same time?
17:33 timotimo hmm.
17:33 timotimo i'm not clear on the details, sorry. i haven't really used react/whenever yet
17:33 timotimo a shame, really
17:33 smls I'm in the same boat
17:39 lichtkind joined #perl6
17:48 mcmillhj joined #perl6
17:56 lambd0x joined #perl6
17:58 kaid joined #perl6
17:58 lambd0x Hi everyone! Can someone help me? I'm having a problem understanding why my code is failing to result true (I'm working with an array of hashes), please see my code:  http://bpaste.net/show/43cd922906ef
18:01 geekosaur unless $word eq any(@hash) # this assumes your array elements are only the words, not Pairs
18:02 geekosaur and that's not an array of hashes, it's an array of Pairs, meaning what you're trying to write is just a slower reimplementation of a hash using an array
18:04 mcmillhj joined #perl6
18:05 jnthn smls, timotimo: The concurrency control is associated with the supply/react block (more precisely, with each tapping of it). So if you have multiple whenevers inside of a suppy/react, you can be confident that any lexicals declared inside of the supply/react block will be safe (because you get a fresh set of variables per tapping).
18:06 jnthn And yes, this includes whenevers nested within whenevers.
18:06 movl joined #perl6
18:06 smls Neat, so I guess my code may actually be thread-safe :)
18:08 timotimo cool
18:09 jnthn supply/react blocks really give you 3 things: concurrency control, subscription management, and sugar.
18:10 timotimo right, supplies most importantly don't introduce more concurrenly, unless you specifically ask for it
18:12 jnthn On encodings with async stuff: yeah, it needs sorting out. :( Been pondering exactly how to deal with that for a while. I think we should probably have the async at the VM level work in bytes only, and provide a nice streaming decode API (VM-backed - actually using the DecodeStream stuff) so have a thingy you can just shove bytes into and grab chars out of
18:12 jnthn (The Perl 6 user-level API would stay just the same, this is just about how we'd implement it)
18:13 movl joined #perl6
18:13 lambd0x geekosaur: Ok, I wanted in the if statement just to compare keys really and how is the right way of creation an array of hashes?
18:13 lambd0x *creating
18:14 timotimo yes, i've considered making the streaming decoding available via nqp::, too
18:15 jnthn Guess I might take it on while I'm doing other concurrency improvements. :)
18:15 jnthn At the moment mostly been bug-squishing though
18:16 timotimo that is also much appreciated :)
18:18 jdv79 timotimo: i think i caught enc exceptions with sock async.  not sure where the code is...
18:19 movl joined #perl6
18:19 jdv79 looks like i threw the Supply into bin mode and just caught it
18:20 mcmillhj joined #perl6
18:21 jdv79 smls: https://gist.github.com/anonymous​/fd052bd9d0c289f127d77d6826b90452
18:22 timotimo right, you'd have to do it yourself in that case
18:22 timotimo sadly it doesn't do "lines" for you in that case
18:22 timotimo because we don't offer a streaming encoder/decoder yet
18:24 jdv79 yeah.  i got lazy cause that just works for now in that use cae
18:24 jdv79 *case
18:24 abruanese joined #perl6
18:25 timotimo fair enough :)
18:25 kid51 joined #perl6
18:25 autarch joined #perl6
18:36 andrzejku joined #perl6
18:48 edehont joined #perl6
18:54 firstdayonthejob joined #perl6
18:57 labster joined #perl6
18:57 AlexDaniel joined #perl6
19:02 AlexDaniel .
19:02 yoleaux 15:26Z <sena_kun> AlexDaniel: you can re-run checklink because of https://github.com/perl6/doc/commit/63​1c34feb99f1e49a86cc5282dcc1439aff62f0f - the output should be much better.
19:03 AlexDaniel sena_kun++ # OK!
19:07 AlexDaniel “I am looking for Perl friend” and nobody answered! How … unfriendly ;)
19:09 mcmillhj joined #perl6
19:11 sena_kun AlexDaniel, topic of "friends" is too hard, I suppose. The society situation is: you cannot just say "Okay, I'm your friend" and go with it. It takes years of everyday conversations.
19:11 AlexDaniel right
19:11 itaipu joined #perl6
19:12 timotimo i've been approached in the past by at least two people who were apparently used to becoming instant friends with internet strangers
19:12 timotimo it was a strange experience for me, i must admit
19:23 TimToady AlexDaniel: we've already had this conversation, see http://irclog.perlgeek.de/p​erl6/2016-08-02#i_12956402
19:24 AlexDaniel ah ok :D
19:28 movl joined #perl6
19:37 domidumont joined #perl6
19:37 mcmillhj joined #perl6
19:43 domidumont1 joined #perl6
19:44 AlexDaniel joined #perl6
19:52 canopus joined #perl6
19:55 zakharyas joined #perl6
20:03 TEttinger joined #perl6
20:07 rpburkholder joined #perl6
20:11 AlexDaniel sena_kun: https://github.com/perl6/doc/issues/561
20:11 AlexDaniel \o/
20:11 mcmillhj joined #perl6
20:16 sena_kun AlexDaniel, 8.5~ thousand were fixed by one line change, it's good.
20:21 sena_kun AlexDaniel, it seems I have some bad news. The work-around we merged now pulls yet another change in the links generation scheme. It's not good. We need to investigate it further, I suppose.
20:23 sena_kun AlexDaniel, do we have some policy/standart where linking scheme was discussed or it's the site-oriented problem?
20:26 Ben_Goldberg joined #perl6
20:39 AlexDaniel sena_kun: I don't know
20:39 AlexDaniel sena_kun: I've never seen it
20:40 sena_kun AlexDaniel, the thing is, you know.
20:41 AlexDaniel do I? :)
20:43 sena_kun If it's "in-house" thing, then we can resolve it in two ways: we can change generation process of all the docs internal links so they'll become consistent. We can revert this work-around and change Pod::To::Html in a way that double-links will be separated with something like number(now they're differentiated by type, obviously). But if it's a "Pod thing", not just the site link scheme, we need to ask guys who are responsible for a pod
20:43 sena_kun internal links about how we can solve this problem.
20:43 mcmillhj joined #perl6
20:44 moritz m: say [] ~~ Poitional:D
20:44 camelia rakudo-moar c1fdcb: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Undeclared name:␤    Poitional:D used at line 1. Did you mean 'Positional'?␤␤»
20:44 moritz m: say [] ~~ Positional:D
20:44 camelia rakudo-moar c1fdcb: OUTPUT«True␤»
20:44 moritz m: say [] ~~ Positional:U
20:44 camelia rakudo-moar c1fdcb: OUTPUT«False␤»
20:49 sena_kun AlexDaniel, personally, I'd want to ask an authors of the original htmlify.p6 and, probably, Pod::To::Html about their thoughts on this problem. TL;DR: this "duplicated id's" problem is not easy. It's more a design issue, than actual bug.
20:50 moritz as the original author of htmlify.p6, my thoughts were "this is a hard problem, let's defer this to get anything done"
20:50 AlexDaniel sena_kun: perhaps it is a good idea to create a new issue?
20:51 moritz with the slight hope that the Pod::To::Html maintainers would eventually come up with a good solution
20:51 andrzejku joined #perl6
20:52 sena_kun moritz, we need some differentiation. Type is a good one, but I'm not really sure should we change all our site scheme to this? It seems like a somewhat dirty practice. Or it's just me. Thanks for your reply, though.
20:53 moritz sena_kun: my idea was more to simply add a counter
20:54 moritz so if there are two headings Foo, the first one gets id="Foo", the second one gets id="Foo__2"
20:54 lambd0x Folks, I'm starting to learn how to deal with hash and don't know if I'm doing something wrong or else, but both conditions which are opposites returns True in my code: http://bpaste.net/show/b43be562969b
20:54 moritz that's something that would work in Pod::To::Html independentl of htmlify
20:54 sena_kun AlexDaniel, we already have an old one, I don't think we need one another. And lately we have a bit too much issues opened. It's my weekend today and I want to just sit and relax, but tomorrow I'll look into this, of course.
20:55 AlexDaniel sena_kun: sure
20:55 moritz lambd0x: if you want to check if a key is already in a hash, use %hash{$key}:exists
20:56 moritz $word eq any(%hash.keys); is linear runtime, whereas %hash{$word}:exists is constant
20:56 sena_kun moritz, it's a good idea(with counters), I mentioned it previously. I can look into it, does this counter fix go to htmlify or pod::to::html?
20:56 moritz sena_kun: Pod::To::Html
20:57 sena_kun moritz, thanks.
20:57 lambd0x moritz: thank you
20:58 moritz lambd0x, sena_kun: you're welcome
20:59 mcmillhj joined #perl6
21:01 timotimo sena_kun: thank you for your efforts btw :)
21:01 sena_kun Our next goal with the checklink output is to solve https://github.com/perl6/Pod-To-HTML/issues/14 with, most likely, counters. Probably, I'm done for today. I'm still here and can reply, but will be somewhat busy and not so quick.
21:02 sena_kun timotimo, perl6 users are welcome. (:
21:02 timotimo \o/
21:03 moritz wow, my first rakudo patch in a long time, and the setting still compiles
21:03 moritz sadly, "use Test" blows up :/
21:03 timotimo oh!
21:03 timotimo what are you working on, moritz? :)
21:04 moritz timotimo: I want to make sigil-implied types definite
21:04 moritz timotimo: so @ -> Positional:D instead of Positional
21:04 moritz (would need to be guarded by language version)
21:04 dalek doc: fbe8525 | Altai-man++ | / (18 files):
21:04 dalek doc: This commit adds new pod config option: 'signature', and adapts current type documentation to it's usage instead of brackets addition.
21:04 dalek doc: See https://github.com/perl6/doc/is​sues/794#issuecomment-237981574
21:04 dalek doc: review: https://github.com/perl6/doc/commit/fbe852570c
21:04 dalek doc: ab1f2b0 | (Wenzel P. P. Peppmeyer)++ | / (18 files):
21:04 dalek doc: Merge pull request #814 from perl6/signature-test-option
21:04 dalek doc:
21:04 dalek doc: New pod config option: 'signature'
21:04 dalek doc: review: https://github.com/perl6/doc/commit/ab1f2b0f58
21:04 moritz but first i just want to experiment with how easy it is to do, and hwo much damage, if any, it causes
21:05 timotimo i've tried that in the past, too! :)
21:05 moritz Type check failed in binding to &by; expected type Callable:D cannot be itself
21:05 timotimo did you make sure to not put a :D on nameds?
21:05 timotimo because those are actually optional :)
21:07 gfldex .
21:07 yoleaux 02:36Z <AlexDaniel> gfldex: see http://irclog.perlgeek.de/p​erl6/2016-08-06#i_12976146 and the discussion that follows. Perhaps you'll have an idea on how we can improve the docs to make it less WATy
21:07 moritz I didn't :/
21:07 moritz timotimo: seems you got further than me so far. What were your experiences?
21:07 moritz beside the named thingy :-)
21:10 moritz m: say Positional:D[Int]
21:10 camelia rakudo-moar c1fdcb: OUTPUT«(Positional:D)␤»
21:10 moritz m: say Array[Int].new(1) ~~ Positional:D[Int]
21:10 camelia rakudo-moar c1fdcb: OUTPUT«True␤»
21:10 moritz wow, I didn't quite realize how generic that mechanism was :-)
21:10 sufrostico joined #perl6
21:12 timotimo i tried it, the spec tests blew up, i stopped trying it
21:12 moritz oh, I also shouldn't apply it to optional stuff :-)
21:14 BananaMagician joined #perl6
21:15 timotimo oh, yes :D
21:19 gfldex sena_kun: the problem with addint a counter to disambiguate headings is that reordering sections in a .pod6 may break links or even mix links up. So we end up with a link that works (as seen by automatic tools) but points to the wrong thing.
21:20 moritz timotimo: do you still have your patch somewhere?
21:21 moritz gfldex: I don't think it's a big problem. Duplicate IDs usually come from "=head2 method foo" that's both in a class in a class it inherits from
21:21 gfldex sena_kun: the inherent problem is that a anchor is derived from the heading automatically without giving the pod-author a chance to intervene. A better solution would be an option on the heading or to check if a X<> is embeded in the heading.
21:21 moritz gfldex: and those methods from inherited classes are listed in most-specific-first order
21:21 timotimo moritz: let me look
21:22 timotimo i've called it definedness_for_hash_and_arr_sigil
21:22 moritz gfldex: so you tend to automatically link to the most specific one, which is usually what you want
21:22 moritz timotimo: ah, thanks
21:22 moritz timotimo: any specific reason you didn't include & in the mix?
21:23 timotimo https://gist.github.com/timo/30​6af382ad5a1f8b66adcee47abf12d9
21:23 timotimo no clue
21:25 moritz timotimo: ok, thanks
21:25 moritz my approach was to call create_definite_type in method typename in Actions
21:26 moritz but that's too early, because the ? modifier that makes params optional comes after that
21:27 BananaMagician joined #perl6
21:32 moritz timotimo: so far, I get remarkably few spectest failures with your patch
21:32 moritz (now at S15, and only one test file failed so far)
21:34 moritz anyway, will look at it more tomorrow
21:34 moritz timotimo++
21:34 moritz will have to quizz jnthn++ on how to do language-version specific behavior
21:36 kerframil joined #perl6
21:36 timotimo push your stuff already, maybe? :)
21:42 sena_kun gfldex, I didn't get it a bit. We have duplicate ids only on `routine/foo`-like pages and they are generated automatically every time. How reordering of sections can broke them? On normal pages we don't have duplicate ids afaik. Am I wrong?
21:48 gfldex sena_kun: they are automatically generated and that means when we try to change stuff we may break links that are used by hand. It may be better to use the source .pod6 as an extension to the anchor instead of a number. The .pod6 file names are unique.
21:51 sena_kun gfldex, it's almost the same as the type name, isn't it? The only thing to do is to move type/name adding from htmlify to pod;;to;;html and make it "official".
21:52 zacts joined #perl6
21:52 sena_kun gfldex, yes, you're totally right about hand-written links, I've forgotten about them already. Types/names are surely better for this purpose.
21:53 gfldex sena_kun: Pod::To::BigPage used counters a lot and I painted myself into a corner with them. Had to change some of them and using using the source filename worked well.
21:54 sena_kun gfldex, looks like a great solution then.
21:54 sena_kun gfldex, thanks for your advice.
21:56 mavorg joined #perl6
22:07 cog_ joined #perl6
22:12 mcmillhj joined #perl6
22:23 canopus joined #perl6
22:35 pierrot joined #perl6
22:42 BananaMagician joined #perl6
23:07 lambd0x Ohhh I was having an odd error in my code that was kicking me for about an hour or so... in repr discovered shape is not implemented... :(
23:07 timotimo it's partially implemented
23:07 timotimo what exactly are you missing?
23:08 lambd0x m: for 1,3...20 -> $value { $value++; say $value; }
23:08 camelia rakudo-moar 0de139: OUTPUT«Cannot resolve caller postfix:<++>(Int); none of these signatures match:␤    (Mu:D $a is rw)␤    (Mu:U $a is rw)␤    (Int:D $a is rw)␤    (int $a is rw)␤    (Bool:U $a is rw)␤    (Bool:D $a is rw)␤    (Num:D $a is rw)␤    (Num:U $a is rw)…»
23:08 timotimo ah
23:08 lambd0x timotimo: like this ahahha
23:08 timotimo well, you can't do that, because the $value isn't writable
23:08 timotimo m: for 1, 3 ... 20 -> $value is copy { $value++; say $value }
23:08 camelia rakudo-moar 0de139: OUTPUT«2␤4␤6␤8␤10␤12␤14␤16␤18␤20␤»
23:08 lambd0x hum... but shouldn't the compiler tell it then?
23:08 timotimo when you ask for a copy, you'll get something writable
23:09 timotimo yeah, the compiler should see that there's only candidates with "is rw" and complain about that in more detail ... perhaps
23:09 lambd0x because in the middle of the code it nor said it was readonly nor said something related to shape not implemented
23:09 timotimo that has nothing to do with shape
23:10 lambd0x timotimo: hm...
23:10 lambd0x timotimo: you see my confusion for this exatcly error was hapenning and repr told me about shape in my compiler...
23:11 lambd0x but anyway
23:11 lambd0x I can therefore solve this marking "$value is copy" right?
23:11 lambd0x m: for 1,3...20 -> $value is copy { $value++; say $value; }
23:11 camelia rakudo-moar 0de139: OUTPUT«2␤4␤6␤8␤10␤12␤14␤16␤18␤20␤»
23:12 timotimo that's a way to make it work, yes
23:12 lambd0x yeah \o/
23:12 timotimo please paste the exact code and error output that mentions something with shape
23:12 timotimo i am now interested. you cannot get away from me >:)
23:14 lambd0x timotimo: timotimo just a minute please :P
23:14 timotimo but don't just paste it into the irc :)
23:15 timotimo gist or something please :)
23:16 lambd0x timotimo: was trying... but how to pastebin from repr?
23:16 lambd0x haha
23:17 lambd0x another thing if I put that same code in a script it gives another error, nothing related to shape, but in repr it does...
23:17 margeas joined #perl6
23:17 timotimo what are you on, windows?
23:18 lambd0x look:http://bpaste.net/show/c7f1db406810
23:18 lambd0x Linux
23:18 timotimo just select all of it, right-click "copy", go to pastebin, paste
23:19 timotimo i don't understand why it'd be different for the repl compared to any other console thing
23:19 lambd0x timotimo: ah, usually I do everything from bash itself..
23:20 timotimo ah, well, copying/pasting is a function of the terminal emulator, not the programs in it
23:20 timotimo because you want both the input and the output
23:22 lambd0x http://pastebin.com/i8eB8nEU
23:22 timotimo you forgot a space there
23:22 timotimo m: -> $foo{1,2,3} { say "test" }
23:22 camelia rakudo-moar 0de139: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Shape declaration is not yet implemented; please use whitespace if you meant something else␤at <tmp>:1␤------> 3-> $foo7⏏5{1,2,3} { say "test" }␤    expecting any of:␤        shape declaration␤»
23:22 lambd0x timotimo: hm.. ahaha
23:23 timotimo m: -> $foo {1,2,3} { say "test" }
23:23 camelia rakudo-moar 0de139: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Unexpected block in infix position (missing statement control word before the expression?)␤at <tmp>:1␤------> 3-> $foo {1,2,3}7⏏5 { say "test" }␤    expecting any of:␤        infix␤        in…»
23:23 timotimo did you see the "please use whitespace if you meant something else"
23:23 timotimo and the eject sign is exactly between $foo and {1, 2, 3}
23:23 lambd0x forget about then, sorry for worrying you
23:24 lambd0x :P
23:24 timotimo i can't imagine how the error message could be made better here :)
23:24 lambd0x maybe, "put a space there man!"
23:24 lambd0x ahahah
23:26 lambd0x timotimo: I'm just starting to code more in perl6 so I think it's just a common mistake new learners will do when using loops and for statements with {..}
23:26 timotimo we've wondered about making a module that makes error messages ... let's say "less polite" :)
23:26 lambd0x timotimo: but I seriously think the messages are ok really.
23:27 lambd0x timotimo: that would be fun
23:27 timotimo OK :)
23:28 rall joined #perl6
23:28 lambd0x timotimo: you see, I've starting to just try coding in perl6 about three days ago and I consider that I've learned a lot thus far.
23:28 timotimo oh, ok!
23:28 timotimo that's cool :)
23:29 lambd0x yeah ;)
23:29 lambd0x here we can count on people really and the language itself if simple (so far for what I've tried)
23:30 timotimo hm
23:30 timotimo simple? maybe ... it's definitely well put-together to make learning it easier
23:30 timotimo so many places where there's no "special case" you have to learn
23:30 timotimo because everything is re-used all over the place :)
23:30 lambd0x I came from C programming...might be because of this I think perl6 sintax is simpler hahaha
23:30 timotimo signatures, for example. they really appear everywhere
23:31 lambd0x timotimo: I see.
23:32 timotimo and Smart Matching
23:34 lambd0x timotimo: why is that is better "if @var2[$var1]:exists" instead of "if $var1 eq any(@var2)" ?
23:34 timotimo it's two entirely different things
23:34 lambd0x timotimo: ok
23:34 AlexDaniel lambd0x: wow, well… because it is much faster
23:34 timotimo @var2[$var1]:exists tells you if at position $var1 there's something in @var2
23:34 AlexDaniel ah no, that's not a hash
23:35 AlexDaniel ignore my message
23:35 timotimo and the eq any(@var2) is "is any value inside @var2 string-equal to $var1?"
23:35 lambd0x what?
23:35 lambd0x ahah
23:35 timotimo like "is slot 10 occupied in this array?" vs "is there a '10' in this array?"
23:35 lambd0x AlexDaniel: ok :)
23:35 lambd0x timotimo: I see
23:36 lambd0x timotimo: that's so nice we have this operator \o/
23:36 mcmillhj joined #perl6
23:36 lambd0x timotimo: simplified my code a bit (probably speeding it up a bit too)
23:36 timotimo in general, we differentiate between positional access, i.e. @blah[$foo], and associative access, i.e. %blah{$foo}
23:37 timotimo better have tests to make sure it's not only faster, but also "not less correct" ;)
23:37 AlexDaniel lambd0x: I was thinking about one of your first pastes :) and now I looked at it again and saw this: “my @hash;” – heh…
23:37 lambd0x AlexDaniel: learned my lession there, friend. ahaha
23:38 lambd0x AlexDaniel: I thought that was how an array of hashes where declared
23:38 lambd0x ahah
23:38 lambd0x *were
23:39 lambd0x *was... and also read perl.org for some literature
23:39 lambd0x it helped me out a lot
23:40 aries_liuxueyang joined #perl6
23:40 rall left #perl6
23:40 timotimo huh, perl.org?
23:40 AlexDaniel interestingly, you can use $ sometimes and it works just fine
23:41 AlexDaniel m: my $arr = [1, 2, 3, 4]; say $arr.grep(* %% 2)
23:41 camelia rakudo-moar 0de139: OUTPUT«(2 4)␤»
23:41 lambd0x timotimo: perl6.org (think about the hidden 6 there haahha)
23:41 AlexDaniel m: my @arr = [1, 2, 3, 4]; say @arr.grep(* %% 2)
23:41 camelia rakudo-moar 0de139: OUTPUT«(2 4)␤»
23:41 AlexDaniel it is not as convenient, but still worth mentioning :)
23:42 timotimo ah
23:42 lambd0x AlexDaniel: think perl5 users will like knowing that ;)
23:42 timotimo yeah, when perl6 thinks you have a @-sigiled thing on the LHS of a =, it'll become a list-assignment
23:42 timotimo something that i'm not 100% happy about
23:43 lambd0x timotimo: do you think there is a better way to handle it all?
23:44 AlexDaniel m: my @arr = [1, 2, 3, 4],; say @arr.grep(* %% 2) # is that what you want instead?
23:44 camelia rakudo-moar 0de139: OUTPUT«([1 2 3 4])␤»
23:44 lambd0x timotimo: or for now it's ok...
23:45 lambd0x well, thank you all for solving my doubts :)
23:46 timotimo i think it's all right, the list-assignment thing
23:46 timotimo as always, it's a trade-off. but i think this one was well-chosen. it's just an icky situation in general
23:47 lambd0x timotimo: sweet.
23:49 mcmillhj joined #perl6
23:50 lambd0x man I had so much trouble undestanding hash uses.. but finally managed to create an interesting code \o/ : http://bpaste.net/show/35b17143f4e8
23:51 lambd0x receives integers and count the amount of each typed by the user :)
23:51 timotimo yeah, you're not used to having hashes when you come from C :P
23:52 timotimo that's ... weird code
23:52 lambd0x timotimo: indeed.
23:52 lambd0x timotimo: why...is it bad coded?
23:52 timotimo i don't get why you have the if %hash{$word}:exists twice?
23:53 lambd0x ah I wanted to get conditions separated...
23:53 lambd0x unless if like !if
23:53 timotimo no, i mean in the first line
23:54 timotimo another few things
23:55 lambd0x timotimo: ah, I was trying to get the result of that very expression from a for statement that would iterate that very case, but couldn't get right how to get $keys and $values too.
23:55 timotimo you don't get a lot of mileage out of the :kv, because the key is always going to be the value you put in via $word
23:55 timotimo i also don't understand why you iterate there at all
23:55 timotimo like, how would you expect the hash to store more than one thing under one key? :)
23:55 sena_kun lambd0x, hashes are just maps. Or dictionaries. I'm not sure about C, but C++ has template-based map type included.
23:56 lambd0x timotimo: hm, I though each position stored a pair (key, value) and had to iterate until I find the one I wished to...
23:56 lambd0x that's why I did it...
23:57 lambd0x *thought.
23:57 sena_kun Perl6intro and article on learnxinyminutes are good to read first.
23:57 timotimo nope :)
23:57 gfldex m: my %seen; for $*IN.words { %seen{.Str}++ }; %seen.sort({$^a.value < $^b.value}).say
23:57 camelia rakudo-moar 0de139: OUTPUT«(mo => 9 a => 8 le => 5 is => 5 ag => 4 an => 4 Ghaoth => 4 ghlas’ => 3 go => 3 gach => 3 Dobhair. => 3 na => 3 Dhún => 3 i => 3 slán => 3 gan => 3 ar => 2 bhí => 2 gleanntáin => 2 beag => 2 dom => 2 nGall => 2 mise => 2 nár => 2 ’s => 2 ina => 2 …»
23:57 lambd0x sena_kun: ok
23:57 timotimo that's what "associative" access is all about
23:58 timotimo gfldex: why do you use a binary sort closure? why not just *.value?
23:58 gfldex m: my %seen; for $*IN.words { %seen{.Str}++ }; %seen.sort(*.value).say
23:58 camelia rakudo-moar 0de139: OUTPUT«(arís, => 1 caor => 1 Agus => 1 Domhain => 1 trom => 1 cluain => 1 rún => 1 Tá => 1 bhuairt => 1 mór => 1 agus => 1 imeacht => 1 ghaoil, => 1 luí => 1 rá => 1 stua => 1 maorga => 1 gur => 1 thar => 1 mnaoi => 1 Ghall; => 1 Lúich’ => 1 siar => 1 ch…»
23:58 gfldex m: my %seen; for $*IN.words { %seen{.Str}++ }; %seen.sort(-*.value).say
23:58 camelia rakudo-moar 0de139: OUTPUT«(mo => 9 a => 8 le => 5 is => 5 ag => 4 an => 4 Ghaoth => 4 ghlas’ => 3 go => 3 gach => 3 Dobhair. => 3 na => 3 Dhún => 3 i => 3 slán => 3 gan => 3 ar => 2 bhí => 2 gleanntáin => 2 beag => 2 dom => 2 nGall => 2 mise => 2 nár => 2 ’s => 2 ina => 2 …»
23:58 sena_kun timotimo, to sort by values, not by keys?
23:58 gfldex because I fatsingered .values for .value :->
23:58 gfldex *fatsingered
23:58 timotimo sena_kun: i just mean it doesn't have to be a closure that takes two arguments
23:59 timotimo :D
23:59 gfldex *fatfingered
23:59 timotimo you sang?
23:59 timotimo ah, ok :)
23:59 lambd0x ahahha
23:59 sena_kun timotimo, ah, some smart stuff, I'd better run away!
23:59 mcmillhj joined #perl6
23:59 timotimo haha

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

Perl 6 | Reference Documentation | Rakudo