Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2018-05-16

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 Zoffix Man, I originally tested this with Rat/FatRat allomorph and it was working, but the change was made to ditch the FatRat :P
00:06 b2gills .tell tyil If you have two multis that differ in just a named parameter, it should be marked as being required `:$named!` https://www.reddit.com/r/ProgrammingLanguages/comments/8jj5tv/mixing_function_overloading_and_named_parameters/dz0mmxn/
00:06 yoleaux b2gills: I'll pass your message to tyil.
00:11 lucasb joined #perl6
00:12 lucasb m: sub f(Empty) { 'ok' }; say f(Slip)
00:12 camelia rakudo-moar 5ce24929f: OUTPUT: «Use of uninitialized value of type Slip in numeric context␤ok␤  in sub f at <tmp> line 1␤»
00:14 Zoffix lucasb: file those as bugs
00:15 lucasb m: say Slip ~~ Empty  # what should this evaluate to?
00:15 camelia rakudo-moar 5ce24929f: OUTPUT: «Use of uninitialized value of type Slip in numeric context␤True␤  in block <unit> at <tmp> line 1␤»
00:16 lucasb nevermind, evaluates to True
00:17 lizmat joined #perl6
00:17 lucasb is this warning legit or not?
00:17 Zoffix Doesn't look like it to me
00:23 HaraldJoerg left #perl6
00:26 lucasb R#1833
00:26 synopsebot R#1833 [open]: https://github.com/rakudo/rakudo/issues/1833 Spurious warning when smartmatching Slip ~~ Empty
00:35 Zoffix m: constant MidRat = do { my $mr := Rat.HOW.new_type: :name<MidRat>; $mr.^add_parent: class :: does Rational[UInt, UInt] {}; $mr.^add_parent: Rat;  $mr.^compose; $mr }; dd MidRat.new(1, 2)
00:35 camelia rakudo-moar 5ce24929f: OUTPUT: «Type check failed in binding to parameter '<anon>'; expected Any but got DeT (?)␤  in block <unit> at <tmp> line 1␤␤»
00:36 Zoffix man, almost works.
00:38 Zoffix m: class Z does Rational[uint64, uint64] {}.new: (my uint64 $ = 42), my uint64 $ = 2
00:38 camelia rakudo-moar 5ce24929f: OUTPUT: «Type check failed in binding to parameter 'nu'; expected uint64 but got Int (42)␤  in block <unit> at <tmp> line 1␤␤»
00:38 Zoffix .oO( what did I get myself into... )
00:40 Zoffix m: role Z[::P1] { method new(P1 $x) { dd $x} }; class :: does Z[int] {}.new: my int $ = 42
00:40 camelia rakudo-moar 5ce24929f: OUTPUT: «Type check failed in binding to parameter '$x'; expected int but got Int (42)␤  in method new at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
01:06 obra joined #perl6
01:14 Zoffix .ask jnthn is there some trick to resolve ambiguity with `Numeric` being available twice in `class MidRat does Rational[UInt, UInt] is Rat {}.new.Numeric`... Creating a temp class that `does Rational[UInt, UInt]` and inheriting from that seems to avoid ambiguity but (*) inherits from a temp class (*) hits some bug with parametarization
01:14 yoleaux Zoffix: I'll pass your message to jnthn.
01:18 Zoffix .ask thundergnat in FatRat.Str: "speed increase, 16 digits would work fine; but it isn't spec"... Are you sure those tests were actually spec (as in 6.c-errata branch tests) and not just proptests (new tests in master branch)?
01:18 yoleaux Zoffix: I'll pass your message to thundergnat.
01:21 Zoffix .tell jnthn more obvious example: `class A does Numeric {}; class B is A does Numeric {}.new.Numeric`  I want the B's `does Numeric` to replace the effects of `A` doing Numeric. And in my case it needs to replace parametarization types. Is that doable?
01:21 yoleaux Zoffix: I'll pass your message to jnthn.
01:23 Zoffix m: say "Will I regret MidRat 10 years from now? {<Yes No>.pick}"
01:23 camelia rakudo-moar 5ce24929f: OUTPUT: «Will I regret MidRat 10 years from now? Yes␤»
01:23 Zoffix I'm starting to think so too...
01:26 Zoffix K, I'm cancelling MidRat. In leu of making Rat type's denominator parametarized with Int instead of uint64. All the features of a MidRat to be merged with Rat: that is, Rat can be created with a denominator of 64+ bits, but it will degrade to a Num, like a MidRat would.
01:27 Zoffix And that leaves us open to exploring the MidRat concept in the future, whereas if we go MidRat route now, we lock ourselves into it.
01:30 * Zoffix realizes that annuls a large portion of the grant since native-typed Rats were another item along with MidRat.
01:31 Zoffix I guess I'll just keep improving Rats and see where that lands me… if it falls short of the grant's plan, then oh well
01:56 ilbot3 joined #perl6
01:56 Topic for #perl6 is now »ö« Welcome to Perl 6! | https://perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:,  or /msg camelia p6: ... | irclog: http://irc.perl6.org or http://colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
02:02 ktown my _homework_ has me thinking about scoping.
02:03 ktown as a perl5 guy by day, I have not used 'use strict'. so vars are global unless I use 'my'
02:04 timotimo i hear "no strict" in perl5 is frowned upon
02:04 Zoffix yeah, it's a terrible thing
02:05 ktown so my first pass perl6 stuff has many error because I do not add the 'my' everywhere
02:06 Zoffix ktown: there's a way to avoid those errors in Perl 6, but it's a really bad idea. I recommend you unlearn that bad habbit and learn proper scoping. It'll save you time hunting bugs.
02:06 ktown maybe a better way is for a var to be local to the block first, then 'my' if local to an inner block
02:06 timotimo that'll also let you pepper the code with type restrictions on your variables to catch some thinkos
02:08 ktown Zoffix: it's not about proper scoping it's about default scoping doing the 'right' thing
02:08 Zoffix ktown: that doesn't protect you from typos.  "hello = 42; add_to_database(helo + 42)"  That's a fatal error in proper code, but with your "local to block by default", you have a silent bug in your code where you lose the value of a variable because you typoed its name
02:09 AlexDaniel m: no strict; $x = 42; say $x²
02:09 camelia rakudo-moar 5ce24929f: OUTPUT: «1764␤»
02:09 ktown default to global is bad
02:10 ktown I was manually transpiling phython to perl6, and wondering about the need to add 'my' everywhere
02:10 Zoffix m: no strict; $hello = 42; add_to_database(++$helo); sub add_to_database { "Adding $^v to the database. Boy, I sure hope that value is correct.".say }
02:10 camelia rakudo-moar 5ce24929f: OUTPUT: «Adding 1 to the database. Boy, I sure hope that value is correct.␤»
02:11 Zoffix m: my $hello = 42; add_to_database(++$helo); sub add_to_database { "Adding $^v to the database. Boy, I sure hope that value is correct.".say }
02:11 camelia rakudo-moar 5ce24929f: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Variable '$helo' is not declared. Did you mean '$hello'?␤at <tmp>:1␤------> 3my $hello = 42; add_to_database(++7⏏5$helo); sub add_to_database { "Adding $^␤»
02:11 Zoffix It even tells you what the right variable name likely is!
02:12 AlexDaniel why do we even have ‘no strict’ in p6 though…
02:12 timotimo yes.
02:12 AlexDaniel greppable6: no strict
02:12 greppable6 AlexDaniel, 72 lines, 5 modules: https://gist.github.com/bdb024c50f6a74673c113ed1f7260cd8
02:12 AlexDaniel omg
02:13 AlexDaniel oh ok
02:13 AlexDaniel docs and false positives
02:14 ktown imho dynamic typed langs are easier because they are not hard typed. and vars exist on the fly
02:15 perlawhirl another nice thing i didn't think about until recently is the perl6 parser will protect you from undeclared subs
02:15 perlawhirl ie. `if 1 < 0: print(foo())` will not error in python (or eqv in perl or ruby)
02:15 perlawhirl but eqv in perl6 will
02:16 perlawhirl of course, linters should pick this sort of thing up, but it's nice to have the compiler do it for you
02:16 ktown in perl5 is was alwasy easier then javascript or php because you can use a var without having to test existance, then go =New array if not
02:16 timotimo well, there's ||= and //= for that
02:17 timotimo and autoviv works inside of structures as well
02:17 timotimo which is worth a whole lot
02:18 AlexDaniel perlawhirl: btw even though there's no compile-time error for methods, rakudo does give you recommendations in “Did you mean”
02:18 AlexDaniel m: class Foo { }; say Foo.gst
02:18 camelia rakudo-moar 5ce24929f: OUTPUT: «No such method 'gst' for invocant of type 'Foo'. Did you mean 'gist'?␤  in block <unit> at <tmp> line 1␤␤»
02:18 AlexDaniel m: class Foo { }; say Foo.gint
02:18 camelia rakudo-moar 5ce24929f: OUTPUT: «No such method 'gint' for invocant of type 'Foo'. Did you mean any of these?␤    List␤    gist␤    list␤    min␤␤  in block <unit> at <tmp> line 1␤␤»
02:20 ktown rocky error, with out testing myself. how does python scope?
02:20 * ktown googles
02:23 ktown local to block
02:23 timotimo fortunately they've introduced "nonlocal" a few years ago
02:26 ktown I know that declaring every var and hard typeing it the 'right' way but not the easy way
02:27 ktown the all or nothing of p5 'use strict' forcing declariation made me avoid it.
02:28 Zoffix ktown: `use strict` in Perl 5 is lexical.
02:29 Zoffix $ perl -e '$x = 42; { use strict; my $y; }; print $x'
02:29 Zoffix 42
02:32 ktown m: no strict; use localscope; $a =1 ; say $a ; { my $a = 2 say $a}
02:32 camelia rakudo-moar 5ce24929f: OUTPUT: «===SORRY!===␤Could not find localscope at line 1 in:␤    /home/camelia/.perl6␤    /home/camelia/rakudo-m-inst-2/share/perl6/site␤    /home/camelia/rakudo-m-inst-2/share/perl6/vendor␤    /home/camelia/rakudo-m-inst-2/share/perl6␤    CompUni…»
02:32 ktown m: no strict; use localscope; $a =1 ; say $a ; { my $a = 2 ; say $a}
02:32 camelia rakudo-moar 5ce24929f: OUTPUT: «===SORRY!===␤Could not find localscope at line 1 in:␤    /home/camelia/.perl6␤    /home/camelia/rakudo-m-inst-2/share/perl6/site␤    /home/camelia/rakudo-m-inst-2/share/perl6/vendor␤    /home/camelia/rakudo-m-inst-2/share/perl6␤    CompUni…»
02:32 Zoffix "localscope" is not a thing.
02:33 Zoffix You could do implement it with a slang, since we have support for local variables in QAST
02:33 ktown I know :(
02:33 Zoffix (slangs are an unsupported experimental feature tho)
02:33 Zoffix or maybe it's possible with a macro
02:35 Zoffix oh, nm, I thought you could write QAST directly in macros
02:37 ktown use strict was always to strict and got in the way of doing things
02:37 atroxaper joined #perl6
02:37 Zoffix Well, there's always PHP, eh?
02:38 ktown no, there is node.js
02:38 Zoffix I thought `'use strict';` was now in vogue in JS
02:39 ktown in JS you use lint to tell you to not use global vars
02:51 ktown i'm thinking through the where to use perl6 question. I want the answer to be perl6 > python and perl6 > node.js and perl6 > POE
02:53 Zoffix ktown: I don't code much, but I P6 increasingly useful in churning out quick command line automation tools. The multi-dispatch + auto-command-line flags generation with sub MAIN + auto --help generation from comments above those MAIN candidates really makes it a quick work.
02:53 timotimo POE is one of the perl5 async io things?
02:54 Zoffix timotimo: yeah
02:54 * timotimo wouldn't know
02:54 Zoffix not just IO, there's a whole bunch of plugins. Including IRC clients and everything
02:54 Zoffix It's an async loop and I always found its interface clunky AF
02:55 Zoffix ktown: here's one of my script automating a bunch of build process commands. I think the first version of it took me less than half an hour to write and automated typing a bunch of commands to typing a couple of letters: https://github.com/zoffixznet/z/blob/master/bin/z
02:56 Zoffix I plan to automate a lot of my currently-manual processes at $work next and hoping to write some module to make the process even easier.
02:56 Zoffix m: say .1 + .2 == .3
02:56 camelia rakudo-moar 5ce24929f: OUTPUT: «True␤»
02:56 ktown Zoffix: true true the sub main and multi dispatch is AWESOME! the stuff i put on rosetta code as an eg
02:56 Zoffix ktown: ^ try that in python :P
02:56 obra left #perl6
02:58 lernc0de joined #perl6
02:59 ktown do not get me wrong... I hire devs then teach them perl5 becasue it's tje most effective way to get stuff done
03:00 ktown I do not think python is better, but have to ask why it's so popular
03:01 Zoffix perl6 > POE hands down. I always found POE ass-backwards, while in perl 6 async/parallism is built in the language from scratch and is part of the syntax; not just some module. perl6 > python... Well, we currently lose on perf and modules, since Python is 28 years old and we're only 2 years old. I guess I'd put decent async/parallelism and good Unicode support without needing some library. And while I don't
03:01 Zoffix know Python, the code I've seen looks like line noise compared to Perl 6: https://perl6.party/post/Python-is-The-New-Write-Only-Linenoise-Language https://en.wikipedia.org/wiki/C3_linearization#Example_demonstrated_in_Python_3. perl6 > node.js === no idea about node.js
03:02 xq POE is very good :)
03:02 ktown I wrote my first IRC bot using POE in 2003
03:02 Zoffix I released probably over 200 POE modules on CPAN
03:02 Zoffix eco: IRC::Client
03:02 buggable Zoffix, IRC::Client 'Extendable Internet Relay Chat client': https://github.com/zoffixznet/perl6-IRC-Client 6 other matching results: https://modules.perl6.org/s/
03:03 Zoffix ^ compare that to PoCo::IRC interface or even that of Bot::BasicBot. :)
03:03 timotimo i'm sure that link at the end was supposed to somehow have the search query in there?
03:03 Zoffix Oh right, something's broken
03:03 ktown I agree perl6 is better the POE
03:05 ktown tiz my point actually. perl6 should also be better for aync servers then node.js
03:07 lernc0de Hey everyone. Was wondering if there were any things that Perl6 objectively does more smoothly than Common Lisp. I've noticed Perl6 seems to have lisp-style macros, and there is something called grammars that seems to be completely new.
03:07 lernc0de Note: not trying to start some sort of language war - only want your insights
03:07 Zoffix ktown: as for python popularity: it's a snowball effect. Who cares if "the dress" is blue or yellow, but enough people talk about it and it snowballs into other people thinking they have to talk about. Python was/is used in education, so you got a populace of people who only ever learn 1 language religiously crusade for it. Then you got the "There should be one and preferably one way to do it" mentally going
03:07 Zoffix for it. If you find programming hard, learning 1 way vs. many ways is easier. Then you got the "readability" con. It's easy to dupe people that just because you got words instead of symbols that that somehow makes a language more readable (it doesn't; you still have to know acceptable parameters, return values, and special cases to correctly understand a program), so that eliminates a crop of languages that
03:07 Zoffix would be an alternate choice. Lastly, you got the timing: while Perl struggled, Python was one of the best alternatives, so programmers flocked to it.
03:07 timotimo as far as i've heard, CL already had everything that's called "new and hot" in today's languages when i was born
03:08 Zoffix ktown: it might be. Check out Cro  http://mi.cro.services
03:08 timotimo joking aside, i barely know more than surface-level stuff about CL
03:11 timotimo i'm off for today  o/
03:11 lernc0de I barely know more than barely surface-level stuff about P6. ;)
03:11 ktown Zoffix: when I was a kid I used BASIC... then in university Pascal. then the kids used JAVA, now python
03:12 Zoffix I did Pascal in college and when I flunk out I kept trying to use Delphi to write programs in.,
03:13 ktown not that crappy VBA. C64 BASIC
03:14 * ktown plans to implement a C64 irc bot
03:15 ktown C64: 10 PRINT "HI"
03:15 TEttinger CL has a lot of nice things from modern languages but still has a lot of old and cold misfeatures from before there was a Common Lisp, and there were divergent standards
03:15 ktown C64: 20 GOTO 10
03:15 TEttinger there are still a ton of variants
03:17 lernc0de I find CL's syntax and functions difficult to remember (but this could be with every modern language I suppose). Making an array has so many flags for example: (make-array 3 :adjustable t :element-type something :fill-pointer something :initial-content '(1 2 3))
03:18 lernc0de Is P6 more modular in this respect? Sorry if this is an annoying beginner question
03:21 ktown Zoffix: my daugher is taking CS 101 in python, this summer. I'm following along and doing the exersises in p6.
03:21 Zoffix cool :)
03:23 ktown http://acmebot.com/py/
03:23 ktown if she needs help I will have to learn python :(
03:25 Zoffix CaR Grant Report for May: http://blogs.perl.org/users/zoffix_znet/2018/05/perl-6-car-tpf-grant-monthly-report-may-2018.html
03:31 xq nice
03:32 xq native rational numbers is a great feature that perl 6 and common lisp share
03:32 AlexDaniel joined #perl6
03:38 mcmillhj joined #perl6
03:40 Zoffix left #perl6
03:43 lernc0de Probably going to purchase Perl 6 Fundamentals. Are there any other books that may be better? To phrase it differently, is there a K&R C for Perl 6?
03:44 b2gills https://perl6book.com/
03:46 lernc0de I've seen the chart previously, but couldn't decide between fundamentals and deep dive.
03:48 ktown lernc0de: are you proficient in another lang or is this your first?
03:49 lernc0de I know C quite well, and am familiar with Common Lisp/Python
03:51 ktown so it's just syntax, and the perl6 lang does sooo0o much of the heavy lifting, have fun
03:54 lernc0de I will! :]
03:54 lernc0de Thank you, have a great night everyone. Till next time
03:54 b2gills I would say that I would probably have difficulty choosing between fundamentals and deep dive.
03:54 lernc0de Perhaps I will invest in both this summer
04:06 ktown cool: POE::Component::WWW::XKCD::AsText
04:12 pecastro joined #perl6
04:22 ufobat_ joined #perl6
04:44 curan joined #perl6
05:00 jmerelo joined #perl6
05:09 aindilis joined #perl6
05:20 lookatme The documents is K&R for Perl 6
05:31 tyil b2gills:thanks for the heads up
05:31 yoleaux 00:06Z <b2gills> tyil: If you have two multis that differ in just a named parameter, it should be marked as being required `:$named!` https://www.reddit.com/r/ProgrammingLanguages/comments/8jj5tv/mixing_function_overloading_and_named_parameters/dz0mmxn/
05:34 sauvin joined #perl6
05:39 abraxxa joined #perl6
05:49 tyil weekly: https://www.reddit.com/r/ProgrammingLanguages/comments/8jo7d4/why_arent_there_more_languages_that_treat/dz1lc4t/
05:49 notable6 tyil, Noted!
06:01 Geth ¦ doc: mryan++ created pull request #2027: Make the availability of p6doc clearer
06:01 Geth ¦ doc: review: https://github.com/perl6/doc/pull/2027
06:04 abraxxa joined #perl6
06:07 domidumont joined #perl6
06:08 Geth ¦ doc: 94754ee350 | (Martin Ryan)++ (committed by Moritz Lenz) | doc/Language/faq.pod6
06:08 synopsebot Link: https://doc.perl6.org/language/faq
06:08 Geth ¦ doc: Make the availability of p6doc clearer
06:08 Geth ¦ doc: review: https://github.com/perl6/doc/commit/94754ee350
06:13 domidumont joined #perl6
06:18 atroxape_ joined #perl6
06:19 parv joined #perl6
06:24 Geth ¦ doc: 48a2d0e84f | (JJ Merelo)++ | doc/Language/variables.pod6
06:24 synopsebot Link: https://doc.perl6.org/language/variables
06:24 Geth ¦ doc: Change the default number of threads
06:24 Geth ¦ doc:
06:24 Geth ¦ doc: Following @jnthn advice. Closes #1065, maybe for good this time.
06:24 Geth ¦ doc: review: https://github.com/perl6/doc/commit/48a2d0e84f
06:32 Khisanth joined #perl6
06:33 HaraldJoerg joined #perl6
06:35 abraxxa joined #perl6
06:39 jmerelo moritz: we seem to have a proxy error in whateverable.6lang.org https://travis-ci.org/perl6/doc/jobs/379566309
06:40 moritz jmerelo: yes, just saw that. I don't think I can do anything about that though
06:40 moritz who maintains that? AlexDaniel` maybe?
06:40 jmerelo moritz: who's in charge of those servers? AlexDaniel` ?
06:40 jmerelo He
06:41 jmerelo We are using that for retrieving perl6 binary for the tests. Maybe there's another high-availability server for that?
06:45 AlexDaniel` I'll check in 15 mins
06:48 moritz ++AlexDaniel`
06:49 jmerelo AlexDaniel`: thanks
06:49 rindolf joined #perl6
06:49 robertle joined #perl6
06:50 Ven`` joined #perl6
06:51 darutoko joined #perl6
06:52 AlexDaniel joined #perl6
06:52 tyil weekly: https://www.reddit.com/r/perl6/comments/8jsvpr/getting_started_with_sparrowdo/
06:52 notable6 tyil, Noted!
06:52 shareable6 joined #perl6
06:52 AlexDaniel jmerelo: I have no idea what was wrong
06:53 AlexDaniel jmerelo: a bunch of folks here have access to that server btw
06:53 AlexDaniel jmerelo: timotimo MasterDuke Zoffix
06:54 AlexDaniel jmerelo: but you should have access too
06:54 AlexDaniel jmerelo: which of the keys should I use? https://github.com/JJ.keys
06:54 wamba joined #perl6
06:55 jmerelo AlexDaniel: let me see
06:56 jmerelo AlexDaniel: the first one should work
06:56 jmerelo AlexDaniel: would there be any way to upload the latest binary to some high-availability server? That's the only thing the tests need...
06:57 AlexDani` joined #perl6
06:59 jmerelo AlexDaniel`: maybe bintray? https://blog.bintray.com/2013/05/30/google-and-github-insist-go-store-your-binaries-in-a-proper-place/
06:59 jmerelo I think El_Che uses it for his packages...
07:12 AlexDaniel` jmerelo: try `ssh bisectable@6lang.org`
07:13 jmerelo AlexDaniel`: got it, thanks.
07:13 AlexDaniel` jmerelo: as for uploading the binary somewhere, I can do it
07:13 jmerelo AlexDaniel`: I guess it's a matter of rebooting when it fails, right?
07:14 AlexDaniel` jmerelo: but at the same time it's the last commit on master, so people shouldn't be expecting it to always work anyway
07:14 jmerelo AlexDaniel`: that would be great. bintray seems to have an API so you can do it automatically...
07:14 AlexDaniel` like, there are some rare moments when it doesn't even compile…
07:14 jmerelo AlexDaniel`: right, but at least we will avoid the problems of it being unavailable...
07:14 AlexDaniel` jmerelo: you can restart bots with `sake kill:botname`
07:15 AlexDaniel` like `sake kill:shareable`
07:15 jmerelo AlexDaniel`: Great, thanks!
07:15 vivus-ignis joined #perl6
07:16 AlexDaniel` another option is to run `htop` or the like and just do it there, works too
07:16 AlexDaniel` systemd will restart bots if they're dead for any reason
07:16 jmerelo AlexDaniel`: OK
07:24 AlexDaniel` jmerelo: filed an issue here: https://github.com/perl6/whateverable/issues/313
07:26 AlexDani` joined #perl6
07:27 Ven`` joined #perl6
07:28 Ven`` joined #perl6
07:38 mcmillhj joined #perl6
08:11 andrzejku joined #perl6
08:24 dakkar joined #perl6
08:25 markong joined #perl6
08:36 jmerelo Just created the Whateverable tag in StackOverflow https://stackoverflow.com/questions/tagged/whateverable
08:36 jmerelo It might come in handy for the next squashaton
08:36 jmerelo squashable6: status
08:37 squashable6 jmerelo, Can't parse the wiki page
08:37 jmerelo Er
08:47 notbenh joined #perl6
08:48 [particle] joined #perl6
08:49 HaraldJoerg joined #perl6
08:54 Geth ¦ doc: 544bd80924 | (JJ Merelo)++ | doc/Language/contexts.pod6
08:54 synopsebot Link: https://doc.perl6.org/language/contexts
08:54 Geth ¦ doc: First version of the contexts document
08:54 Geth ¦ doc:
08:54 Geth ¦ doc: This would close #732.
08:54 Geth ¦ doc:
08:54 Geth ¦ doc: Problem is it is part of a larger document, #1225, which is by no
08:54 Geth ¦ doc: means complete. Also was recently added to #114 as part of the
08:54 Geth ¦ doc: language docs.
08:54 Geth ¦ doc: review: https://github.com/perl6/doc/commit/544bd80924
08:54 Geth ¦ doc: 08e976bb54 | (JJ Merelo)++ | doc/Language/contexts.pod6
08:54 Geth ¦ doc: Adds numeric context
08:54 Geth ¦ doc:
08:54 Geth ¦ doc: Refs #1225 and #124
08:54 Geth ¦ doc: review: https://github.com/perl6/doc/commit/08e976bb54
08:54 Geth ¦ doc: ce6422af84 | (JJ Merelo)++ | 2 files
08:54 Geth ¦ doc: Adds string context
08:54 Geth ¦ doc:
08:54 Geth ¦ doc: Refs #114 and #1225. There are still many contexts to go, but these
08:54 Geth ¦ doc: are the three most important.
08:54 Geth ¦ doc:
08:54 Geth ¦ doc: I'll also revise #1225 to close it when enough meaningful contexts
08:54 Geth ¦ doc: done. In general, most of them will be like
08:54 Geth ¦ doc: <…commit message has 6 more lines…>
08:54 Geth ¦ doc: review: https://github.com/perl6/doc/commit/ce6422af84
09:08 AlexDaniel` jmerelo: ouch :)
09:10 Geth ¦ whateverable: 031cf5de52 | (Aleks-Daniel Jakimenko-Aleksejev)++ | bin/Squashable.p6
09:10 Geth ¦ whateverable: Change heuristic to support md cell alignment
09:10 Geth ¦ whateverable: review: https://github.com/perl6/whateverable/commit/031cf5de52
09:11 squashable6 joined #perl6
09:11 AlexDaniel squashable6: status
09:11 squashable6 AlexDaniel, Next SQUASHathon in 16 days and ≈0 hours (2018-06-02 UTC-12⌁UTC+14). See https://github.com/rakudo/rakudo/wiki/Monthly-Bug-Squash-Day
09:11 AlexDaniel jmerelo: fixed, thanks
09:19 araujo joined #perl6
09:19 araujo joined #perl6
09:28 shareable6 joined #perl6
09:35 Geth ¦ doc: a993e37fab | (JJ Merelo)++ | doc/Language/contexts.pod6
09:35 Geth ¦ doc: Adds string contextualizer ~ refs  #1225
09:35 Geth ¦ doc: review: https://github.com/perl6/doc/commit/a993e37fab
09:35 synopsebot Link: https://doc.perl6.org/language/contexts
09:38 enheh joined #perl6
10:01 thundergnat .tell Zoffix There are a total of 8 tests that specifically look for exactly 6 digits of precision for stringified representations that can't be exactly represented. EG. (2/3).Fatrat.Str is checked to be specifically 0.666667
10:01 yoleaux 01:18Z <Zoffix> thundergnat: in FatRat.Str: "speed increase, 16 digits would work fine; but it isn't spec"... Are you sure those tests were actually spec (as in 6.c-errata branch tests) and not just proptests (new tests in master branch)?
10:01 yoleaux thundergnat: I'll pass your message to Zoffix.
10:05 thundergnat tell Zoffix As I recall there was 1 in S32-num/fatrat.t and 7 in S32-num/stringify.t. The tests exist in the errata branch too.
10:05 thundergnat .tell Zoffix As I recall there was 1 in S32-num/fatrat.t and 7 in S32-num/stringify.t. The tests exist in the errata branch too.
10:05 yoleaux thundergnat: I'll pass your message to Zoffix.
10:14 eliasr joined #perl6
10:21 atroxaper joined #perl6
10:22 lizmat joined #perl6
10:33 kurahaupo joined #perl6
10:34 Ven`` joined #perl6
10:42 domidumont joined #perl6
10:53 tbrowder_ .tell Zoffix my Rakudo PR #1826 (which fixes your GH #1821) is ready for merging
10:53 yoleaux tbrowder_: I'll pass your message to Zoffix.
11:08 lichtkind joined #perl6
11:11 psychoslave joined #perl6
11:12 Ven`` joined #perl6
11:40 lichtkind joined #perl6
11:54 psychoslave joined #perl6
12:01 idiosyncrat joined #perl6
12:16 vike joined #perl6
12:17 leedo joined #perl6
12:26 Ven`` joined #perl6
12:33 Ven`` joined #perl6
12:34 lookatme joined #perl6
12:43 domidumont joined #perl6
12:46 mcmillhj joined #perl6
12:52 itaipu joined #perl6
12:55 MilkmanDan joined #perl6
12:59 athenot joined #perl6
13:03 domidumont joined #perl6
13:10 shareable6 joined #perl6
13:11 tbrowder_ .ask jnthn it’s may, how does one sign up for commaide?
13:11 yoleaux tbrowder_: I'll pass your message to jnthn.
13:12 robertle joined #perl6
13:32 jkramer m: my $b = bag 'a'..'c'; say $b<x>; say $b<a b x>; say $b<a b x>:p
13:32 camelia rakudo-moar 385308d35: OUTPUT: «0␤(1 1 0)␤(a => 1 b => 1)␤»
13:32 jkramer Is this correct? Shouldn't the last say include a "x => 0"?
13:33 Geth ¦ doc: bd5617199a | (Will "Coke" Coleda)++ | doc/Language/contexts.pod6
13:33 synopsebot Link: https://doc.perl6.org/language/contexts
13:33 Geth ¦ doc: whitespace
13:33 Geth ¦ doc: review: https://github.com/perl6/doc/commit/bd5617199a
13:33 Geth ¦ doc: 9abdb9550e | (Will "Coke" Coleda)++ | doc/Language/5to6-nutshell.pod6
13:33 Geth ¦ doc: fix typo
13:33 synopsebot Link: https://doc.perl6.org/language/5to6-nutshell
13:33 Geth ¦ doc: review: https://github.com/perl6/doc/commit/9abdb9550e
13:37 skids joined #perl6
13:39 amalia___ joined #perl6
13:39 amalia___ joined #perl6
13:48 idiosyncrat left #perl6
13:59 lucasb joined #perl6
13:59 uzl joined #perl6
14:12 ExtraCrispy joined #perl6
14:12 domidumont joined #perl6
14:16 wamba joined #perl6
14:23 uzl_ joined #perl6
14:23 psychoslave joined #perl6
14:24 lucasb m: multi f(NaN) {}; multi f(NumStr) {}; multi f(ProtocolType) {}; multi f(UInt) {}; f
14:24 camelia rakudo-moar 385308d35: OUTPUT: «===SORRY!===␤Circularity detected in multi sub types for &f␤»
14:24 lucasb ^^ I wonder what's the interaction between these values?
14:31 Ven`` joined #perl6
14:49 molaf joined #perl6
15:01 ExtraCrispy joined #perl6
15:03 mcmillhj jkramer: according to the docs on the subscript :p adverb, it skips non-existent elements: https://docs.perl6.org/language/subscripts#index-entry-subscript_adverb_%3Ap-%3Ap
15:04 mcmillhj jkramer: :!p can be used to non silently skip them
15:04 mcmillhj m: my $b = bag 'a' .. 'c'; say $b<a b x>:!p;
15:04 camelia rakudo-moar 385308d35: OUTPUT: «(a => 1 b => 1 x => 0)␤»
15:10 jkramer mcmillhj: Sweet, thank you!
15:12 mahafyi joined #perl6
15:32 hythm_ joined #perl6
15:35 athenot joined #perl6
15:35 g- joined #perl6
15:37 hythm_ :m grammar G {token a {'a'}; token b {<?after 'a'> 'b'}; token TOP {<a><b>};}; G.parse('ab').say; # works
15:37 timotimo needs to be m: not :m
15:38 hythm_ m: grammar G {token a {'a'}; token b {<?after 'a'> 'b'}; token TOP {<a><b>};}; G.parse('ab').say; # works
15:38 camelia rakudo-moar 385308d35: OUTPUT: «「ab」␤ a => 「a」␤ b => 「b」␤»
15:38 hythm_ m: grammar G {token a {'a'}; token b {<?after <a>> 'b'}; token TOP {<a><b>};}; G.parse('ab').say; # works
15:38 camelia rakudo-moar 385308d35: OUTPUT: «「ab」␤ a => 「a」␤ b => 「b」␤»
15:38 hythm_ m: grammar G {token a {'az'}; token b {<?after 'az'> 'b'}; token TOP {<a><b>};}; G.parse('ab').say; # works
15:38 camelia rakudo-moar 385308d35: OUTPUT: «Nil␤»
15:40 hythm_ m: grammar G {token a {'az'}; token b {<?after 'az'> 'b'}; token TOP {<a><b>};}; G.parse('ab').say;
15:40 camelia rakudo-moar 385308d35: OUTPUT: «Nil␤»
15:41 hythm_ m: grammar G {token a {'az'}; token b {<?after 'az'> 'b'}; token TOP {<a><b>};}; G.parse('azb').say; # works
15:42 camelia rakudo-moar 385308d35: OUTPUT: «「azb」␤ a => 「az」␤ b => 「b」␤»
15:42 hythm_ m: grammar G {token a {'a'}; token b {<?after <a>> 'b'}; token TOP {<a><b>};}; G.parse('ab').say; #Does not work works
15:42 camelia rakudo-moar 385308d35: OUTPUT: «「ab」␤ a => 「a」␤ b => 「b」␤»
15:43 psychoslave joined #perl6
15:44 hythm_ Sorry for confusion, but looks like last one did not work on my box... it worked here though
15:47 timotimo committable6: releases grammar G {token a {'a'}; token b {<?after <a>> 'b'}; token TOP {<a><b>};}; G.parse('ab').say
15:47 committable6 timotimo, ¦releases (29 commits): «「ab」␤ a => 「a」␤ b => 「b」␤»
15:47 hythm_ m: grammar G {token a {'az'}; token b {<?after <a>> 'b'}; token TOP {<a><b>};}; G.parse('azb').say; # not working
15:47 camelia rakudo-moar 385308d35: OUTPUT: «Nil␤»
15:48 stdio joined #perl6
15:49 hythm_ Why this does not work^.  If i replaced <a> with 'az' ..inside <?after...> ,, it works fine
15:52 timotimo hm, something wrong with the flipping algorithm, i wonder
15:56 mcmillhj m: my $b = bag 'a' .. 'c'; say $b<a b x>:!p;
15:56 camelia rakudo-moar 385308d35: OUTPUT: «(a => 1 b => 1 x => 0)␤»
15:56 mcmillhj oops, mt
16:13 robertle joined #perl6
16:17 HaraldJoerg left #perl6
16:32 raynold joined #perl6
16:33 tobs m: say $[1,2,3,4][*..*-3]
16:33 camelia rakudo-moar 385308d35: OUTPUT: «Cannot convert -Inf to Int: ␤  in block <unit> at <tmp> line 1␤␤»
16:35 comborico1611 joined #perl6
16:40 lucasb c: 2018.04.1 ()[*..5]
16:40 committable6 lucasb, ¦2018.04.1: «Cannot convert -Inf to Int: ␤  in block <unit> at /tmp/CV8y4wQJiA line 1␤␤ «exit code = 1»»
16:41 lucasb strange, locally I get "Unhandled exception: No exception handler located for warn"
16:42 tobs I get an additional "Use of uninitialized value $!reason of type Any in string context." but my rakudo is old
16:59 timotimo a bare * has a special meaning to the .. operator
16:59 timotimo m: say $[1, 2, 3, 4][^(*-2)]
16:59 camelia rakudo-moar 385308d35: OUTPUT: «(1 2)␤»
16:59 timotimo m: say $[1, 2, 3, 4][{ $_ .. $_ - 2 }]
16:59 camelia rakudo-moar 385308d35: OUTPUT: «()␤»
16:59 xinming_ joined #perl6
17:00 timotimo m: say $[1, 2, 3, 4][{ $_ .. ($_ - 2) }]
17:00 camelia rakudo-moar 385308d35: OUTPUT: «()␤»
17:00 timotimo oh?
17:00 timotimo m: say $[1, 2, 3, 4][{ say $_; $_ .. ($_ - 2) }]
17:00 camelia rakudo-moar 385308d35: OUTPUT: «4␤()␤»
17:00 timotimo m: say $[1, 2, 3, 4][{ say $_; say ($_ .. ($_ - 2)) }]
17:00 camelia rakudo-moar 385308d35: OUTPUT: «4␤4..2␤2␤»
17:00 timotimo ah, of course
17:00 tobs m: say $[1, 2, 3, 4][{ $_ ... ($_ - 2) }]
17:00 camelia rakudo-moar 385308d35: OUTPUT: «((Any) 4 3)␤»
17:00 pilne joined #perl6
17:00 timotimo ah, is that what you wanted?
17:01 tobs Almost. I wanted the last $k elements in reverse order, without an (Any)
17:01 tobs I'm using using .reverse now :-)
17:01 tobs *just using
17:01 timotimo my suggestion would probably be:
17:02 timotimo m: say $[1, 2, 3, 4].tail(4).reverse
17:02 camelia rakudo-moar 385308d35: OUTPUT: «(4 3 2 1)␤»
17:02 timotimo m: say $[1, 2, 3, 4].tail(2).reverse
17:02 camelia rakudo-moar 385308d35: OUTPUT: «(4 3)␤»
17:02 tobs Ah, yes. That reads better
17:03 psychoslave joined #perl6
17:20 mcmillhj joined #perl6
17:32 mcmillhj joined #perl6
17:32 domidumont joined #perl6
17:40 mcmillhj_ joined #perl6
17:48 athenot_ joined #perl6
17:52 Praise joined #perl6
17:52 Praise joined #perl6
18:03 ignis__away joined #perl6
18:15 jmerelo O/
18:49 ignis__away joined #perl6
18:55 comborico1611 joined #perl6
18:58 samcv i can't seem to install IRC::Client because of a failure in IO::Socket::Async::SSL (this is on the latest star)
18:59 lizmat bummer, also not with --force ?
18:59 samcv yeah well then the irc server doesn't work :)
19:00 samcv i get Cannot locate symbol 'sk_num' in native library 'libssl.so'
19:00 enheh joined #perl6
19:00 samcv this seems similar? https://github.com/wkhtmltopdf/wkhtmltopdf/issues/3001 it says i need to get the legacy libssl (i'm on debian sid) or something
19:00 timotimo sounds like that's an unsupported version?
19:01 samcv what? sid? or openssl 1.1h?
19:01 samcv seems like functions changed maybe
19:08 El_Che samvc: $ docker run -ti --entrypoint="" rakudo/ubuntu-amd64-18.04 bash -c "apt-get update && apt-get install -y libssl1.0 && zef install IRC::Client"
19:08 El_Che ...
19:08 El_Che ===> Installing: IRC::Client:ver<3.007006>
19:08 El_Che seems to work on Ubuntu if you install libssl1.0
19:08 El_Che (it's not a Star image, though)
19:10 athenot joined #perl6
19:21 Zoffix joined #perl6
19:23 Zoffix left #perl6
19:31 Zoffix joined #perl6
19:32 Zoffix samcv: FWIW, installs fine on openssl-1.1.1-pre6
19:33 Zoffix on 2018.04-20-g7847768 built on MoarVM version 2018.04-34-g25f165a
19:44 psychoslave joined #perl6
19:55 wamba joined #perl6
19:59 sno joined #perl6
20:01 lucasb https://gist.github.com/lucasbuchala/704738bf9c875116fe713f7dd46192ff
20:02 lucasb ^^ can anyone confirm this behavior?
20:02 lucasb is it a bug?
20:03 Zoffix There's a bug that has same error R#131574
20:03 Zoffix There's a bug that has same error RT#131574
20:03 synopsebot RT#131574 [new]: https://rt.perl.org/Ticket/Display.html?id=131574 [BUG] Incorrect circularity detection with infix:<+>
20:03 Zoffix Note the last comment on it tho: "Did anyone actually take all the candidates and manually draw out the DAG? :) 15:17 I can't imagine the cycle detection is a false positive."
20:04 lancew joined #perl6
20:04 Zoffix left #perl6
20:06 lucasb hmm, you already stumbled upon it
20:06 espadrine joined #perl6
20:10 athenot_ joined #perl6
20:14 zachk joined #perl6
20:16 zachk joined #perl6
20:18 samcv ZofBot: are you sure you don't have libssl1.0-dev?
20:18 samcv or maybe the nondev. anyway i installed it and now it works
20:20 El_Che samcv: the way most nativecall modules find their libraries is flaky
20:21 samcv well it finds it
20:21 samcv well. idk.
20:21 El_Che it find 1.0 not 1.1
20:22 El_Che what installed by default on recent distros
20:22 El_Che and the user has no clue he needs to install an older version
20:23 El_Che or, like on a SO question for the latest debian and dbiish: you need to create a link from the libmariadbclient lib to one with the name lf libmysql
20:25 athenot joined #perl6
20:27 espadrine joined #perl6
20:30 mcmillhj_ joined #perl6
20:36 samcv my post on the new perl 6 hashing changes and explaining the security issue it solves is now live: https://cry.nu/perl6/secure-hashing-for-moarvm/
20:37 El_Che \o/
20:41 athenot_ joined #perl6
20:45 moritz samcv++
20:57 athenot joined #perl6
21:03 mcmillhj joined #perl6
21:09 mcmillhj_ joined #perl6
21:21 MasterDuke joined #perl6
21:21 athenot joined #perl6
21:26 kurahaupo joined #perl6
21:26 mcmillhj joined #perl6
21:32 mcmillhj joined #perl6
21:40 samcv i'm going to expand the user facing changes section to have more recommendations of do's and don'ts
21:43 mcmillhj_ joined #perl6
21:44 kurahaupo joined #perl6
21:46 athenot_ joined #perl6
21:48 samcv anybody want to check out this section and tell me if it can be improved? https://cry.nu/perl6/secure-hashing-for-moarvm/#user-facing-changes
21:51 lizmat samcv: @stuff.push: $i;  s/$i/$key/ ?
21:52 samcv ah yes
21:52 samcv lizmat++ and let me know if there's more i should touch on
21:53 vivus-ignis joined #perl6
21:53 lizmat "identify items that need fixes"  s/fixes/fixing/ ?
21:54 samcv had been way too long since i made a blog post
21:55 samcv also hoping the pictures were helpful. i just used draw.io to make it
22:00 mcmillhj joined #perl6
22:15 comborico1611 samcv: Very good!
22:15 comborico1611 joined #perl6
22:15 mcmillhj joined #perl6
22:16 reu joined #perl6
22:22 samcv thanks!
22:23 athenot joined #perl6
22:28 wamba joined #perl6
22:31 mcmillhj joined #perl6
22:32 lucasb joined #perl6
22:34 lucasb samcv: "Assuming s/everthing/everything/ is fine ..."
22:36 Kaiepi joined #perl6
22:36 mcmillhj joined #perl6
22:36 samcv lucasb: thanks!
22:42 timotimo does siphash make sure the resulting value is never 0 so we can use 0 as a value for "hash wasn't computed yet"?
22:42 buggable New CPAN upload: PDF-Class-0.2.0.tar.gz by WARRINGD http://modules.perl6.org/dist/PDF::Class:cpan:WARRINGD
22:43 samcv timotimo: uh. i don't know. i mean do we do that now?
22:43 timotimo i don't think we do at the moment
22:44 timotimo that was also mentioned in the c3 talk
22:44 samcv i don't see us doing that?
22:44 timotimo if we sacrifice one other value that we spit out if the result would have been 0, we can prevent hashing the same string object over and over again
22:44 samcv also eventually we may want to rekey our hashes if there are too many collisions, perl 5 does thta at least
22:45 samcv though. i think they might use a less secure hashing by default, not sure. though when i add siphash i should be moving us to 64bit hashes
22:45 samcv which will make collisions even rarer
22:45 timotimo right
22:45 timotimo does that also make all our hashes bigger? or just our strings for the cached hash value?
22:45 AlexDaniel joined #perl6
22:46 skids joined #perl6
22:46 samcv timotimo: ah we do do that
22:46 timotimo how would re-keying work?
22:47 samcv though it should only happen 1/2147483648 chance
22:47 timotimo have a "salt" for every hash?
22:47 timotimo right, siphash makes it hard to get that exact value
22:47 samcv if our bucket is still full after doubling the buckets then we rekey
22:47 timotimo even harder than getting two strings with just the same hash value
22:48 samcv timotimo: let me see if i can make a hash that has 0. one sec
22:49 samcv i've already separated out mvm's hash function and made code to brute force codes. so let me see
22:50 timotimo did you vectorize it yet? ;)
22:52 samcv haha
22:57 samcv timotimo: yes it can be one
22:57 samcv (our current hash function, not sure about siphash but probably yes
22:58 mcmillhj joined #perl6
22:58 timotimo sorry, can be one?
22:58 timotimo you mean can't be zero?
22:58 samcv no it can be zero
22:59 timotimo OK
22:59 samcv i mean we could add one to it?
23:00 timotimo then we can hit 0 again if we overflow? :D
23:01 n00b_ joined #perl6
23:02 n00b_ m: say -15 ** 0.5; say (-15, -16, -17) >>**>> 0.5;
23:02 camelia rakudo-moar b8318b8ed: OUTPUT: «-3.872983346207417␤(NaN NaN NaN)␤»
23:02 n00b_ why doesn't the hyper work?
23:03 n00b_ How do I do sqrt for each scalar in an array (without having an explicit loop)?
23:03 timotimo you can >>.sqrt for the second one
23:03 n00b_ nice
23:03 n00b_ I can never figure out when I need the pair >> >> vs when I can get away with one >>
23:04 samcv timotimo: overflow?
23:04 timotimo one >> is only for prefix or postfix operators and method calls
23:04 timotimo the reason why your two ** 0.5 pieces differ is because of the precedence between - and **
23:04 timotimo you're actually calculating -(15 ** 0.5)
23:04 timotimo whereas in the second one you're calculating (-15) ** 0.5
23:04 timotimo you can get complex numbers if you want, but you'll have to start out with a complex number first
23:05 timotimo m: say <-15+0i> ** 0.5
23:05 camelia rakudo-moar b8318b8ed: OUTPUT: «2.3715183290419594e-16+3.872983346207417i␤»
23:05 timotimo m: say (<-15+0i> ** 0.5) ** 2
23:05 camelia rakudo-moar b8318b8ed: OUTPUT: «-15+1.83697019872103e-15i␤»
23:05 timotimo does that help?
23:06 n00b_ It does help, yes.
23:06 n00b_ At least I know the syntax >>**>> 0.5 is meaningful
23:06 n00b_ brb
23:06 timotimo :)
23:14 mcmillhj joined #perl6
23:23 kurahaupo joined #perl6
23:23 n00b_ For the sake of readability, I'd like to remove the extra parenthesis in   ( [Z-] ( (1,2,3) , (4,5,6) ) >>**>> 2 )>>.abs>>.sqrt  so that I could say something like .sqrt>> .abs>> [Z-] ( (1,2,3) , (4,5,6) ) >>**>> 2
23:23 n00b_ Is there some syntax I could make use of to move the sqrt and abs to the left of the expression?
23:24 timotimo yup
23:24 timotimo m: say .>>sqrt.>>abs given [Z-] ( (1,2,3) , (4,5,6) ) >>**>> 2
23:24 camelia rakudo-moar b8318b8ed: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Malformed postfix call (only alphabetic methods may be detached)␤at <tmp>:1␤------> 3say .7⏏5>>sqrt.>>abs given [Z-] ( (1,2,3) , (4,5␤»
23:24 timotimo m: say $_.>>sqrt.>>abs given [Z-] ( (1,2,3) , (4,5,6) ) >>**>> 2
23:24 camelia rakudo-moar b8318b8ed: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Missing dot on method call␤at <tmp>:1␤------> 3say $_.>>7⏏5sqrt.>>abs given [Z-] ( (1,2,3) , (4,5,6␤    expecting any of:␤        postfix␤»
23:24 timotimo m: say $_>>.sqrt>>.abs given [Z-] ( (1,2,3) , (4,5,6) ) >>**>> 2
23:24 camelia rakudo-moar b8318b8ed: OUTPUT: «(NaN NaN NaN)␤»
23:24 timotimo oh?
23:24 n00b_ ah,  nice, I forget that $_ is there, because it's so often elidable
23:25 timotimo m: say [Z-] ( (1,2,3) , (4,5,6) ) >>**>> 2
23:25 camelia rakudo-moar b8318b8ed: OUTPUT: «(-15 -21 -27)␤»
23:25 timotimo ah, right, of course that becomes NaN xx 3
23:25 kurahaupo_ joined #perl6
23:26 n00b_ m: $_>>.abs>>.sqrt given [Z-] ( (1,2,3) , (4,5,6) ) >>**>> 2
23:26 camelia rakudo-moar b8318b8ed: ( no output )
23:26 n00b_ m: say $_>>.abs>>.sqrt given [Z-] ( (1,2,3) , (4,5,6) ) >>**>> 2
23:26 camelia rakudo-moar b8318b8ed: OUTPUT: «(3.872983346207417 4.58257569495584 5.196152422706632)␤»
23:26 timotimo ah, that's why
23:27 n00b_ m: say $_>>.abs>>.sqrt given 2 R>>**>> [Z-] ( (1,2,3) , (4,5,6) )
23:27 camelia rakudo-moar b8318b8ed: OUTPUT: «(3 3 3)␤»
23:27 n00b_ m: say $_>>.abs>>.sqrt given ( 2 R>>**>> [Z-] ( (1,2,3) , (4,5,6) ) )
23:27 camelia rakudo-moar b8318b8ed: OUTPUT: «(3 3 3)␤»
23:28 timotimo should also be able to <<R**<<
23:28 timotimo though i suppose the R>>**>> version is a little faster
23:28 n00b_ I think your version is easier to understand
23:28 n00b_ or rather maps better to the concept I'm thinking of
23:29 timotimo there's also feeds, fwiw
23:29 timotimo i don't use them often at all, so let's see if i remember them right
23:29 timotimo oh, no, that would need maps, that'd be dumb
23:29 kurahaupo joined #perl6
23:30 n00b_ m: 2 RZ** (1,2,3)
23:30 camelia rakudo-moar b8318b8ed: OUTPUT: «Potential difficulties:␤    Useless use of RZ** in sink context␤    at <tmp>:1␤    ------> 2 7⏏5RZ** (1,2,3)␤»
23:30 n00b_ m: say 2 RZ** (1,2,3)
23:30 camelia rakudo-moar b8318b8ed: OUTPUT: «(1)␤»
23:30 n00b_ m: say (1,2,3) Z** 2
23:30 camelia rakudo-moar b8318b8ed: OUTPUT: «(1)␤»
23:30 n00b_ hmm
23:30 timotimo Z stops at the shorter list
23:30 timotimo m: say (1,2,3) Z** 2 xx *
23:30 camelia rakudo-moar b8318b8ed: OUTPUT: «(1 4 9)␤»
23:31 mcmillhj joined #perl6
23:31 n00b_ Nice.
23:32 n00b_ I think I'm happy with $_>>.abs>>.sqrt given ( 2 <<R**<< [Z-] ( (1,2,3) , (4,5,6) ) ) .
23:32 timotimo m: say >>.abs given (1, -2, 3)
23:32 camelia rakudo-moar b8318b8ed: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Missing << or >>␤at <tmp>:1␤------> 3say >>.7⏏5abs given (1, -2, 3)␤»
23:32 timotimo right, needs the $_ to work
23:32 n00b_ I'm trying to get closer to the APL way of doing things, an array-at-a-time, without having to tell the compiler that I want a loop, which feels to me like its job
23:33 TimToady m: say (1,2,3) X** 2
23:33 camelia rakudo-moar b8318b8ed: OUTPUT: «(1 4 9)␤»
23:33 timotimo oh, of course
23:33 timotimo i'll take this as a sign that i should really go to bed soon
23:33 n00b_ m: 2 RX** (1,2,3)
23:33 camelia rakudo-moar b8318b8ed: OUTPUT: «Potential difficulties:␤    Useless use of RX** in sink context␤    at <tmp>:1␤    ------> 2 7⏏5RX** (1,2,3)␤»
23:33 n00b_ m: say 2 RX** (1,2,3)
23:33 camelia rakudo-moar b8318b8ed: OUTPUT: «(1 4 9)␤»
23:33 n00b_ wooo!
23:33 n00b_ that's slick.
23:33 TimToady actually...
23:33 TimToady m: say 2 RX** 1,2,3
23:33 camelia rakudo-moar b8318b8ed: OUTPUT: «(1 4 9)␤»
23:34 TimToady X and Z are listops, so you don't really need the parens on the lists
23:34 TimToady (unlike hypers)
23:34 n00b_ Thanks, but in my case it'll be [Z-] ((1,2,3) , (4,5,6))
23:34 n00b_ or rather @a and @b because it's a sub
23:34 TimToady so you don't need the outer parens, prolly
23:35 n00b_ m: say 2 RX** [Z-] (1,2,3) , (4,5,6)
23:35 camelia rakudo-moar b8318b8ed: OUTPUT: «(9 9 9)␤»
23:35 n00b_ hahah
23:35 n00b_ love it
23:35 kurahaupo_ joined #perl6
23:35 n00b_ I'm a little sad about the $_ needed in $_>>.abs>>.sqrt ... but c'est le vie
23:36 timotimo if you don't want the $_, you can also .map(*.abs.sqrt)
23:36 TimToady m: say .».abs for -1, -2, -3
23:36 camelia rakudo-moar b8318b8ed: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Malformed postfix call (only alphabetic methods may be detached)␤at <tmp>:1␤------> 3say .7⏏5».abs for -1, -2, -3␤»
23:36 tobs m: *».abs».sqrt with 1,-2,3
23:36 camelia rakudo-moar b8318b8ed: ( no output )
23:36 tobs m: *».abs».sqrt.say with 1,-2,3
23:36 camelia rakudo-moar b8318b8ed: OUTPUT: «(1 1.4142135623730951 1.7320508075688772)␤»
23:36 n00b_ Oh! I like that!
23:37 n00b_ Whatever stars are one of my favorite parts of P6
23:37 tobs I stumbled upon it earlier today as well :-)
23:38 TimToady m: say .self».abs for -1, -2, -3
23:38 camelia rakudo-moar b8318b8ed: OUTPUT: «(1)␤(2)␤(3)␤»
23:38 TimToady look no $_  ;)
23:38 timotimo then you'll also not need the »
23:39 n00b_ m: sub cartesian_distance(@a, @b) { *>>.abs>>.sqrt with 2 RX** [Z-]  @a, @b }; say cartesian_distance( (1,2,3) , (4,5,6) )
23:39 camelia rakudo-moar b8318b8ed: OUTPUT: «(3 3 3)␤»
23:39 n00b_ nice
23:39 n00b_ very clean
23:39 TimToady m: say .self».abs for (-1, -2, -3), (-4,-5,-6)
23:39 camelia rakudo-moar b8318b8ed: OUTPUT: «(1 2 3)␤(4 5 6)␤»
23:39 n00b_ duh, forgot the su
23:39 n00b_ m: sub cartesian_distance(@a, @b) { *>>.abs>>.sqrt with [+] 2 RX** [Z-]  @a, @b }; say cartesian_distance( (1,2,3) , (4,5,6) )
23:39 camelia rakudo-moar b8318b8ed: OUTPUT: «(5.196152422706632)␤»
23:40 n00b_ Look ma, no loops.
23:41 tobs Perl 6 has all the loops you'll ever need built in
23:42 TimToady .oO(∞ loops should be enough for anyone...)
23:42 n00b_ Alright, now that we have cartesian_distance, here's the $64K question: given MxN matrix of M points in N-dimensional space, how do I calculate the MxM distance matrix from each point to every other point, sans loops?
23:43 timotimo this is the point where i'd probably go for at least one explicit loop, weak little me
23:44 n00b_ I know. I ask because i'm trying to solve this little twitter puzzle: https://twitter.com/Hillelogram/status/996264393456390144
23:44 n00b_ You can ignore most of the code there. We've written +/&.:*:@:- as cartesian_distance here.
23:44 n00b_ The point of the challenge is to write the equivalent to J's / operator
23:45 pecastro_ joined #perl6
23:45 n00b_ which is a generalized outer product operator: x +/ y is the sum table, x */ y is the product table, x ^/ y is the exp table
23:45 n00b_ it's super useful in everyday programming, as odd as that seems, given outer products are big & expensive, but it's used all the time
23:45 n00b_ I'd like an operator that does that in P6
23:46 n00b_ (the "1 is also relevant, but leave that for now)
23:47 timotimo http://rosettacode.org/wiki/Kronecker_product#Perl_6 - is this relevant?
23:47 timotimo it has an explicit loop, though
23:47 mcmillhj joined #perl6
23:48 n00b_ it's thematically related, but that seems like it does a mmult for each scalar in A with the entire matrix B
23:49 TimToady if you're generalizing to more dimensions, hypers are likely to be better behaved than listops, especially if you use the dwimmy ones «op» which will do the autorepeating at any level that needs it
23:49 n00b_ My gut was we could press X into service
23:49 n00b_ but if it stops at the shorter list, that's problematic
23:49 timotimo only Z does that
23:49 TimToady but X only extends a scalar to a list at the top level
23:49 timotimo X goes through every item on both sides
23:49 timotimo true that
23:50 TimToady «op» doesn't stop at the shorter one
23:50 n00b_ (1,2,3) op/ (4,5) is (1 op>> (4, 5)), (2 op>> (4,5)), (3 op>> (4,5))
23:51 TimToady hmm
23:51 n00b_ m: say ((1, 2, 3), (4, 5, 6)) << <<+>> >> ((7,8,9), (10,11,12))
23:51 camelia rakudo-moar b8318b8ed: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Unsupported use of << to do left shift; in Perl 6 please use +< or ~<␤at <tmp>:1␤------> 3say ((1, 2, 3), (4, 5, 6)) <<7⏏5 <<+>> >> ((7,8,9), (10,11,12))␤»
23:52 n00b_ m: say ((1, 2, 3), (4, 5, 6)) <<<<+>>>> ((7,8,9), (10,11,12))
23:52 camelia rakudo-moar b8318b8ed: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Missing << or >>␤at <tmp>:1␤------> 3say ((1, 2, 3), (4, 5, 6)) <<<<+>>>7⏏5> ((7,8,9), (10,11,12))␤    expecting any of:␤        infix␤        infix stopper␤»
23:52 TimToady «op» is more like APL, which would autorepeat 4,5,4,5,4,5...
23:52 n00b_ Yes, that's what I want.
23:52 timotimo hyperops descend into substructures, too
23:52 n00b_ m: say ((1, 2, 3), (4, 5, 6)) <<+>> ((7,8,9), (10,11,12))
23:52 camelia rakudo-moar b8318b8ed: OUTPUT: «((8 10 12) (14 16 18))␤»
23:52 n00b_ oh!
23:53 timotimo m: my %left = :1hey, :2bye, :3foo; my %right = :9boo, :8bye, :4foo; say %left «~» %right
23:53 camelia rakudo-moar b8318b8ed: OUTPUT: «{bye => 28, foo => 34}␤»
23:54 timotimo oh, i thought if you point the pointies at the hashes missing keys would be treated as "no operand from here" but still show up in the result?
23:54 timotimo m: my %left = :1hey, :2bye, :3foo; my %right = :9boo, :8bye, :4foo; say %left »~« %right
23:54 camelia rakudo-moar b8318b8ed: OUTPUT: «{boo => 9, bye => 28, foo => 34, hey => 1}␤»
23:55 n00b_ m: sub postfix:<c_d> { *>>.abs>>.sqrt with [+] 2 RX** [Z-]  @^a, @^b }; say (1, 2, 3) c_d (4, 5, 6)
23:55 camelia rakudo-moar b8318b8ed: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3] 2 RX** [Z-]  @^a, @^b }; say (1, 2, 3)7⏏5 c_d (4, 5, 6)␤    expecting any of:␤        infix␤        infix stopper␤        postfix␤        sta…»
23:56 Herby_ joined #perl6
23:56 TimToady s/post/in/ ???
23:56 Herby_ o/
23:56 n00b_ m: sub postfix:<c_d>(@a, @b) { *>>.abs>>.sqrt with [+] 2 RX** [Z-]  @a, @b }; say (1, 2, 3) c_d (4, 5, 6)
23:56 camelia rakudo-moar b8318b8ed: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3[+] 2 RX** [Z-]  @a, @b }; say (1, 2, 3)7⏏5 c_d (4, 5, 6)␤    expecting any of:␤        infix␤        infix stopper␤        postfix␤        sta…»
23:56 TimToady that looks like an infix to me
23:56 n00b_ haha, yes
23:56 n00b_ m: sub infix:<c_d>(@a, @b) { *>>.abs>>.sqrt with [+] 2 RX** [Z-]  @a, @b }; say (1, 2, 3) c_d (4, 5, 6)
23:56 camelia rakudo-moar b8318b8ed: OUTPUT: «(5.196152422706632)␤»
23:56 n00b_ m: sub infix:<c_d>(@a, @b) { *>>.abs>>.sqrt with [+] 2 RX** [Z-]  @a, @b }; say ((1, 2, 3), (4, 5, 6)) <<c_d>> ((7,8,9), (10,11,12))
23:57 camelia rakudo-moar b8318b8ed: OUTPUT: «Type check failed in binding to parameter '@a'; expected Positional but got Int (1)␤  in sub infix:<c_d> at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
23:57 n00b_ hmm
23:58 n00b_ Do hypers necessarily descend all the way to scalars?
23:59 TimToady how is it supposed to intuit what level to stop at, if not at the bottom?
23:59 n00b_ the type signature was my thought
23:59 n00b_ the bottom-most thing that matches the type sig
23:59 TimToady we know with unaries to check for 'is nodal', but binaries ignore that

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

Perl 6 | Reference Documentation | Rakudo