»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend! Set by moritz on 22 December 2015. |
|||
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:00 | |
b2gills | .tell tyil If you have two multis that differ in just a named parameter, it should be marked as being required `:$named!` www.reddit.com/r/ProgrammingLangua...s/dz0mmxn/ | 00:06 | |
yoleaux | b2gills: I'll pass your message to tyil. | ||
00:11
lucasb joined
|
|||
lucasb | m: sub f(Empty) { 'ok' }; say f(Slip) | 00:12 | |
camelia | Use of uninitialized value of type Slip in numeric context ok in sub f at <tmp> line 1 |
||
Zoffix | lucasb: file those as bugs | 00:14 | |
lucasb | m: say Slip ~~ Empty # what should this evaluate to? | 00:15 | |
camelia | Use of uninitialized value of type Slip in numeric context True in block <unit> at <tmp> line 1 |
||
lucasb | nevermind, evaluates to True | 00:16 | |
00:17
lizmat joined
|
|||
lucasb | is this warning legit or not? | 00:17 | |
Zoffix | Doesn't look like it to me | ||
00:21
lizmat left
00:23
HaraldJoerg left
00:24
athenot_ left
|
|||
lucasb | R#1833 | 00:26 | |
synopsebot | R#1833 [open]: github.com/rakudo/rakudo/issues/1833 Spurious warning when smartmatching Slip ~~ Empty | ||
00:28
aindilis left
|
|||
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 | Type check failed in binding to parameter '<anon>'; expected Any but got DeT (?) in block <unit> at <tmp> line 1 |
||
Zoffix | man, almost works. | 00:36 | |
m: class Z does Rational[uint64, uint64] {}.new: (my uint64 $ = 42), my uint64 $ = 2 | 00:38 | ||
camelia | Type check failed in binding to parameter 'nu'; expected uint64 but got Int (42) in block <unit> at <tmp> line 1 |
||
Zoffix | .oO( what did I get myself into... ) |
||
m: role Z[::P1] { method new(P1 $x) { dd $x} }; class :: does Z[int] {}.new: my int $ = 42 | 00:40 | ||
camelia | 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 |
||
00:45
markong left
00:51
zachk left
01:06
obra joined
|
|||
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. | ||
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. | ||
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. | ||
Zoffix | m: say "Will I regret MidRat 10 years from now? {<Yes No>.pick}" | 01:23 | |
camelia | Will I regret MidRat 10 years from now? Yes | ||
Zoffix | I'm starting to think so too... | ||
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:26 | ||
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:27 | ||
Zoffix realizes that annuls a large portion of the grant since native-typed Rats were another item along with MidRat. | 01:30 | ||
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:31 | ||
01:33
enheh left
01:46
ilbot3 left,
lucasb left
01:56
ilbot3 joined,
ChanServ sets mode: +v ilbot3
|
|||
ktown | my _homework_ has me thinking about scoping. | 02:02 | |
as a perl5 guy by day, I have not used 'use strict'. so vars are global unless I use 'my' | 02:03 | ||
timotimo | i hear "no strict" in perl5 is frowned upon | 02:04 | |
Zoffix | yeah, it's a terrible thing | ||
ktown | so my first pass perl6 stuff has many error because I do not add the 'my' everywhere | 02:05 | |
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 | ||
timotimo | that'll also let you pepper the code with type restrictions on your variables to catch some thinkos | ||
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 | ||
AlexDaniel | m: no strict; $x = 42; say $x² | 02:09 | |
camelia | 1764 | ||
ktown | default to global is bad | ||
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 } | ||
camelia | Adding 1 to the database. Boy, I sure hope that value is correct. | ||
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 | 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 $^ |
||
Zoffix | It even tells you what the right variable name likely is! | ||
AlexDaniel | why do we even have ‘no strict’ in p6 though… | 02:12 | |
timotimo | yes. | ||
AlexDaniel | greppable6: no strict | ||
greppable6 | AlexDaniel, 72 lines, 5 modules: gist.github.com/bdb024c50f6a74673c...d1f7260cd8 | ||
AlexDaniel | omg | ||
oh ok | 02:13 | ||
docs and false positives | |||
ktown | imho dynamic typed langs are easier because they are not hard typed. and vars exist on the fly | 02:14 | |
perlawhirl | another nice thing i didn't think about until recently is the perl6 parser will protect you from undeclared subs | 02:15 | |
ie. `if 1 < 0: print(foo())` will not error in python (or eqv in perl or ruby) | |||
but eqv in perl6 will | |||
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 | ||
timotimo | well, there's ||= and //= for that | ||
and autoviv works inside of structures as well | 02:17 | ||
which is worth a whole lot | |||
AlexDaniel | perlawhirl: btw even though there's no compile-time error for methods, rakudo does give you recommendations in “Did you mean” | 02:18 | |
m: class Foo { }; say Foo.gst | |||
camelia | No such method 'gst' for invocant of type 'Foo'. Did you mean 'gist'? in block <unit> at <tmp> line 1 |
||
AlexDaniel | m: class Foo { }; say Foo.gint | ||
camelia | 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 |
||
ktown | rocky error, with out testing myself. how does python scope? | 02:20 | |
ktown googles | |||
local to block | 02:23 | ||
timotimo | fortunately they've introduced "nonlocal" a few years ago | ||
ktown | I know that declaring every var and hard typeing it the 'right' way but not the easy way | 02:26 | |
02:26
AlexDaniel left
|
|||
ktown | the all or nothing of p5 'use strict' forcing declariation made me avoid it. | 02:27 | |
Zoffix | ktown: `use strict` in Perl 5 is lexical. | 02:28 | |
$ perl -e '$x = 42; { use strict; my $y; }; print $x' | 02:29 | ||
42 | |||
ktown | m: no strict; use localscope; $a =1 ; say $a ; { my $a = 2 say $a} | 02:32 | |
camelia | ===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… |
||
ktown | m: no strict; use localscope; $a =1 ; say $a ; { my $a = 2 ; say $a} | ||
camelia | ===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… |
||
Zoffix | "localscope" is not a thing. | ||
You could do implement it with a slang, since we have support for local variables in QAST | 02:33 | ||
ktown | I know :( | ||
Zoffix | (slangs are an unsupported experimental feature tho) | ||
or maybe it's possible with a macro | |||
oh, nm, I thought you could write QAST directly in macros | 02:35 | ||
02:35
pilne left
|
|||
ktown | use strict was always to strict and got in the way of doing things | 02:37 | |
02:37
atroxaper joined
|
|||
Zoffix | Well, there's always PHP, eh? | 02:37 | |
ktown | no, there is node.js | 02:38 | |
Zoffix | I thought `'use strict';` was now in vogue in JS | ||
ktown | in JS you use lint to tell you to not use global vars | 02:39 | |
02:43
Herby_ left
|
|||
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:51 | |
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? | ||
Zoffix | timotimo: yeah | 02:54 | |
timotimo wouldn't know | |||
Zoffix | not just IO, there's a whole bunch of plugins. Including IRC clients and everything | ||
It's an async loop and I always found its interface clunky AF | |||
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: github.com/zoffixznet/z/blob/master/bin/z | 02:55 | ||
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 | ||
m: say .1 + .2 == .3 | |||
camelia | True | ||
ktown | Zoffix: true true the sub main and multi dispatch is AWESOME! the stuff i put on rosetta code as an eg | ||
Zoffix | ktown: ^ try that in python :P | ||
02:56
obra left
02:58
lernc0de joined
|
|||
ktown | do not get me wrong... I hire devs then teach them perl5 becasue it's tje most effective way to get stuff done | 02:59 | |
I do not think python is better, but have to ask why it's so popular | 03:00 | ||
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 | |
know Python, the code I've seen looks like line noise compared to Perl 6: perl6.party/post/Python-is-The-New...e-Language en.wikipedia.org/wiki/C3_lineariza..._Python_3. perl6 > node.js === no idea about node.js | |||
xq | POE is very good :) | 03:02 | |
ktown | I wrote my first IRC bot using POE in 2003 | ||
Zoffix | I released probably over 200 POE modules on CPAN | ||
eco: IRC::Client | |||
buggable | Zoffix, IRC::Client 'Extendable Internet Relay Chat client': github.com/zoffixznet/perl6-IRC-Client 6 other matching results: modules.perl6.org/s/ | ||
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? | ||
Zoffix | Oh right, something's broken | ||
ktown | I agree perl6 is better the POE | ||
tiz my point actually. perl6 should also be better for aync servers then node.js | 03:05 | ||
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 | |
Note: not trying to start some sort of language war - only want your insights | |||
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 | ||
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 | |||
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. | |||
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 | ||
Zoffix | ktown: it might be. Check out Cro mi.cro.services | 03:08 | |
timotimo | joking aside, i barely know more than surface-level stuff about CL | ||
i'm off for today o/ | 03:11 | ||
lernc0de | I barely know more than barely surface-level stuff about P6. ;) | ||
ktown | Zoffix: when I was a kid I used BASIC... then in university Pascal. then the kids used JAVA, now python | ||
Zoffix | I did Pascal in college and when I flunk out I kept trying to use Delphi to write programs in., | 03:12 | |
ktown | not that crappy VBA. C64 BASIC | 03:13 | |
ktown plans to implement a C64 irc bot | 03:14 | ||
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 | ||
ktown | C64: 20 GOTO 10 | ||
TEttinger | there are still a ton of variants | ||
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:17 | |
Is P6 more modular in this respect? Sorry if this is an annoying beginner question | 03:18 | ||
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 :) | ||
ktown | acmebot.com/py/ | 03:23 | |
if she needs help I will have to learn python :( | |||
Zoffix | CaR Grant Report for May: blogs.perl.org/users/zoffix_znet/20...-2018.html | 03:25 | |
xq | nice | 03:31 | |
native rational numbers is a great feature that perl 6 and common lisp share | 03:32 | ||
03:32
AlexDaniel joined
03:38
mcmillhj joined
03:40
Zoffix left
03:42
mcmillhj left
|
|||
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:43 | |
b2gills | perl6book.com/ | 03:44 | |
lernc0de | I've seen the chart previously, but couldn't decide between fundamentals and deep dive. | 03:46 | |
ktown | lernc0de: are you proficient in another lang or is this your first? | 03:48 | |
lernc0de | I know C quite well, and am familiar with Common Lisp/Python | 03:49 | |
ktown | so it's just syntax, and the perl6 lang does sooo0o much of the heavy lifting, have fun | 03:51 | |
lernc0de | I will! :] | 03:54 | |
Thank you, have a great night everyone. Till next time | |||
b2gills | I would say that I would probably have difficulty choosing between fundamentals and deep dive. | ||
lernc0de | Perhaps I will invest in both this summer | ||
03:56
lernc0de left
03:58
skids left
|
|||
ktown | cool: POE::Component::WWW::XKCD::AsText | 04:06 | |
04:11
pecastro left
04:12
pecastro joined
04:21
khw left
04:22
ufobat_ joined
04:25
eliasr left
04:29
atroxaper left
04:44
curan joined
05:00
jmerelo joined
05:09
aindilis joined
|
|||
lookatme | The documents is K&R for Perl 6 | 05:20 | |
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!` www.reddit.com/r/ProgrammingLangua...s/dz0mmxn/ | ||
05:34
sauvin joined
05:39
abraxxa joined
05:42
AlexDaniel left
05:43
abraxxa left
|
|||
tyil | weekly: www.reddit.com/r/ProgrammingLangua...t/dz1lc4t/ | 05:49 | |
notable6 | tyil, Noted! | ||
Geth | doc: mryan++ created pull request #2027: Make the availability of p6doc clearer |
06:01 | |
06:04
abraxxa joined
06:06
shareable6 left
06:07
domidumont joined
|
|||
Geth | doc: 94754ee350 | (Martin Ryan)++ (committed by Moritz Lenz) | doc/Language/faq.pod6 Make the availability of p6doc clearer |
06:08 | |
synopsebot | Link: doc.perl6.org/language/faq | ||
06:13
domidumont left,
domidumont joined
06:18
atroxape_ joined
06:19
Khisanth left,
parv joined
|
|||
Geth | doc: 48a2d0e84f | (JJ Merelo)++ | doc/Language/variables.pod6 Change the default number of threads Following @jnthn advice. Closes #1065, maybe for good this time. |
06:24 | |
synopsebot | Link: doc.perl6.org/language/variables | ||
06:26
abraxxa left,
labster left
06:32
Khisanth joined
06:33
HaraldJoerg joined
06:35
abraxxa joined
|
|||
jmerelo | moritz: we seem to have a proxy error in whateverable.6lang.org travis-ci.org/perl6/doc/jobs/379566309 | 06:39 | |
moritz | jmerelo: yes, just saw that. I don't think I can do anything about that though | 06:40 | |
who maintains that? AlexDaniel` maybe? | |||
jmerelo | moritz: who's in charge of those servers? AlexDaniel` ? | ||
He | |||
We are using that for retrieving perl6 binary for the tests. Maybe there's another high-availability server for that? | 06:41 | ||
AlexDaniel` | I'll check in 15 mins | 06:45 | |
moritz | ++AlexDaniel` | 06:48 | |
jmerelo | AlexDaniel`: thanks | 06:49 | |
06:49
rindolf joined,
robertle joined
06:50
Ven`` joined
06:51
darutoko joined
06:52
AlexDaniel joined
|
|||
tyil | weekly: www.reddit.com/r/perl6/comments/8j...sparrowdo/ | 06:52 | |
notable6 | tyil, Noted! | ||
06:52
shareable6 joined
|
|||
AlexDaniel | jmerelo: I have no idea what was wrong | 06:52 | |
jmerelo: a bunch of folks here have access to that server btw | 06:53 | ||
jmerelo: timotimo MasterDuke Zoffix | |||
jmerelo: but you should have access too | 06:54 | ||
jmerelo: which of the keys should I use? github.com/JJ.keys | |||
06:54
wamba joined
|
|||
jmerelo | AlexDaniel: let me see | 06:55 | |
AlexDaniel: the first one should work | 06:56 | ||
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
06:59
AlexDaniel left
|
|||
jmerelo | AlexDaniel`: maybe bintray? blog.bintray.com/2013/05/30/google...per-place/ | 06:59 | |
I think El_Che uses it for his packages... | |||
07:03
AlexDani` left,
abraxxa left
|
|||
AlexDaniel` | jmerelo: try `ssh [email@hidden.address] | 07:12 | |
jmerelo | AlexDaniel`: got it, thanks. | 07:13 | |
AlexDaniel` | jmerelo: as for uploading the binary somewhere, I can do it | ||
jmerelo | AlexDaniel`: I guess it's a matter of rebooting when it fails, right? | ||
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... | ||
AlexDaniel` | like, there are some rare moments when it doesn't even compile… | ||
jmerelo | AlexDaniel`: right, but at least we will avoid the problems of it being unavailable... | ||
AlexDaniel` | jmerelo: you can restart bots with `sake kill:botname` | ||
like `sake kill:shareable` | 07:15 | ||
jmerelo | AlexDaniel`: Great, thanks! | ||
07:15
vivus-ignis joined
|
|||
AlexDaniel` | another option is to run `htop` or the like and just do it there, works too | 07:16 | |
systemd will restart bots if they're dead for any reason | |||
jmerelo | AlexDaniel`: OK | ||
AlexDaniel` | jmerelo: filed an issue here: github.com/perl6/whateverable/issues/313 | 07:24 | |
07:26
AlexDani` joined,
Ven`` left
07:27
Ven`` joined,
AlexDani` is now known as AlexDaniel
07:28
Ven`` left,
Ven`` joined
07:38
mcmillhj joined
07:43
mcmillhj left
07:55
araujo left
08:11
andrzejku joined
08:24
dakkar joined
08:25
markong joined,
vivus-ignis is now known as ignis__away
08:28
ignis__away is now known as vivus-ignis
08:34
shareable6 left
|
|||
jmerelo | Just created the Whateverable tag in StackOverflow stackoverflow.com/questions/tagged/whateverable | 08:36 | |
It might come in handy for the next squashaton | |||
squashable6: status | |||
squashable6 | jmerelo, Can't parse the wiki page | 08:37 | |
jmerelo | Er | ||
08:44
HaraldJoerg left
08:47
notbenh joined,
notbenh left
08:48
[particle] joined,
[particle]1 left
08:49
HaraldJoerg joined
08:53
w_richard_w left
|
|||
Geth | doc: 544bd80924 | (JJ Merelo)++ | doc/Language/contexts.pod6 First version of the contexts document This would close #732. Problem is it is part of a larger document, #1225, which is by no means complete. Also was recently added to #114 as part of the language docs. |
08:54 | |
synopsebot | Link: doc.perl6.org/language/contexts | ||
doc: 08e976bb54 | (JJ Merelo)++ | doc/Language/contexts.pod6 Adds numeric context Refs #1225 and #124 |
|||
doc: ce6422af84 | (JJ Merelo)++ | 2 files Adds string context Refs #114 and #1225. There are still many contexts to go, but these are the three most important. I'll also revise #1225 to close it when enough meaningful contexts done. In general, most of them will be like ... (6 more lines) |
|||
AlexDaniel` | jmerelo: ouch :) | 09:08 | |
Geth | whateverable: 031cf5de52 | (Aleks-Daniel Jakimenko-Aleksejev)++ | bin/Squashable.p6 Change heuristic to support md cell alignment |
09:10 | |
09:11
squashable6 left,
squashable6 joined
|
|||
AlexDaniel | squashable6: status | 09:11 | |
squashable6 | AlexDaniel, Next SQUASHathon in 16 days and ≈0 hours (2018-06-02 UTC-12⌁UTC+14). See github.com/rakudo/rakudo/wiki/Mont...Squash-Day | ||
AlexDaniel | jmerelo: fixed, thanks | ||
09:18
domidumont left
09:19
araujo joined,
araujo left,
araujo joined
09:22
vivus-ignis is now known as ignis__away
09:27
ignis__away is now known as vivus-ignis
09:28
vivus-ignis is now known as ignis__away,
shareable6 joined
09:30
ignis__away is now known as vivus-ignis
|
|||
Geth | doc: a993e37fab | (JJ Merelo)++ | doc/Language/contexts.pod6 Adds string contextualizer ~ refs #1225 |
09:35 | |
synopsebot | Link: doc.perl6.org/language/contexts | ||
09:36
AlexDaniel left
09:37
atroxape_ left
09:38
enheh joined
09:44
Ven`` left
|
|||
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)? | ||
thundergnat: I'll pass your message to Zoffix. | |||
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 | |
.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. | |||
yoleaux | thundergnat: I'll pass your message to Zoffix. | ||
10:14
eliasr joined
10:20
parv left
10:21
atroxaper joined
10:22
lizmat joined
10:33
kurahaupo joined
10:34
Ven`` joined
10:37
vivus-ignis is now known as ignis__away
10:42
domidumont joined
10:47
vike left
|
|||
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. | ||
10:57
araujo left
11:01
Ven`` left
11:08
lichtkind joined
11:11
psychoslave joined
11:12
Ven`` joined
11:24
wamba left
11:25
ignis__away is now known as vivus-ignis
11:27
lichtkind left
11:35
psychoslave left
11:40
lichtkind joined
11:54
psychoslave joined
11:57
Ven`` left
11:59
vivus-ignis is now known as ignis__away
12:01
idiosyncrat joined
12:06
ignis__away is now known as vivus-ignis
12:07
vivus-ignis is now known as ignis__away
12:09
ignis__away is now known as vivus-ignis
12:15
shareable6 left
12:16
vike joined
12:17
leedo joined
12:26
Ven`` joined
12:32
Ven`` left
12:33
Ven`` joined,
lookatme left
12:34
lookatme joined
12:42
domidumont left
12:43
domidumont joined
12:46
mcmillhj joined
12:52
itaipu joined
12:54
MilkmanDan left
12:55
MilkmanDan joined
12:59
athenot joined
13:02
domidumont left
13:03
domidumont joined
13:05
robertle left
13:10
shareable6 joined,
ChanServ sets mode: +v shareable6
|
|||
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
13:19
vivus-ignis is now known as ignis__away
13:20
ignis__away is now known as vivus-ignis
|
|||
jkramer | m: my $b = bag 'a'..'c'; say $b<x>; say $b<a b x>; say $b<a b x>:p | 13:32 | |
camelia | 0 (1 1 0) (a => 1 b => 1) |
||
jkramer | Is this correct? Shouldn't the last say include a "x => 0"? | ||
Geth | doc: bd5617199a | (Will "Coke" Coleda)++ | doc/Language/contexts.pod6 whitespace |
13:33 | |
synopsebot | Link: doc.perl6.org/language/contexts | ||
doc: 9abdb9550e | (Will "Coke" Coleda)++ | doc/Language/5to6-nutshell.pod6 fix typo |
|||
synopsebot | Link: doc.perl6.org/language/5to6-nutshell | ||
13:37
skids joined
13:39
amalia___ joined,
amalia___ left,
amalia___ joined
13:47
vivus-ignis is now known as ignis__away
13:48
idiosyncrat left
13:59
lucasb joined,
uzl joined
14:06
athenot left
14:09
domidumont left
14:12
ExtraCrispy joined,
domidumont joined
14:16
wamba joined
14:19
Ven`` left
14:21
psychoslave left
14:23
uzl left,
uzl_ joined,
psychoslave joined,
uzl_ left,
ExtraCrispy left
|
|||
lucasb | m: multi f(NaN) {}; multi f(NumStr) {}; multi f(ProtocolType) {}; multi f(UInt) {}; f | 14:24 | |
camelia | ===SORRY!=== Circularity detected in multi sub types for &f |
||
lucasb | ^^ I wonder what's the interaction between these values? | ||
14:31
Ven`` joined
14:34
curan left
14:42
Ven`` left
14:49
molaf joined
14:52
wamba left
14:57
domidumont left
15:01
ExtraCrispy joined
|
|||
mcmillhj | jkramer: according to the docs on the subscript :p adverb, it skips non-existent elements: docs.perl6.org/language/subscripts..._%3Ap-%3Ap | 15:03 | |
jkramer: :!p can be used to non silently skip them | 15:04 | ||
m: my $b = bag 'a' .. 'c'; say $b<a b x>:!p; | |||
camelia | (a => 1 b => 1 x => 0) | ||
15:09
ignis__away is now known as vivus-ignis
|
|||
jkramer | mcmillhj: Sweet, thank you! | 15:10 | |
15:12
mahafyi joined
15:26
robertle left
15:32
hythm_ joined
15:35
athenot joined,
g- joined
|
|||
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 | ||
hythm_ | m: grammar G {token a {'a'}; token b {<?after 'a'> 'b'}; token TOP {<a><b>};}; G.parse('ab').say; # works | 15:38 | |
camelia | 「ab」 a => 「a」 b => 「b」 |
||
hythm_ | m: grammar G {token a {'a'}; token b {<?after <a>> 'b'}; token TOP {<a><b>};}; G.parse('ab').say; # works | ||
camelia | 「ab」 a => 「a」 b => 「b」 |
||
hythm_ | m: grammar G {token a {'az'}; token b {<?after 'az'> 'b'}; token TOP {<a><b>};}; G.parse('ab').say; # works | ||
camelia | Nil | ||
hythm_ | m: grammar G {token a {'az'}; token b {<?after 'az'> 'b'}; token TOP {<a><b>};}; G.parse('ab').say; | 15:40 | |
camelia | Nil | ||
15:41
psychoslave left
|
|||
hythm_ | m: grammar G {token a {'az'}; token b {<?after 'az'> 'b'}; token TOP {<a><b>};}; G.parse('azb').say; # works | 15:41 | |
camelia | 「azb」 a => 「az」 b => 「b」 |
||
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 | 「ab」 a => 「a」 b => 「b」 |
||
15:43
psychoslave joined
|
|||
hythm_ | Sorry for confusion, but looks like last one did not work on my box... it worked here though | 15:44 | |
15:44
enheh left
|
|||
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」» | ||
hythm_ | m: grammar G {token a {'az'}; token b {<?after <a>> 'b'}; token TOP {<a><b>};}; G.parse('azb').say; # not working | ||
camelia | Nil | ||
15:47
psychoslave left,
vivus-ignis is now known as ignis__away
15:48
stdio joined
|
|||
hythm_ | Why this does not work^. If i replaced <a> with 'az' ..inside <?after...> ,, it works fine | 15:49 | |
15:52
ignis__away left
|
|||
timotimo | hm, something wrong with the flipping algorithm, i wonder | 15:52 | |
mcmillhj | m: my $b = bag 'a' .. 'c'; say $b<a b x>:!p; | 15:56 | |
camelia | (a => 1 b => 1 x => 0) | ||
mcmillhj | oops, mt | ||
16:01
hythm_ left
16:13
robertle joined
16:14
stdio left
16:17
HaraldJoerg left
16:30
Praise left
16:32
raynold joined
|
|||
tobs | m: say $[1,2,3,4][*..*-3] | 16:33 | |
camelia | Cannot convert -Inf to Int: in block <unit> at <tmp> line 1 |
||
16:35
dakkar left,
comborico1611 joined
|
|||
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»» | ||
lucasb | strange, locally I get "Unhandled exception: No exception handler located for warn" | 16:41 | |
tobs | I get an additional "Use of uninitialized value $!reason of type Any in string context." but my rakudo is old | 16:42 | |
timotimo | a bare * has a special meaning to the .. operator | 16:59 | |
m: say $[1, 2, 3, 4][^(*-2)] | |||
camelia | (1 2) | ||
timotimo | m: say $[1, 2, 3, 4][{ $_ .. $_ - 2 }] | ||
camelia | () | ||
16:59
xinming_ joined
|
|||
timotimo | m: say $[1, 2, 3, 4][{ $_ .. ($_ - 2) }] | 17:00 | |
camelia | () | ||
timotimo | oh? | ||
m: say $[1, 2, 3, 4][{ say $_; $_ .. ($_ - 2) }] | |||
camelia | 4 () |
||
timotimo | m: say $[1, 2, 3, 4][{ say $_; say ($_ .. ($_ - 2)) }] | ||
camelia | 4 4..2 2 |
||
timotimo | ah, of course | ||
tobs | m: say $[1, 2, 3, 4][{ $_ ... ($_ - 2) }] | ||
camelia | ((Any) 4 3) | ||
17:00
pilne joined
|
|||
timotimo | ah, is that what you wanted? | 17:00 | |
17:00
mcmillhj left
|
|||
tobs | Almost. I wanted the last $k elements in reverse order, without an (Any) | 17:01 | |
I'm using using .reverse now :-) | |||
*just using | |||
timotimo | my suggestion would probably be: | ||
m: say $[1, 2, 3, 4].tail(4).reverse | 17:02 | ||
camelia | (4 3 2 1) | ||
timotimo | m: say $[1, 2, 3, 4].tail(2).reverse | ||
camelia | (4 3) | ||
tobs | Ah, yes. That reads better | ||
17:02
xinming left
17:03
psychoslave joined
17:09
MasterDuke left
17:20
mcmillhj joined
17:24
mcmillhj left
17:32
mcmillhj joined,
domidumont joined
17:40
mcmillhj_ joined
17:48
athenot_ joined
17:49
atroxaper left
17:50
athenot left
17:52
Praise joined,
Praise left,
Praise joined
18:03
ignis__away joined
18:05
psychoslave left
|
|||
jmerelo | O/ | 18:15 | |
18:21
sauvin left
18:25
ignis__away left
18:45
comborico1611 left
18:49
ignis__away joined
18:52
jmerelo left
18:55
comborico1611 joined
18:56
darutoko left
18:57
athenot_ left
|
|||
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:58 | |
lizmat | bummer, also not with --force ? | 18:59 | |
samcv | yeah well then the irc server doesn't work :) | ||
i get Cannot locate symbol 'sk_num' in native library 'libssl.so' | 19:00 | ||
19:00
enheh joined
|
|||
samcv | this seems similar? 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? | ||
samcv | what? sid? or openssl 1.1h? | 19:01 | |
seems like functions changed maybe | |||
19:04
ignis__away is now known as vivus-ignis
|
|||
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 | |
... | |||
===> Installing: IRC::Client:ver<3.007006> | |||
seems to work on Ubuntu if you install libssl1.0 | |||
(it's not a Star image, though) | |||
19:10
athenot joined
19:13
domidumont left
19:15
mcmillhj_ left
19:21
Zoffix joined
19:22
vivus-ignis is now known as ignis__away
19:23
Zoffix left
19:31
Zoffix joined
|
|||
Zoffix | samcv: FWIW, installs fine on openssl-1.1.1-pre6 | 19:32 | |
on 2018.04-20-g7847768 built on MoarVM version 2018.04-34-g25f165a | 19:33 | ||
19:44
psychoslave joined
19:55
wamba joined
19:57
sno left
19:59
sno joined
20:01
mahafyi left
|
|||
lucasb | gist.github.com/lucasbuchala/70473...7dd46192ff | 20:01 | |
^^ can anyone confirm this behavior? | 20:02 | ||
is it a bug? | |||
Zoffix | There's a bug that has same error R#131574 | 20:03 | |
There's a bug that has same error RT#131574 | |||
synopsebot | RT#131574 [new]: rt.perl.org/Ticket/Display.html?id=131574 [BUG] Incorrect circularity detection with infix:<+> | ||
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,
Zoffix left
|
|||
lucasb | hmm, you already stumbled upon it | 20:06 | |
20:06
espadrine joined
20:07
lancew left
20:09
enheh left
20:10
athenot_ joined
20:11
athenot left
20:14
zachk joined,
athenot_ left
20:16
robertle left,
zachk left,
zachk joined
|
|||
samcv | ZofBot: are you sure you don't have libssl1.0-dev? | 20:18 | |
or maybe the nondev. anyway i installed it and now it works | |||
El_Che | samcv: the way most nativecall modules find their libraries is flaky | 20:20 | |
samcv | well it finds it | 20:21 | |
well. idk. | |||
El_Che | it find 1.0 not 1.1 | ||
what installed by default on recent distros | 20:22 | ||
and the user has no clue he needs to install an older version | |||
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:23 | ||
20:24
espadrine left
20:25
athenot joined
20:27
espadrine joined
20:30
mcmillhj_ joined
20:31
amalia___ left
|
|||
samcv | my post on the new perl 6 hashing changes and explaining the security issue it solves is now live: cry.nu/perl6/secure-hashing-for-moarvm/ | 20:36 | |
El_Che | \o/ | 20:37 | |
20:41
athenot_ joined
20:42
athenot left
|
|||
moritz | samcv++ | 20:45 | |
20:55
mcmillhj_ left
20:57
athenot joined,
lucasb left,
mcmillhj left,
athenot_ left
21:03
mcmillhj joined
21:09
mcmillhj_ joined
21:10
mcmillhj left
21:14
mcmillhj_ left
21:19
athenot left
21:20
skids left,
MasterDuke joined
21:21
athenot joined
21:24
kurahaupo left
21:25
molaf left
21:26
kurahaupo joined,
mcmillhj joined
21:31
mcmillhj left
21:32
mcmillhj joined
|
|||
samcv | i'm going to expand the user facing changes section to have more recommendations of do's and don'ts | 21:40 | |
21:43
mcmillhj_ joined,
kurahaupo left
21:44
kurahaupo joined,
rindolf left
21:45
mcmillhj left
21:46
athenot left,
athenot_ joined
21:48
mcmillhj_ left
|
|||
samcv | anybody want to check out this section and tell me if it can be improved? cry.nu/perl6/secure-hashing-for-mo...ng-changes | 21:48 | |
lizmat | samcv: @stuff.push: $i; s/$i/$key/ ? | 21:51 | |
samcv | ah yes | 21:52 | |
lizmat++ and let me know if there's more i should touch on | |||
21:53
vivus-ignis joined
|
|||
lizmat | "identify items that need fixes" s/fixes/fixing/ ? | 21:53 | |
21:53
ignis__away left
|
|||
samcv | had been way too long since i made a blog post | 21:54 | |
21:54
reu_ left
|
|||
samcv | also hoping the pictures were helpful. i just used draw.io to make it | 21:55 | |
21:57
vivus-ignis left
21:59
lichtkind left
22:00
mcmillhj joined
22:03
espadrine left
22:04
itaipu left
22:05
mcmillhj left
22:13
wamba left
|
|||
comborico1611 | samcv: Very good! | 22:15 | |
22:15
comborico1611 left,
comborico1611 joined,
mcmillhj joined
22:16
reu joined
22:20
mcmillhj left
|
|||
samcv | thanks! | 22:22 | |
22:23
athenot joined,
athenot_ left
22:28
athenot left,
wamba joined
22:29
wamba left
22:31
mcmillhj joined
22:32
lucasb joined
|
|||
lucasb | samcv: "Assuming s/everthing/everything/ is fine ..." | 22:34 | |
22:36
Kaiepi joined,
mcmillhj left,
mcmillhj joined
|
|||
samcv | lucasb: thanks! | 22:36 | |
22:40
thundergnat left
|
|||
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 modules.perl6.org/dist/PDF::Class:cpan:WARRINGD | ||
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 | ||
that was also mentioned in the c3 talk | 22:44 | ||
samcv | i don't see us doing that? | ||
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 | ||
samcv | also eventually we may want to rekey our hashes if there are too many collisions, perl 5 does thta at least | ||
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 | ||
which will make collisions even rarer | |||
timotimo | right | ||
does that also make all our hashes bigger? or just our strings for the cached hash value? | |||
22:45
AlexDaniel joined
22:46
skids joined
|
|||
samcv | timotimo: ah we do do that | 22:46 | |
timotimo | how would re-keying work? | ||
samcv | though it should only happen 1/2147483648 chance | 22:47 | |
timotimo | have a "salt" for every hash? | ||
right, siphash makes it hard to get that exact value | |||
samcv | if our bucket is still full after doubling the buckets then we rekey | ||
timotimo | even harder than getting two strings with just the same hash value | ||
22:48
ryn1x left
|
|||
samcv | timotimo: let me see if i can make a hash that has 0. one sec | 22:48 | |
i've already separated out mvm's hash function and made code to brute force codes. so let me see | 22:49 | ||
timotimo | did you vectorize it yet? ;) | 22:50 | |
samcv | haha | 22:52 | |
22:57
mcmillhj left
|
|||
samcv | timotimo: yes it can be one | 22:57 | |
(our current hash function, not sure about siphash but probably yes | |||
22:58
mcmillhj joined
|
|||
timotimo | sorry, can be one? | 22:58 | |
you mean can't be zero? | |||
samcv | no it can be zero | ||
timotimo | OK | 22:59 | |
samcv | i mean we could add one to it? | ||
timotimo | then we can hit 0 again if we overflow? :D | 23:00 | |
23:01
n00b_ joined
|
|||
n00b_ | m: say -15 ** 0.5; say (-15, -16, -17) >>**>> 0.5; | 23:02 | |
camelia | -3.872983346207417 (NaN NaN NaN) |
||
n00b_ | why doesn't the hyper work? | ||
23:02
mcmillhj left
|
|||
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 | ||
n00b_ | nice | ||
I can never figure out when I need the pair >> >> vs when I can get away with one >> | |||
samcv | timotimo: overflow? | 23:04 | |
timotimo | one >> is only for prefix or postfix operators and method calls | ||
the reason why your two ** 0.5 pieces differ is because of the precedence between - and ** | |||
you're actually calculating -(15 ** 0.5) | |||
whereas in the second one you're calculating (-15) ** 0.5 | |||
you can get complex numbers if you want, but you'll have to start out with a complex number first | |||
m: say <-15+0i> ** 0.5 | 23:05 | ||
camelia | 2.3715183290419594e-16+3.872983346207417i | ||
timotimo | m: say (<-15+0i> ** 0.5) ** 2 | ||
camelia | -15+1.83697019872103e-15i | ||
timotimo | does that help? | ||
n00b_ | It does help, yes. | 23:06 | |
At least I know the syntax >>**>> 0.5 is meaningful | |||
brb | |||
timotimo | :) | ||
23:14
kurahaupo left,
mcmillhj joined
23:18
mcmillhj left,
markong left
23:23
kurahaupo joined
|
|||
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 | |
Is there some syntax I could make use of to move the sqrt and abs to the left of the expression? | |||
timotimo | yup | 23:24 | |
m: say .>>sqrt.>>abs given [Z-] ( (1,2,3) , (4,5,6) ) >>**>> 2 | |||
camelia | 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 |
||
timotimo | m: say $_.>>sqrt.>>abs given [Z-] ( (1,2,3) , (4,5,6) ) >>**>> 2 | ||
camelia | 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 |
||
timotimo | m: say $_>>.sqrt>>.abs given [Z-] ( (1,2,3) , (4,5,6) ) >>**>> 2 | ||
camelia | (NaN NaN NaN) | ||
timotimo | oh? | ||
n00b_ | ah, nice, I forget that $_ is there, because it's so often elidable | ||
timotimo | m: say [Z-] ( (1,2,3) , (4,5,6) ) >>**>> 2 | 23:25 | |
camelia | (-15 -21 -27) | ||
timotimo | ah, right, of course that becomes NaN xx 3 | ||
23:25
kurahaupo_ joined
|
|||
n00b_ | m: $_>>.abs>>.sqrt given [Z-] ( (1,2,3) , (4,5,6) ) >>**>> 2 | 23:26 | |
camelia | ( no output ) | ||
n00b_ | m: say $_>>.abs>>.sqrt given [Z-] ( (1,2,3) , (4,5,6) ) >>**>> 2 | ||
camelia | (3.872983346207417 4.58257569495584 5.196152422706632) | ||
timotimo | ah, that's why | ||
n00b_ | m: say $_>>.abs>>.sqrt given 2 R>>**>> [Z-] ( (1,2,3) , (4,5,6) ) | 23:27 | |
camelia | (3 3 3) | ||
23:27
kurahaupo left
|
|||
n00b_ | m: say $_>>.abs>>.sqrt given ( 2 R>>**>> [Z-] ( (1,2,3) , (4,5,6) ) ) | 23:27 | |
camelia | (3 3 3) | ||
timotimo | should also be able to <<R**<< | 23:28 | |
though i suppose the R>>**>> version is a little faster | |||
n00b_ | I think your version is easier to understand | ||
or rather maps better to the concept I'm thinking of | |||
timotimo | there's also feeds, fwiw | 23:29 | |
i don't use them often at all, so let's see if i remember them right | |||
oh, no, that would need maps, that'd be dumb | |||
23:29
kurahaupo joined
|
|||
n00b_ | m: 2 RZ** (1,2,3) | 23:30 | |
camelia | Potential difficulties: Useless use of RZ** in sink context at <tmp>:1 ------> 032 7⏏5RZ** (1,2,3) |
||
n00b_ | m: say 2 RZ** (1,2,3) | ||
camelia | (1) | ||
n00b_ | m: say (1,2,3) Z** 2 | ||
camelia | (1) | ||
n00b_ | hmm | ||
timotimo | Z stops at the shorter list | ||
m: say (1,2,3) Z** 2 xx * | |||
camelia | (1 4 9) | ||
23:31
mcmillhj joined
|
|||
n00b_ | Nice. | 23:31 | |
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) | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Missing << or >> at <tmp>:1 ------> 3say >>.7⏏5abs given (1, -2, 3) |
||
timotimo | right, needs the $_ to work | ||
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 | ||
TimToady | m: say (1,2,3) X** 2 | 23:33 | |
camelia | (1 4 9) | ||
23:33
kurahaupo_ left
|
|||
timotimo | oh, of course | 23:33 | |
i'll take this as a sign that i should really go to bed soon | |||
n00b_ | m: 2 RX** (1,2,3) | ||
camelia | Potential difficulties: Useless use of RX** in sink context at <tmp>:1 ------> 032 7⏏5RX** (1,2,3) |
||
n00b_ | m: say 2 RX** (1,2,3) | ||
camelia | (1 4 9) | ||
n00b_ | wooo! | ||
that's slick. | |||
TimToady | actually... | ||
23:33
shareable6 left
|
|||
TimToady | m: say 2 RX** 1,2,3 | 23:33 | |
camelia | (1 4 9) | ||
TimToady | X and Z are listops, so you don't really need the parens on the lists | 23:34 | |
(unlike hypers) | |||
n00b_ | Thanks, but in my case it'll be [Z-] ((1,2,3) , (4,5,6)) | ||
or rather @a and @b because it's a sub | |||
TimToady | so you don't need the outer parens, prolly | ||
n00b_ | m: say 2 RX** [Z-] (1,2,3) , (4,5,6) | 23:35 | |
camelia | (9 9 9) | ||
n00b_ | hahah | ||
love it | |||
23:35
kurahaupo_ joined
|
|||
n00b_ | I'm a little sad about the $_ needed in $_>>.abs>>.sqrt ... but c'est le vie | 23:35 | |
23:36
mcmillhj left
|
|||
timotimo | if you don't want the $_, you can also .map(*.abs.sqrt) | 23:36 | |
TimToady | m: say .».abs for -1, -2, -3 | ||
camelia | 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 |
||
tobs | m: *».abs».sqrt with 1,-2,3 | ||
camelia | ( no output ) | ||
tobs | m: *».abs».sqrt.say with 1,-2,3 | ||
camelia | (1 1.4142135623730951 1.7320508075688772) | ||
n00b_ | Oh! I like that! | ||
Whatever stars are one of my favorite parts of P6 | 23:37 | ||
tobs | I stumbled upon it earlier today as well :-) | ||
23:37
kurahaupo left
|
|||
TimToady | m: say .self».abs for -1, -2, -3 | 23:38 | |
camelia | (1) (2) (3) |
||
TimToady | look no $_ ;) | ||
timotimo | then you'll also not need the » | ||
23:38
kurahaupo_ is now known as kurahaupo
|
|||
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 | (3 3 3) | ||
n00b_ | nice | ||
very clean | |||
TimToady | m: say .self».abs for (-1, -2, -3), (-4,-5,-6) | ||
camelia | (1 2 3) (4 5 6) |
||
n00b_ | duh, forgot the su | ||
m: sub cartesian_distance(@a, @b) { *>>.abs>>.sqrt with [+] 2 RX** [Z-] @a, @b }; say cartesian_distance( (1,2,3) , (4,5,6) ) | |||
camelia | (5.196152422706632) | ||
n00b_ | Look ma, no loops. | 23:40 | |
tobs | Perl 6 has all the loops you'll ever need built in | 23:41 | |
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? | ||
timotimo | this is the point where i'd probably go for at least one explicit loop, weak little me | 23:43 | |
n00b_ | I know. I ask because i'm trying to solve this little twitter puzzle: twitter.com/Hillelogram/status/996...3456390144 | 23:44 | |
You can ignore most of the code there. We've written +/&.:*:@:- as cartesian_distance here. | |||
The point of the challenge is to write the equivalent to J's / operator | |||
23:45
pecastro_ joined
|
|||
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 | |
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 | |||
I'd like an operator that does that in P6 | |||
(the "1 is also relevant, but leave that for now) | 23:46 | ||
timotimo | rosettacode.org/wiki/Kronecker_product#Perl_6 - is this relevant? | 23:47 | |
it has an explicit loop, though | |||
23:47
pecastro left,
mcmillhj joined
|
|||
n00b_ | it's thematically related, but that seems like it does a mmult for each scalar in A with the entire matrix B | 23:48 | |
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 | ||
but if it stops at the shorter list, that's problematic | |||
timotimo | only Z does that | ||
TimToady | but X only extends a scalar to a list at the top level | ||
timotimo | X goes through every item on both sides | ||
true that | |||
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)) | ||
TimToady | hmm | 23:51 | |
n00b_ | m: say ((1, 2, 3), (4, 5, 6)) << <<+>> >> ((7,8,9), (10,11,12)) | ||
camelia | 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:51
mcmillhj left
|
|||
n00b_ | m: say ((1, 2, 3), (4, 5, 6)) <<<<+>>>> ((7,8,9), (10,11,12)) | 23:52 | |
camelia | 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 |
||
TimToady | «op» is more like APL, which would autorepeat 4,5,4,5,4,5... | ||
n00b_ | Yes, that's what I want. | ||
timotimo | hyperops descend into substructures, too | ||
n00b_ | m: say ((1, 2, 3), (4, 5, 6)) <<+>> ((7,8,9), (10,11,12)) | ||
camelia | ((8 10 12) (14 16 18)) | ||
n00b_ | oh! | ||
timotimo | m: my %left = :1hey, :2bye, :3foo; my %right = :9boo, :8bye, :4foo; say %left «~» %right | 23:53 | |
camelia | {bye => 28, foo => 34} | ||
23:53
lucasb left
|
|||
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 | |
m: my %left = :1hey, :2bye, :3foo; my %right = :9boo, :8bye, :4foo; say %left »~« %right | |||
camelia | {boo => 9, bye => 28, foo => 34, hey => 1} | ||
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 | 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
|
|||
TimToady | s/post/in/ ??? | 23:56 | |
Herby_ | o/ | ||
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) | ||
camelia | 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… |
||
TimToady | that looks like an infix to me | ||
n00b_ | haha, yes | ||
m: sub infix:<c_d>(@a, @b) { *>>.abs>>.sqrt with [+] 2 RX** [Z-] @a, @b }; say (1, 2, 3) c_d (4, 5, 6) | |||
camelia | (5.196152422706632) | ||
23:56
zachk left
|
|||
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:56 | |
camelia | 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 | ||
Do hypers necessarily descend all the way to scalars? | 23:58 | ||
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 | ||
the bottom-most thing that matches the type sig | |||
TimToady | we know with unaries to check for 'is nodal', but binaries ignore that |