Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2017-11-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 jstuder joined #perl6
00:01 ryn1x joined #perl6
00:13 cdg joined #perl6
00:19 mcmillhj joined #perl6
00:32 ryn1x joined #perl6
00:35 mcmillhj joined #perl6
00:47 mcmillhj joined #perl6
01:00 mcmillhj joined #perl6
01:00 lizmat joined #perl6
01:02 comborico1611 Pong
01:03 lookatme Ping
01:03 MasterDuke_ joined #perl6
01:03 comborico1611 Hi
01:14 mcmillhj joined #perl6
01:15 comborico1611 Anyone else studying?
01:27 notbenh joined #perl6
01:28 gabiruh joined #perl6
01:28 R0b0t1_ joined #perl6
01:28 Gothmog_ joined #perl6
01:28 gfldex joined #perl6
01:28 leedo__ joined #perl6
01:28 avar joined #perl6
01:28 literal joined #perl6
01:28 obra joined #perl6
01:28 samebchase joined #perl6
01:28 moritz joined #perl6
01:28 incredible_ joined #perl6
01:28 teatime joined #perl6
01:28 Celelibi joined #perl6
01:28 tinita joined #perl6
01:28 cxreg joined #perl6
01:28 hcit joined #perl6
01:29 mcmillhj joined #perl6
01:31 yoleaux joined #perl6
01:36 kalkin--- joined #perl6
01:40 comborico1611 Yup.
01:41 lookatme Studying what ?
01:41 ryn1x joined #perl6
01:43 comborico1611 C
01:44 comborico1611 Trying to study to get a job where i can work from home.
01:44 lookatme Oh, are you a student  ?
01:44 comborico1611 Studying to try to get a job*
01:45 comborico1611 Nope. I'm 31 years old.
01:45 lookatme oh
01:46 lookatme So you want find a C dev job ?
01:47 comborico1611 I'm not sure what field. Code maintenance or networking sound good.
01:47 mcmillhj joined #perl6
01:49 lookatme oh, what language are you good at ?
01:50 comborico1611 I know c++ best.
01:50 lookatme Oh, I'm c/c++ develop too
01:51 comborico1611 But I'm not talented in pr
01:51 lookatme s/develop/developer/
01:51 comborico1611 Development. I think I'd be better suited not in development.
01:52 lookatme How about software tester ?
01:52 comborico1611 s/develop/developer/?
01:53 comborico1611 I'm haven't been exposed to that. I'm definitely meticulous.
01:53 lookatme oh
01:54 comborico1611 Is tester a prolific occupation?
01:54 TEttinger comborico1611: if you're studying, you're a student :)
01:55 lookatme I'm not get it, "prolific"?
01:55 TEttinger if you're studding, you may be a horse
01:55 lookatme Haha :)
01:55 comborico1611 Heh. True, but i didn't want to give the impression I'm a formal student.
01:55 TEttinger true true
01:55 piojo_ joined #perl6
01:56 lookatme We are all student in Perl6
01:56 comborico1611 Yup.
01:58 TEttinger I don't know what the employment situation is like for C. But I know I'd rather deal with C than recoil in horror at some of the C++ I see: https://github.com/imneme/pcg-cpp/blob/master/include/pcg_random.hpp#L513-L528
01:59 mcmillhj joined #perl6
01:59 comborico1611 I can't follow that.
01:59 TEttinger to be honest, I have no clue what that does. I think it's internal to that library, but I tried to port it
01:59 TEttinger it's C++ template gore
02:00 comborico1611 lol
02:00 comborico1611 I haven't learned c++14 update.
02:01 lizmat joined #perl6
02:03 TEttinger I think that's actually some older version, since it was written around 2014 IIRC, or earlier
02:03 TEttinger maybe C++11
02:04 comborico1611 Lookatme, how long have you been in the business?
02:05 comborico1611 Oh yeah, i forgot about 11.  They must have messed up.  98, 11, 14, 17.
02:06 TEttinger haha
02:06 TEttinger yeah
02:06 TEttinger it was C++0x for a while
02:06 TEttinger then the 00s passed with no update
02:07 comborico1611 I see.
02:07 TEttinger it's not quite the same as Java 9, which was also delayed without end. But I wouldn't say a stable release of Java 9 has come out yet, since they released it by throwing it to the pavement
02:07 comborico1611 Hmm. I didn't know that.
02:08 TEttinger I just have had a rotten time with Java 9 stuff, it does seem to break most moderately-complex software
02:08 comborico1611 That's too bad. I'm rooting for Java, in the Java vs C# battle.
02:08 TEttinger Java has more open source libs in the ecosystem, but C# is actually open source and won't get Oracle to sue you for billions of dollars if you fork it
02:09 TEttinger Oracle v. Google, settled out of court for $0 but caused lasting legal damage to open source as a concept, potentially. thanks Oracle...
02:09 comborico1611 Microsoft can turn rabid on you.
02:10 itaylor57 joined #perl6
02:10 comborico1611 Hmm. I was unaware.
02:10 TEttinger that's a concern, but Oracle already has
02:10 TEttinger Oracle's lawyers argued that the Java API, not even the code, was copyrightable, which no court had previously allowed
02:10 TEttinger which would make open source versions of closed source APIs illegal
02:11 TEttinger or at least a breach of copyright
02:11 comborico1611 I can see Microsoft making C# opensource for however many years for C# to get established, then start licensing it.
02:11 TEttinger can't
02:12 TEttinger it's MIT licensed, you can't pull the existing MIT licensed code out of that state
02:12 TEttinger OpenJDK is GPL with classpath exception, IIRC
02:12 comborico1611 You seem you have legal training, no?
02:12 TEttinger none, I just follow all this junk
02:13 comborico1611 Self-learned is better. I'm self learned legal student.
02:13 TEttinger Oracle still holds tremendous influence over OpenJDK via funding development. they defunded JSON parsing in Java 9 for unknown reasons
02:13 comborico1611 So you think C# is a great balance to Java?
02:14 TEttinger Microsoft is currently the biggest contributor to the Linux kernel (all GPL, they I believe need to abide by Linux kernel contributor rules which may help the patent issue), and one of if not the largest organization contributing to open source on GitHub
02:15 TEttinger it's a shocking turnaround. windows 10 still has lots of sketchy telemetry stuff
02:15 TEttinger oracle at least isn't doing that, other than the ask toolbar installer in the java installer
02:15 comborico1611 I hate 10 (9).
02:16 TEttinger same. I had to go through a serious amount of work to install windows 7 on this recent laptop, but it did work
02:16 mcmillhj joined #perl6
02:16 TEttinger ubuntu (I used xubuntu) has better out-of-the-box hardware support than windows 7, which is nicee
02:17 comborico1611 Kubuntu for me.
02:17 TEttinger if a hardware switch on this laptop turns off, I plug in a liveusb and I can turn it on with the normal buttons from xubuntu. that only sometimes works from windows
02:19 TEttinger it's also rather surprising how insecure all versions of windows are... I have another usb that erases password protection on windows accounts, takes under 5 minutes. I made it because a friend's laptop had the fingerprint login stop working, and she hadn't ever used her password, so no way to get in... without erasing the password
02:20 TEttinger we were both somewhat alarmed at how easy it was
02:20 comborico1611 Hmm.
02:23 comborico1611 C# the name is a marketing lie. Should be Java++.
02:24 comborico1611 C# is trying to lure c++ guys.
02:24 TEttinger I've only needed to be her IT guy twice (plus one more time handling the computer buying), but the password thing I thought would be a huge deal to resolve. especially since the other IT issue was a nasty popup that looked like a clickjacking attempt
02:24 TEttinger kinda, C# is pretty close to C/C++ compared to Java
02:24 TEttinger it mixes a bunch of features from both
02:25 comborico1611 I read to the contrary, but i haven't investigated it myself.
02:25 TEttinger it has unsigned types, which Java doesn't, and value types (like all types in C that aren't specifically references, I think)
02:26 TEttinger it has goto, though its use is strongly discouraged in most cases
02:26 TEttinger Java reserves the goto keyword but does not implement it
02:26 TEttinger C# has a limited amount of operator overloading, also unlike Java but like C++
02:27 TEttinger some things are closer to Java, mostly in the lib. C#'s List is very close to ArrayList, though also C++ Vector
02:27 lookatme IDK C#, but heard it was better than Java
02:27 TEttinger it is
02:28 TEttinger I use Java as my primary language, but I also use some C#, and if I actually put the effort in to learn all the features in C# I think I would do some things differently
02:28 comborico1611 But the jobs...
02:29 TEttinger depends on industry and location
02:29 TEttinger C# has a huge financial sector usage base
02:29 TEttinger Java seems more commonly used in Spanish-speaking countries, though I don't know why that would be
02:30 comborico1611 From our conversation, I'll keep an open mind to C#.
02:30 TEttinger yeah it's really turned around, I wouldn't have even considered it in version 1.0 but it's advanced so well
02:30 lookatme In China, they like Java / PHP :)
02:30 TEttinger PHP, a recursive acronym for PHP Hates People
02:31 lookatme And C# also have a lot of chances :)
02:31 lookatme Haha
02:34 comborico1611 And what of Go?
02:35 lookatme Golang sames like popular here, but only in Big City
02:35 mcmillhj joined #perl6
02:35 lookatme I think
02:37 comborico1611 Well, I'd like to see little ol perl6 beat these guys.
02:38 comborico1611 I'm off to bed. Goodnight, guys. Thanks for the info!
02:55 ilbot3 joined #perl6
02:55 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:56 ryn1x joined #perl6
03:08 ZzZombo Say, I have an array of string. Most of them have a prefix, so that you could group them by that prefix. I need to sort string in groups, and then groups themselves. Anybody have done something like this?
03:09 lookatme .classify ?
03:09 mcmillhj joined #perl6
03:10 ZzZombo Example: ('asd1','asd2','asd0','word','another','wordYes') -> ('another','asd0','asd1','asd2','word','wordYes')
03:10 lookatme m: my @strs = < foo foo1 foo2 foo3 foo4 bar bar1 bar2 bar3 bar4 >; say @strs.classify({ $^a.substr(0,3) })
03:10 camelia rakudo-moar 6db51f975: OUTPUT: «{bar => [bar bar1 bar2 bar3 bar4], foo => [foo foo1 foo2 foo3 foo4]}␤»
03:10 ZzZombo see, my string are of different length. It can be arbitrary.
03:10 ZzZombo strings*
03:11 lookatme sort according you own rule ?
03:11 lookatme s/you/your/
03:11 geekosaur I'm not understanding what exactly you're after; your example is just an ordinary lexical sort
03:11 noganex joined #perl6
03:12 ZzZombo Ah, sorry, I got that wrong. Silly me. I should NOT change the order of groups.
03:13 ZzZombo Example: ('asd1','asd2','asd0','word','another','wordYes') -> ('asd0','asd1','asd2','word','wordYes','another')
03:13 ZzZombo Unless I'm merging them.
03:14 lookatme :) I'm not get it
03:14 ZzZombo Like with the group 'word'.
03:15 lookatme Hmm, lunch time
03:17 colomon joined #perl6
03:18 ZzZombo lookatme: https://rosettacode.org/wiki/Longest_common_prefix#Perl_6
03:19 ZzZombo except in my case it needs to figure the prefix itself, given a list of strings, for each group.
03:19 ufobat_ joined #perl6
03:26 cdg joined #perl6
03:28 mson joined #perl6
03:38 cdg joined #perl6
03:46 ryn1x joined #perl6
03:48 lookatme ZzZombo, I think it's easily use that `lcp` build your code.
03:54 ryn1x joined #perl6
04:06 ryn1x joined #perl6
04:08 Cabanossi joined #perl6
04:14 ryn1x joined #perl6
04:16 piojo m: my Int constant Four = 'a string'; say Four ~ ', ' ~ Four.WHAT;
04:16 camelia rakudo-moar 6db51f975: OUTPUT: «Use of uninitialized value of type Str in string context.␤Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.␤a string, ␤  in block <unit> at <tmp> line 1␤»
04:18 piojo m: my Int constant Four = 'a string'; say Four; say Four.WHAT;
04:18 camelia rakudo-moar 6db51f975: OUTPUT: «a string␤(Str)␤»
04:18 piojo I saw this syntax in LWP::Simple, and it obviously doesn't work. Is it supposed to, or is it an accident that this parses correctly but doesn't work as it appears?
04:19 aborazmeh joined #perl6
04:19 aborazmeh joined #perl6
04:23 wamba joined #perl6
04:28 ZzZombo How can I when `.spurt`ing a `Str` tell Perl what endianess the resulting file should be in for UTF-16?
04:30 ryn1x joined #perl6
04:36 ryn1x joined #perl6
04:38 Cabanossi joined #perl6
04:49 lookatme ZzZombo, do you mean named argument `enc` of `open`
04:50 ZzZombo no
04:50 ZzZombo I mean `:enc` in `.spurt`
04:52 Cabanoss- joined #perl6
04:53 lookatme Maybe you should specify the encoding to UTF-16LE or UTF-16BE, but I don't think rakudo support them currently
04:57 lookatme m: my Int constant Four = 'a string';
04:57 camelia rakudo-moar 6db51f975: ( no output )
04:57 lookatme m: my Int $Four = 'a string';
04:57 camelia rakudo-moar 6db51f975: OUTPUT: «Type check failed in assignment to $Four; expected Int but got Str ("a string")␤  in block <unit> at <tmp> line 1␤␤»
04:58 lookatme piojo, I think it's a bug or something, the type constraint does not work..
04:58 ryn1x joined #perl6
05:09 mcmillhj joined #perl6
05:19 ryn1x joined #perl6
05:33 ryn1x joined #perl6
05:43 mson joined #perl6
06:06 Aceeri joined #perl6
06:07 Cabanossi joined #perl6
06:10 ryn1x joined #perl6
06:18 aborazmeh joined #perl6
06:18 aborazmeh joined #perl6
06:24 geekosaur I feel like that's a known bug but can't find it in RT quickly
06:28 domidumont joined #perl6
06:29 wamba joined #perl6
06:35 domidumont joined #perl6
06:39 darutoko joined #perl6
06:42 aborazmeh joined #perl6
06:42 aborazmeh joined #perl6
06:48 ryn1x joined #perl6
06:49 aborazmeh joined #perl6
06:50 aborazmeh joined #perl6
06:57 aborazmeh joined #perl6
06:57 aborazmeh joined #perl6
07:00 parv joined #perl6
07:05 aborazmeh joined #perl6
07:05 aborazmeh joined #perl6
07:12 aborazmeh joined #perl6
07:12 aborazmeh joined #perl6
07:16 lowbro joined #perl6
07:16 lowbro joined #perl6
07:22 aborazmeh joined #perl6
07:22 aborazmeh joined #perl6
07:29 wander joined #perl6
07:31 aborazmeh joined #perl6
07:31 aborazmeh joined #perl6
07:34 konsolebox joined #perl6
07:36 wander what is the efficiency of %my-hash.elems?
07:36 wander O(1) or O(n)?
07:37 jast if you want all elements, constant time is impossible pretty much by definition
07:38 wander ?
07:38 wander i want to get how many elems
07:39 wander if we use a bit to store it, it is O(1); if we count it, then may be O(n)
07:39 wander i don't know which way we use
07:40 aborazmeh joined #perl6
07:40 aborazmeh joined #perl6
07:40 lizmat joined #perl6
07:40 ryn1x joined #perl6
07:41 wander seems the former, i've built a hash contain 100000 elems, that costs some time. and %hash.elems uses no time.
07:42 jast possibly the time is spent as you iterate over it
07:46 konsolebox joined #perl6
07:47 AlexDaniel wander: it depends on the backend
07:47 AlexDaniel wander: on MoarVM it's O(1) because the number of elements is stored
07:47 wander AlexDaniel: what about MoarVM
07:47 AlexDaniel wander: see this for example: https://github.com/MoarVM/MoarVM/blob/bc6e933a0688354396fb1a1b97363375fd10a138/3rdparty/uthash.h#L489
07:47 wander thank you
07:49 AlexDaniel on jvm it's probably O(1) too
07:49 AlexDaniel but I don't have any proof :)
07:50 aborazmeh joined #perl6
07:50 aborazmeh joined #perl6
07:51 AlexDaniel ok, on jvm it's implemented with a simple HashMap and .size on a HashMap is O(1) too https://github.com/perl6/nqp/blob/4fd4b48afb45c8b25ccf7cfc5e39cb4bd658901d/src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/VMHashInstance.java#L8
07:53 konsolebox joined #perl6
07:58 AlexDaniel wander: as far as I can see, it is O(n) on js backend
07:58 AlexDaniel but I could be wrong
07:58 jast whoops, my bad. I had a different language in mind where elems returns all elements, not the count...
07:59 AlexDaniel so it's implemented using a Map, and I found this: https://tc39.github.io/ecma262/#sec-get-map.prototype.size
07:59 AlexDaniel so according to that description, it's definitely O(n)
08:00 AlexDaniel but maybe real implementations are allowed to cheat? I don't know
08:01 AlexDaniel 💤
08:01 konsolebox joined #perl6
08:03 wander :P
08:07 Cabanossi joined #perl6
08:08 konsolebox joined #perl6
08:10 margeas joined #perl6
08:11 nadim joined #perl6
08:14 konsolebox joined #perl6
08:17 zakharyas joined #perl6
08:21 domidumont joined #perl6
08:22 ryn1x joined #perl6
08:25 wander how to overload operation on custom class?
08:25 wander i use form like `method infix:<&>(BitMap \other)`
08:26 wander but in `dd ($bitmap & (BitMap.new(n=>10).set(5)))`, `&` acts like all-junction operator
08:27 wamba joined #perl6
08:27 lookatme The custom operator must be sub
08:28 moritz and receive two arguments: left and right operand
08:28 wander sub infix:<&>(BitMap \this, BitMap \other)
08:28 konsolebox joined #perl6
08:28 wander ok i will try it
08:29 moritz use "multi sub"
08:29 wander ok
08:29 moritz otherwise you'll override all uses for this operator
08:29 moritz also, Perl 6 uses +& and ~& for bit-wise operators
08:29 moritz + for numbers and ~ for strings
08:29 wander i know
08:29 moritz then don't use &, which is for junctions
08:30 wander oh, right
08:30 wander for consistent
08:31 wander besides, what's the best way to define multi object construction. i try to overload BUILD, but seems i cannot do that.
08:33 ZzZombo Can I combine `grep` and `map` in one go? It's often needed to perform some sort of operation on matched items, and I'd like not to iterate again on resulting list with `map`, when `grep` could run code on matched elements right away.
08:33 jonas1 joined #perl6
08:34 wander maybe i can overload `new`
08:35 xtreak joined #perl6
08:35 konsolebox joined #perl6
08:35 DrForr say grep { ++$_; True }, 1, 2, 3;
08:35 evalable6 DrForr, rakudo-moar 5a29a0ce4: OUTPUT: «(exit code 1) Cannot resolve caller prefix:<++>(Int); the following candidates␤match the t…»
08:35 evalable6 DrForr, Full output: https://gist.github.com/fff40fa9b79118e7845a4a3539db8151
08:36 DrForr say grep { $_=$_+1; True }, 1,2,3
08:36 evalable6 DrForr, rakudo-moar 5a29a0ce4: OUTPUT: «(exit code 1) Cannot assign to an immutable value␤  in block <unit> at /tmp/nIvGn8PWek line 1␤»
08:36 moritz m: say (1..10).map: { next if $_ %% 2; $_ * 2 }
08:36 camelia rakudo-moar 5a29a0ce4: OUTPUT: «(2 6 10 14 18)␤»
08:36 moritz ZzZombo: ^^
08:37 DrForr ah, right, you can still use the old "return undef" "trick" :)
08:37 moritz or you can make it a regular loop:
08:37 moritz m: say gather for 1..10 { unless $_ %% 2 { take 2 * $_ } }
08:37 camelia rakudo-moar 5a29a0ce4: OUTPUT: «(2 6 10 14 18)␤»
08:39 ZzZombo I could never get my head around this `gather/take` thing.
08:40 moritz it's not that hard
08:41 moritz gather { take 1; take 2}
08:41 moritz is pretty similar to
08:41 moritz { my @temp; push @temp, 1; push @temp, 2; @temp }
08:41 lookatme m: say gather { take 1; sub inner() { take 2;}(); }
08:41 camelia rakudo-moar 5a29a0ce4: OUTPUT: «(1 2)␤»
08:42 moritz except that it's also lazy (the inner block stops after the first "take" until the value is consumed by the caller)
08:44 wander m: class A {has $!x; method new($x) {self.bless(:$x)};method x() {$!x;};};say A.new(4).x;
08:44 camelia rakudo-moar 5a29a0ce4: OUTPUT: «(Any)␤»
08:45 wander why? how `bless` works? i've found we have `new`, `bless`, `BUILD`, etc. to write correct code is an exploration
08:45 xtreak joined #perl6
08:45 wander surely i expect $!x to be 4
08:48 lookatme https://docs.perl6.org/language/classtut#Constructors
08:49 dakkar joined #perl6
08:50 lookatme wander,  Private attributes really are private. This means that bless is not allowed to bind things to &!callback and @!dependencies directly.
08:50 wander so i need to overload BUILD?
08:50 lookatme yeah
08:50 wander but i try to write multi submethod BUILD..
08:51 imcsk8_ joined #perl6
08:51 lookatme m: class A {has $!x;  submethod BUILD(:$!x) {}; method x() {$!x;};};say A.new(4).x;
08:51 camelia rakudo-moar 5a29a0ce4: OUTPUT: «Default constructor for 'A' only takes named arguments␤  in block <unit> at <tmp> line 1␤␤»
08:51 lookatme m: class A {has $!x;  submethod BUILD(:$!x) {}; method x() {$!x;};};say A.new(x => 4).x;
08:51 camelia rakudo-moar 5a29a0ce4: OUTPUT: «4␤»
08:51 moritz wander: what do you want to achieve?
08:52 wander BitMap constructed by size/n or bits direactly
08:52 jeek left #perl6
08:53 moritz wander: what should the calls to .new look like?
08:53 wander BitMap.new(size=>10) or BitMap.new(bits=>7) # where 7 = (0111)_2
08:54 wander inside the constructor, i need to init other attr using param passed
08:54 wander so the initial logics are different, i think i need overload constructor in some way
08:55 lookatme m: class A {has $!x;  method new($x) { self.bless(:$x); }; submethod BUILD(:$!x) {}; method x() {$!x;};};say A.new(4).x;
08:55 camelia rakudo-moar 5a29a0ce4: OUTPUT: «4␤»
08:55 wander https://gist.github.com/W4anD0eR96/73d4c667d3d203f916e69e8fc2ee73ea
08:56 wander lookatme: yes, it can be done if only one construction logic exists. without `multi` or something
08:56 moritz wander: just add a   submethod BUILD(:$!mask, :$!size, :$!bits) {}
08:56 wamba joined #perl6
08:56 moritz and you're done
08:56 wander oh
08:58 wander that works. thank you two, sorry for i'm not so familiar with oo in psix
08:58 ryn1x joined #perl6
09:00 lookatme That's why read the document is important.
09:01 wander i read it not deeply :P
09:02 konsolebox joined #perl6
09:07 piojo Wow, I didn't know you could use "next" in map. moritz, is this obscure or should I add it as another example to the `map` documentation?
09:08 steeznson joined #perl6
09:09 wander m: class A {has Int $.x;multi sub infix:<+&>(A $a, A $b) { $a.x +& $b.x };};say (A.new(x=>4) +& A.new(x=>4));
09:09 camelia rakudo-moar 5a29a0ce4: OUTPUT: «Cannot resolve caller Numeric(A: ); none of these signatures match:␤    (Mu:U \v: *%_)␤  in block <unit> at <tmp> line 1␤␤»
09:10 xtreak joined #perl6
09:10 wander iI thought it would be well..
09:11 wander now its signature is multi sub infix:<+&>(Type lhs, Type rhs) {...}
09:12 wander m: class A {has Int $.x;multi method and(A $b) { self.x +& $b.x };};say (A.new(x=>4).and(A.new(x=>4)));
09:12 camelia rakudo-moar 5a29a0ce4: OUTPUT: «4␤»
09:12 wander i can do that in *this* way, but what about override operator..
09:17 wander m: class A {has Int $.x;};multi sub infix:<+&>(A $a, A $b) { $a.x +& $b.x };say (A.new(x=>4)+&(A.new(x=>4)));
09:17 camelia rakudo-moar 5a29a0ce4: OUTPUT: «4␤»
09:22 sena_kun joined #perl6
09:22 zakharyas joined #perl6
09:25 titsuki_ joined #perl6
09:26 scimon joined #perl6
09:27 moritz piojo: it's intentional; I'm pretty sure we have tests for that in roast
09:36 wander m: class A { has Int $.x;multi method new(:n($size)) { self.bless(:x($size))};multi method new(:b($bits)) { self.bless(:x($bits))};submethod BUILD(:$!x) { }};multi sub infix:<+&>(A \this, A \other){my $bits = (other.x +& this.x);A.new(n=>$bits)};say A.new(n=>4) +& A.new(n=>4);
09:36 camelia rakudo-moar 5a29a0ce4: OUTPUT: «A.new(x => 4)␤»
09:36 ryn1x joined #perl6
09:37 wander m: class A { has Int $.x;multi method new(:n($size)) { self.bless(:x($size))};multi method new(:b($bits)) { self.bless(:x($bits))};submethod BUILD(:$!x) { }};multi sub infix:<+&>(A \this, A \other){my $bits = (other.x +& this.x);A.new(b=>$bits)};say A.new(n=>4) +& A.new(n=>4);
09:37 camelia rakudo-moar 5a29a0ce4: OUTPUT: «Type check failed in assignment to $!x; expected Int but got Any (Any)␤  in submethod BUILD at <tmp> line 1␤  in method new at <tmp> line 1␤  in sub infix:<+&> at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
09:38 wander shortest example:
09:38 wander m: class A { has Int $.x;multi method new(:n($size)) { self.bless(:x($size))};multi method new(:b($bits)) { self.bless(:x($bits))};submethod BUILD(:$!x) { }};say A.new(b=>4);
09:38 camelia rakudo-moar 5a29a0ce4: OUTPUT: «Type check failed in assignment to $!x; expected Int but got Any (Any)␤  in submethod BUILD at <tmp> line 1␤  in method new at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
09:38 wander m: class A { has Int $.x;multi method new(:n($size)) { self.bless(:x($size))};multi method new(:b($bits)) { self.bless(:x($bits))};submethod BUILD(:$!x) { }};say A.new(n=>4);
09:38 camelia rakudo-moar 5a29a0ce4: OUTPUT: «A.new(x => 4)␤»
09:38 moritz piojo: I found one test for it with a quick "git grep", in S32-list/map.t: is (1..4).map({ next if $_ % 2; 2 * $_ }).join('|'), ...
09:39 wander turn to figure out how named parameter passed
09:39 moritz wander: declare the named params as mandatory
09:39 moritz multi method new(:n($size)!) { ... }
09:40 piojo moritz: thanks. I'll make a note and try to add that. Because I've returned |() in map, but 'next' is much less awkward
09:40 moritz you can also use last in map, fwiw
09:41 piojo thanks
09:42 wander does that mean if i want to apply `multi method new(:n($size)!) { ... }`, i have to pass a parameter named `n`?
09:43 wander without `!` and method can take named parameter not appears in signature cause the issue
09:43 moritz yes, named params are optional by default
09:46 wander hah, i need more practice to keep in mind
09:46 * wander dinner&
09:57 rindolf joined #perl6
09:57 wander joined #perl6
09:58 wamba joined #perl6
10:12 ryn1x joined #perl6
10:12 ZzZombo timotimo, so what about that `write_fhb` thing?
10:26 xtreak joined #perl6
10:29 xtreak joined #perl6
10:36 Cabanossi joined #perl6
10:38 araraloren joined #perl6
10:41 eliasr joined #perl6
10:48 ryn1x joined #perl6
10:49 sjn o/
10:55 araraloren o\
11:00 dct joined #perl6
11:01 dct joined #perl6
11:04 domidumont joined #perl6
11:07 timotimo ZzZombo: there's a bug, but i'm not sure what's to blame. utf16 encoding returns a 16-bit-per-entry buf, but writing binary data only wants to deal with 8-bit-per-entry buffers. both make sense on their own
11:07 sacomo hi all
11:08 * sjn looks at perl6 dynamic variables, and wishes $*HOSTNAME was one of them
11:09 sacomo I am experimenting with some ideas and was wondering if anyone here my have some input. I want to implement a module that allows a developer to override that module's functions internally to the module.
11:09 sacomo a solution I came up with uses multis
11:10 DrForr sacomo: have you looked at dynamic variables?
11:10 sjn sacomo: why not just use callbacks?
11:11 sacomo ok, that might work.
11:11 DrForr Oh, wait, overriding - Just expose the method in the class and let someone subclass it?
11:12 astj joined #perl6
11:12 sacomo well, I want the dev to be able to pass in a replacement so that the core module uses their version instead of core
11:12 sacomo I have a solution, but it is clunky
11:12 sacomo i will put together a gist...
11:13 klapperl_ joined #perl6
11:13 DrForr class Foo { method X($z) { self._replace-me($z); } } class My::Foo is Foo { method _replace-me($z) { $z++ } }
11:15 wamba joined #perl6
11:16 sacomo https://gist.github.com/scmorrison/e8b73ecfb257ac94567e4aadb54a863c
11:17 sacomo so that allows me to override the multi module-wide. So even if an internal sub from Foo calls bar it will use the external version
11:17 pmurias joined #perl6
11:18 DrForr No need for that mechanism - Subclass Foo and replace method bar()?
11:18 sacomo but will that version be used by all of Foo's other methods too?
11:20 ZzZombo So what is my best bet in writing data in an not implemented encoding? Turns out my file is actually UCS-2 LE with BOM.
11:20 DrForr One mo, let me write up a gist.
11:20 ZzZombo Rakudo doesn't deal with it.
11:20 sacomo thanks
11:21 ryn1x joined #perl6
11:22 DrForr https://gist.github.com/drforr/64c6adb7cca6d6cfc7867b7503eb323b
11:26 DrForr Woops, forgot to properly subclass.
11:26 DrForr Update it.
11:27 timotimo ZzZombo: you can have a class implement the Encoder/Decoder role and register it with the encoding registry
11:27 timotimo you'd grab the .NFC of your incoming string and spit out 8bit bufs with the 16 bit numbers split either LE or BE
11:27 timotimo and explode when the value is higher than 16bit, of course
11:28 ZzZombo I know nothing about the internals you suggested me to tinker with. Is there any examples?
11:28 ZzZombo Are*
11:30 timotimo https://docs.perl6.org/type/Encoding#method_encoder - i got the name wrong, but they aren't internal, they are language features, iiuc
11:30 timotimo oh
11:30 timotimo that's not the right place
11:31 sacomo DrForr, updated, but getting an error...
11:31 sacomo getting regular, regular...
11:32 timotimo but Encoding::Encoder only needs a single method called "encode-chars" that takes a Str:D and returns a Blob:D
11:32 DrForr Oh, another tyop.
11:32 DrForr There.
11:33 DrForr Sorry, I'm distracted.
11:34 ZzZombo So I will need to create a subclass from that, and have its encode-chars turn $str.NFC -> Buf and return it?
11:34 DrForr There. All better.
11:35 ZzZombo Then, how do I use it in spurt and similar functions?
11:35 sacomo ok, I see how that works, but what I want is that whenever a method in Foo calls bar internally, or a method in another module that uses Foo, it will use the override
11:36 timotimo either just pass the encoder object in the :enc field, or make sure it has a proper .name and Encoding::Registry.register(MyUCS2Encoder)
11:36 timotimo also, i lied, you also need to create an Encoding that returns your Encoding::Encoder when .encoder is called on it
11:37 timotimo and you register *that*
11:37 timotimo also implement a decoder method that throws an X::NYI or something
11:39 ZzZombo It just got me thinking: why does Perl 6 read the supposedly UTF-16 file w/ no problem, but can't save it back?
11:40 ZzZombo Shouldn't it have problems reading it as well?
11:41 samcv is there a way to get the PID from a Proc object?
11:42 DrForr sacomo: Someone calling Foo.bar(...) still has to choose to use the different version of bar(), right?
11:43 sacomo not in this scenerio. so, the idea is that the core module might call bar() just as it usually does, but I want to remap all of its internal calls to bar() to an external version passed in regardless where Foo tries using bar()
11:44 sacomo at this stage I am just playing with this idea. that solution I put in the gist does solve this, but looking for other ideas.
11:45 DrForr I still think simply letting the client subclass your Foo class is the simplest answer.
11:45 piojo_ joined #perl6
11:46 sacomo so, the client isn't using bar()
11:46 DrForr I think I need to see more code.
11:46 sacomo it is telling Foo to always use External.bar() whenever it wants to use something called bar()
11:46 sacomo not even sure what this is called. i guess overriding
11:47 sacomo The client isn't importing and then overriding, it is telling Foo to never use its version of bar() internally again, use this other version instead.
11:48 DrForr Yes, but your client instantiates Foo at some point, yes?
11:49 DrForr At which point you can pass your subclass with the new 'bar' method.
11:51 comborico1611 joined #perl6
11:54 sacomo ok, I will play around with that idea. Passing in a new bar method would allow Foo::Some::Deeper::Class to reference it as well?
11:54 sacomo I am trying avoid having the client talk to Foo::Some::Deeper::Class directly
11:55 DrForr I think I still need to see some code, I think there's something upside-down here.
11:57 sacomo well, at this stage it is all just a big experiement. so just looking for ideas. I will tinker with the subclass idea.
11:57 DrForr Is there a module I can see on GH?
11:58 sacomo not yet, i will get something up to look at and ping you
11:58 sacomo thanks for the input too
11:59 DrForr Cool. I think you should look at dynamic variables as well, that might be a cleaner solution for you.
11:59 sacomo ok, I will take a look
12:00 DrForr I really need to sit down and outline 'Perl 6 Best Practices.'
12:00 timotimo ZzZombo: we'll make moarvm able to write not-only-8bit stuff and then the utf16 encoder will work as-is
12:00 sacomo that example gist I showed you is using a few dynamic variables in the is-override and me subs
12:00 DrForr Not to say that you're doing something wrong at all, I'm just musing.
12:01 ilmari timotimo: then you have to care about endianness... wouldn't it be better to leave that to the encoder?
12:03 moritz DrForr: want to write a book, eh? :-)
12:04 DrForr sacomo: https://gist.github.com/drforr/f2f2738ee1f42e7fd08c5cce5baa468e
12:04 timotimo the utf16 encoder will have to write a BOM
12:05 DrForr moritz: Don't get me started :) It's not impostor syndrome at this point, it's just not beng sure I have enough ideas.
12:05 raschipi joined #perl6
12:06 DrForr moritz: I've been bugged by quite a few people already :)
12:07 moritz DrForr: if you want any kind of input or review, please let me know
12:08 moritz I'll be happy help, if you want
12:08 DrForr Thanks.
12:26 xtreak joined #perl6
12:27 ryn1x joined #perl6
12:32 holyghost joined #perl6
12:37 holyghost There's SDL 2 game startup code at http://github.com/theholyghost/holly6src the subrepo is named PaganVisions2
12:43 comborico1611 joined #perl6
12:45 sacomo DrForr, here is a simplified version https://github.com/scmorrison/perl6-module-override/blob/master/app.pl6
13:00 pmurias joined #perl6
13:01 pmurias m: "foo" ~~ /<:NoSuchUniCodePropertyForSure>/
13:01 camelia rakudo-moar 5a29a0ce4: ( no output )
13:01 pmurias ^^ do we want to silently accept unrecognized unicode properties?
13:02 ryn1x joined #perl6
13:03 HoboWithAShotgun joined #perl6
13:03 ZzZombo so, timotimo, I'm looking into writing my own encoder, but I don't know how to 1) determine endianess, 2) swap byte order if needed. Can you provide some pointers? I can only find Perl5 solutions.
13:12 holyghost timotimo : I've answered the mail, there's plenty more SDL -> 2.x to start from, thanks for the help
13:12 holyghost just game programming
13:27 mcmillhj joined #perl6
13:33 wamba joined #perl6
13:37 Cabanossi joined #perl6
13:39 markmont joined #perl6
13:39 Ulti win 2
13:39 buggable Ulti, Thank you for entering Accidental /win Lottery! The next draw will happen in 2 weeks, 10 hours, 20 minutes, and 5 seconds
13:40 Ulti hah
13:40 Ulti nice
13:40 Ulti what do I win....
13:40 Ulti is it the respect of my peers?
13:40 jast you'll find out in 2 weeks, 10 hours, 20 minutes, and 5 seconds, minus delta t
13:40 ryn1x joined #perl6
13:41 Ulti that is a lot of hype
13:41 jast I wonder if it's static or random
13:41 jast win 14
13:41 buggable jast, Thank you for entering Accidental /win Lottery! The next draw will happen in 2 weeks, 10 hours, 18 minutes, and 33 seconds
13:41 jast imagine that.
13:41 Ulti worryingly counting down to something
13:42 Ulti this makes me want to fix my emotionally sensitive bot
13:42 jast though if I win, I'll cede my prize to you, after all I didn't truly enter by accident
13:46 Ulti well depending on how careful the implementaiton is perhaps I can spam win via PM and up my share
13:46 Ulti nope :( too smart
13:47 cdg joined #perl6
13:47 jast so I guess you'll need sockpuppet accounts
13:52 cdg joined #perl6
14:00 liztormato joined #perl6
14:08 zakharyas joined #perl6
14:10 comborico1611 Does any programming language truly pass by reference?
14:11 comborico1611 Here for context https://stackoverflow.com/questions/2229498/passing-by-reference-in-c
14:13 perlpilot comborico1611: perl?
14:13 perlpilot (sorta :)
14:15 comborico1611 Perl and perl6?
14:15 mson joined #perl6
14:15 perlpilot Perl 5
14:15 pmurias comborico1611: in c++ you can mark something as passed by reference
14:16 comborico1611 Static?
14:16 ryn1x joined #perl6
14:16 araraloren Many language pass object(not native type) by reference, like JAVA C# Python Perl6
14:17 perlpilot yeah, that's true too
14:17 ZzZombo There used to be official online Perl6 compiler, right?
14:17 comborico1611 Hmm. I think I'm getting in-over-my-head with this question.  The Sam
14:17 perlpilot "official"?
14:18 pmurias m: say('is this an online Perl 6 compiler?')
14:18 camelia rakudo-moar 5a29a0ce4: OUTPUT: «is this an online Perl 6 compiler?␤»
14:18 comborico1611 Thanks for the input!
14:18 holyghost *lol*
14:18 ZzZombo nah, it is missing modules I'd like to use.
14:19 holyghost You probably need a 2 or 3D eplxorer program :-)
14:19 holyghost just pop up from your irc client
14:20 holyghost that's what I would like, I once made a picture distribution of image from lynx
14:20 pmurias ZzZombo: the js backend is still a WIP so you will have to wait for your super fancy with-in-browser-graphic  REPL
14:20 ZzZombo uh, now perl REPL prints garbade characters whenever I press Backspace.
14:21 * holyghost is ompilint 2017 10
14:21 araraloren ZzZombo, please install Readline
14:21 * holyghost is ompilin*g* 2017 10
14:21 * holyghost is compilin*g* 2017 10
14:21 araraloren or Linenoise
14:21 jast three tries, not bad :)
14:22 Altreus re a conversation in #perl - does perl6 maintain stack information when an exception is re-thrown?
14:23 holyghost Altreus : good point, I still need to read the code
14:23 Altreus does the spec mention the idea? :)
14:24 holyghost probably it should have just an operation stack, unless we want more than that :-)
14:24 Altreus maybe it should! Python3 has this behaviour and I'd like to be able to maintain my obstinate distaste for python
14:24 moritz m: sub f() { g }; sub g() { die "foo" }; sub h() { f(); CATCH { } }; h()
14:24 camelia rakudo-moar 5a29a0ce4: OUTPUT: «foo␤  in sub g at <tmp> line 1␤  in sub f at <tmp> line 1␤  in sub h at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
14:24 ZzZombo WTF
14:24 ZzZombo why does `zef` change my console font settings? It's ugly!
14:24 zakharyas joined #perl6
14:24 Altreus more like how
14:25 holyghost I am happy to be a perl6 archhacker but I do need to read the code
14:25 araraloren I don't think zef can change your font settings
14:25 moritz Altreus: seems like contains the original stack trace
14:25 holyghost moritz : if we want a SDL 2 deployment of camelia outputs, would it be doable ?
14:25 ZzZombo But running it sure does change that.
14:26 holyghost need the right irc client I guess
14:26 Altreus hmm
14:26 scimon sacomo: Reading your earlier stuff why not just use a Role instead of a Class?
14:26 Altreus m: sub f() { g }; sub g() { die "foo" }; sub h() { f(); CATCH { default { die $_ } } }; h()
14:26 camelia rakudo-moar 5a29a0ce4: OUTPUT: «foo␤  in block  at <tmp> line 1␤  in sub g at <tmp> line 1␤  in sub f at <tmp> line 1␤  in sub h at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
14:26 Altreus is that the exact implied code?
14:27 holyghost You're always talking in subs you should need to display modules
14:27 moritz holyghost: what kind of output does SDL produce?
14:28 holyghost moritz : it's SDL 2 now
14:28 khw joined #perl6
14:28 jast ZzZombo: it's more likely that some of its output triggers a weird render mode in your terminal emulator. does it persist into new terminal sessions/windows, or when you use the 'reset' tool?
14:28 sacomo scimon, that might work. I want to set an override at the initial setup, and have the overrided method used throughout the module regardless of where the original is called from, even from within the origin core module's subclasses, etc.
14:28 moritz holyghost: what kind of output does SDL 2 produce?
14:28 holyghost SDL libs
14:28 holyghost to load
14:29 holyghost so if you alter BitchX to display the jvm or moarvm code it should run within client
14:29 holyghost maybe .class files, I dunno
14:29 moritz uhm, count me out
14:29 holyghost sure
14:30 moritz you can fork camelia, and try to patch the fork
14:30 moritz https://github.com/perl6/evalbot
14:31 moritz but... I don't think IRC is the right medium for that
14:31 holyghost you need the SDL2:Raw module then open a window to paint and event upon
14:31 * holyghost complies
14:31 scimon sacomo: If you're using a factory you can always do runtime composition. my Foo $foo .= new; $foo does FoeOverride; return $foo;
14:32 scimon Because runtime composition is funny.
14:32 holyghost AFAIK you need to patch the BitchX client to put the code through, as I understand
14:32 holyghost it's about botwise
14:33 holyghost parse-wise of in - ouput
14:33 scimon m: role Foo { method bar() { "Foo::bar" } };role Foo2 does Foo { method bar() { "Foo2::bar" } };my Foo $f .= new;say $f.bar;$f does Foo2;say $f.bar;my Foo2 $f2 .= new;say $f2.bar
14:33 camelia rakudo-moar 5a29a0ce4: OUTPUT: «Foo::bar␤Foo2::bar␤Foo2::bar␤»
14:33 scimon :D
14:34 holyghost moritz : I might do that in the future, but as you know the perl6 input is parsable
14:34 holyghost you have to open a window with some parser and put it into your X11 window system
14:34 holyghost e.g. SDL 2
14:35 * holyghost is compiling 2017 10
14:36 holyghost deadfall :-)
14:36 sacomo scimon, one thing is that Foo::Extra for example might make a regular call to Foo::bar from inside the module without being aware of the Foo2 version when I initiated Foo
14:37 scimon Ahhhh. modules.
14:37 Cabanossi joined #perl6
14:37 sacomo right
14:37 holyghost \o Cabanossi
14:37 sacomo that is what I have come up with so far. the working example in that link
14:38 ZzZombo This doesn't work in my local Perl REPL but works with camelia:
14:38 ZzZombo `use Encode:from<Perl5> <decode encode>;`
14:38 ZzZombo Type check failed in binding to parameter '$handle'; expected CompUnit::Handle but got Sub (sub EXPORT (*@args) {...)
14:39 ZzZombo in any statement_control at C:\rakudo\share\nqp\lib/Perl6/Grammar.moarvm line 1
14:39 ZzZombo my last hope at tackling this encoding problem died so far :(
14:42 holyghost moritz : what did you want to say that SDL 2 does produce ?
14:43 holyghost the GUI should come out from it, by using your system's jvm/moarvm modules
14:44 charsbar joined #perl6
14:44 holyghost so a download as e.g. hotjava
14:44 moritz holyghost: I know that it doesn't work through plain IRC, so it won't land in the official camelia
14:44 holyghost sure
14:45 moritz holyghost: if you need a special client, there is not much benefit in using IRC at all, IMHO
14:45 * holyghost complies
14:45 holyghost I'd like to have a decent bot for it
14:46 holyghost like displaying my image files from lynx
14:46 holyghost It needs an API
14:46 holyghost pastebin etc. are ok though, I do understand
14:49 ryn1x joined #perl6
14:52 ZzZombo https://pastebin.com/ViqqpsCQ
14:52 ZzZombo Looks like the new `zef` that comes with the latest Star release is borked, at least on Windows.
14:53 ZzZombo Nothing I've tried can be installed or upgraded.
15:13 AlexDaniel joined #perl6
15:26 zakharyas joined #perl6
15:31 mcmillhj joined #perl6
15:35 stmuk ZzZombo: have you tried the following?
15:35 stmuk cd %USERPROFILE%
15:35 stmuk rd /s .zef
15:35 stmuk rs /s .perl6
15:35 ryn1x joined #perl6
15:36 stmuk ZzZombo: Inline::Perl5 didn't work on Windows last time I tried anyway
15:37 ZzZombo ir works.
15:37 stmuk ?
15:38 ZzZombo the module, and I just followed the nuke advice from an issue, zef works for now.
15:42 stmuk there is a quoting bug in the Windows qqx which breaks (or broke) Inline::Perl5
15:43 stmuk a problem with rakudo itself
15:44 Ulti < pmurias> ZzZombo: the js backend is still a WIP so you will have to wait for your super fancy with-in-browser-graphic  REPL     <--- Jupyter REPL lets you output SVG inline ;)
15:44 Ulti https://github.com/bduggan/p6-jupyter-kernel
15:45 Ulti the tab complete on it is quite nice too
15:45 Ulti https://github.com/bduggan/p6-jupyter-kernel/blob/master/eg/svg.ipynb
15:46 Ulti also Im noticing that GitHub can render that notebook.... which is impressive!
15:46 Ulti does that mean they have Rakudo and the ipython stuff running somewhere?
15:48 Ulti nah all pre rendered
15:55 Ulti is there any way to get the union of a bag where the counts are summed together?
15:56 zakharyas joined #perl6
15:57 dogbert2 m: bag(<a a b c a d>) (+) bag(<a a b c c>) === ("a"=>5,"c"=>3,"b"=>2,"d"=>1).Bag
15:57 camelia rakudo-moar 5a29a0ce4: OUTPUT: «WARNINGS for <tmp>:␤Useless use of "===" in expression "(+) bag(<a a b c c>) === (\"a\"=>5,\"c\"=>3,\"b\"=>2,\"d\"=>1).Bag" in sink context (line 1)␤»
15:58 dogbert2 m: say bag(<a a b c a d>) (+) bag(<a a b c c>) === ("a"=>5,"c"=>3,"b"=>2,"d"=>1).Bag
15:58 camelia rakudo-moar 5a29a0ce4: OUTPUT: «True␤»
15:58 dogbert2 m: say bag(<a a b c a d>) (+) bag(<a a b c c>)
15:58 camelia rakudo-moar 5a29a0ce4: OUTPUT: «Bag(a(5), b(2), c(3), d)␤»
15:58 nadim joined #perl6
16:01 Mrofnet joined #perl6
16:02 dogbert2 Ulti: ^^ unless I totally sisunderstood what you wanted
16:02 * dogbert2 sigh bad spelling
16:02 perlpilot_ joined #perl6
16:05 Ulti nope thats it thanks dogbert2
16:05 wander what is the usual reason for
16:05 wander 'Aborting due to test failure: Algorithm::BitMap:ver<0.0.1> (use --force-test to override)'
16:06 wander i'm follow the guide of Distributing Modules, and with 'zef install .' in my module dir it complains
16:07 moritz the usual reason is that a test fails
16:08 zakharyas joined #perl6
16:10 wander which test? i've run `perl6 t/01-basic.t` and passed it. that is the only test file.
16:11 mcmillhj joined #perl6
16:12 Ven joined #perl6
16:12 Ven Hi, #perl6.
16:12 Ven .u ²
16:12 yoleaux U+00B2 SUPERSCRIPT TWO [No] (²)
16:13 comborico1611 Hello!
16:14 releasable6 joined #perl6
16:21 troys joined #perl6
16:22 ZzZombo <ZzZombo> so, timotimo, I'm looking into writing my own encoder, but I don't know how to 1) determine endianess, 2) swap byte order if needed. Can you provide some pointers? I can only find Perl5 solutions.
16:23 ZzZombo timotimo ^
16:40 ryn1x joined #perl6
16:51 Cabanossi joined #perl6
16:57 zakharyas1 joined #perl6
16:57 Sound joined #perl6
17:04 wander could someone do me a favor try this guy and figure out why `zef install .` complains?
17:04 wander https://github.com/W4anD0eR96/Algorithm-BitMap
17:04 perlpilot cd
17:04 zakharyas joined #perl6
17:06 perlpilot wander:  Parse errors: No plan found in TAP output
17:06 perlpilot wander: either explicitly plan the number of tests or add a "done-testing"  to the end
17:09 Khisanth joined #perl6
17:11 wander yes it works, thank you perlpilot
17:13 mcmillhj joined #perl6
17:15 Geth ¦ mu: f595b21d00 | (Zoffix Znet)++ (committed using GitHub Web editor) | misc/perl6advent-2017/schedule
17:15 Geth ¦ mu: Remove post
17:15 Geth ¦ mu: review: https://github.com/perl6/mu/commit/f595b21d00
17:17 Geth ¦ ecosystem/W4anD0eR96-patch-1: 12c1959ed5 | (Alex Chen)++ (committed using GitHub Web editor) | META.list
17:17 Geth ¦ ecosystem/W4anD0eR96-patch-1: Add Algorithm::BitMap
17:17 Geth ¦ ecosystem/W4anD0eR96-patch-1:
17:17 Geth ¦ ecosystem/W4anD0eR96-patch-1: Thank you for submitting a module to the Perl 6 Ecosystem!
17:17 Geth ¦ ecosystem/W4anD0eR96-patch-1:
17:17 Geth ¦ ecosystem/W4anD0eR96-patch-1: If adding a new module please review the following check boxes and check the appropriate boxes by going to the preview tab and checking them interactively or alternatively replacing the space in the checkboxes with an X. Your work is appreciated and every module helps make the Perl 6 Ecosystem a bigger and better place ♥
17:17 Geth ¦ ecosystem/W4anD0eR96-patch-1:
17:17 Geth ¦ ecosystem/W4anD0eR96-patch-1: - [X] I **agree** to the usage of the META file as listed [here](https://github.com/perl6/ecosystem#legal).
17:17 Geth ¦ ecosystem/W4anD0eR96-patch-1: <…commit message has 5 more lines…>
17:17 Geth ¦ ecosystem/W4anD0eR96-patch-1: review: https://github.com/perl6/ecosystem/commit/12c1959ed5
17:18 Geth ¦ ecosystem: W4anD0eR96++ created pull request #379: Add Algorithm::BitMap
17:18 Geth ¦ ecosystem: review: https://github.com/perl6/ecosystem/pull/379
17:18 Cabanossi joined #perl6
17:18 TEttinger joined #perl6
17:27 ryn1x joined #perl6
17:28 * [Coke] hopes everyone is having a good week.
17:31 wamba joined #perl6
17:32 jnthn It's a national holiday tomorrow, so I'm at least having a shorter week :)
17:36 jnthn .wun 36
17:36 jnthn oops :)
17:36 Cabanossi joined #perl6
17:38 mcmillhj joined #perl6
17:39 * jnthn bbl
17:41 Morfent joined #perl6
17:41 ryn1x joined #perl6
17:50 mcmillhj joined #perl6
17:52 [Coke] our national holidays are next week here in the states; I'm luck to have a 3 day work week
17:52 [Coke] *lucky
17:57 ryn1x joined #perl6
18:04 mcmillhj joined #perl6
18:04 domidumont joined #perl6
18:10 ryn1x joined #perl6
18:12 comborico1611 joined #perl6
18:12 zakharyas joined #perl6
18:23 ryn1x joined #perl6
18:23 tabv :m rx/<alnum + [.-]>/
18:23 tabv m: rx/<alnum + [.-]>/
18:23 camelia rakudo-moar 825a8b0d0: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Quantifier quantifies nothing␤at <tmp>:1␤------> 3rx/<alnum +7⏏5 [.-]>/␤»
18:23 tabv m: rx/<[.-] + alnum>/
18:23 camelia rakudo-moar 825a8b0d0: ( no output )
18:23 tabv I would have expected the first one to work
18:28 setty1 joined #perl6
18:31 timotimo ZzZombo: UCS2 doesn't have the concept of a byte order mark?
18:32 dakkar joined #perl6
18:33 Mrofnet joined #perl6
18:34 timotimo wikipedia is frustratingly unclear about that
18:35 timotimo m: use NativeCall; my $one = Buf[uint16].new(0xabcd); say nativecast(Buf[uint8], $one).perl;
18:35 camelia rakudo-moar 825a8b0d0: OUTPUT: «Internal error: unhandled target type␤  in sub nativecast at /home/camelia/rakudo-m-inst-1/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 658␤  in block <unit> at <tmp> line 1␤␤»
18:35 timotimo m: use NativeCall; my $one = Buf[uint16].new(0xabcd); say nativecast(CArray[uint8], $one)[0].base(16);
18:35 camelia rakudo-moar 825a8b0d0: OUTPUT: «-33␤»
18:35 timotimo m: use NativeCall; my $one = Buf[uint16].new(0x1234); say nativecast(CArray[uint8], $one)[0].base(16);
18:35 camelia rakudo-moar 825a8b0d0: OUTPUT: «34␤»
18:35 timotimo m: use NativeCall; my $one = Buf[uint16].new(0x1234); say nativecast(CArray[uint8], $one)[1].base(16);
18:35 camelia rakudo-moar 825a8b0d0: OUTPUT: «12␤»
18:35 timotimo ZzZombo: that's how you determine endianness of your system
18:35 timotimo well, one way at least
18:36 timotimo and byte order swapping is simple, too, with a bit of bitwise arithmetic:
18:36 timotimo m: my $before = 0x1234; my $after = $before & 0xff << 8 +| $before & 0xff00 >> 8; say $after.base(16)
18:36 camelia rakudo-moar 825a8b0d0: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Unsupported use of << to do left shift; in Perl 6 please use +< or ~<␤at <tmp>:1␤------> 3 = 0x1234; my $after = $before & 0xff <<7⏏5 8 +| $before & 0xff00 >> 8; say $after.␤»
18:36 timotimo m: my $before = 0x1234; my $after = $before & 0xff +< 8 +| $before & 0xff00 +> 8; say $after.base(16)
18:36 camelia rakudo-moar 825a8b0d0: OUTPUT: «all(1234, FF34, FF)␤»
18:36 timotimo haha
18:36 timotimo m: my $before = 0x1234; my $after = $before +& 0xff +< 8 +| $before +& 0xff00 +> 8; say $after.base(16)
18:37 camelia rakudo-moar 825a8b0d0: OUTPUT: «3412␤»
18:37 timotimo ZzZombo: does that help?
18:41 sftp joined #perl6
18:44 ryn1x joined #perl6
18:56 ryn1x joined #perl6
18:59 hythm Hi, Is there module to install to have colors in REPL?
19:00 timotimo hythm: if you want syntax highlighting, maybe the jupyter kernel + an terminal shell for that can do it. if you mean printing out your own colored stuff, there's Term::ANSIColor for unix terminals
19:01 hythm timotimo I meant syntax highlighting when writing in REPL. I will check jupyter kernel
19:09 konsolebox joined #perl6
19:09 evalable6 joined #perl6
19:17 AHoboWithAShotgu joined #perl6
19:24 wamba joined #perl6
19:26 robertle joined #perl6
19:26 raschipi joined #perl6
19:27 Merfont joined #perl6
19:30 cdg joined #perl6
19:32 ryn1x joined #perl6
19:40 AndChat|688961 joined #perl6
19:44 comborico1611 joined #perl6
19:46 Sound joined #perl6
20:13 Ulti hythm: you can use the jupyter kernel
20:13 Ulti ;)
20:14 Ulti if you set this up https://github.com/bduggan/p6-jupyter-kernel with the iperl6 alias the resulting REPL has some syntax highlighting
20:14 Ulti and you get all the other reply goodness of jupyter
20:16 hythm Thanks timotimo and Ulti, I tried installing
20:17 hythm using: zef install Jupyter::Kernel. but I got this error "Invalid json? File: /home/helganiny/.zef/store/JSON-Tiny-1.0.tar.gz/JSON-Tiny-1.0/.gitignore
20:17 hythm "
20:18 hythm so What I'm doing now, I will upgrade perl6 and zef then try again
20:19 AlexDaniel I don't get it… is GitLab really so hard to use, or is it just a habit?
20:20 Ulti ?
20:20 timotimo hythm: would be interesting to hear what your versions of things are
20:21 AlexDaniel I don't know. There's just something about it that makes me want to defenestrate it
20:21 mr-foobar joined #perl6
20:22 hythm timotimo: $ perl6 --version
20:22 hythm This is Rakudo version 2017.07-132-gabf1cfe72 built on MoarVM version 2017.07-318-g604da4d0
20:22 hythm implementing Perl 6.c.
20:24 hythm Dont know how to get zef version, zef --version doesn't provide it
20:25 moritz zef list --installed # or something like that
20:27 hythm This is the output of zef list --installed: https://gist.github.com/hythm7/09322ec138b5e2c9dcc605133a5ee39f
20:35 moritz zef:ver('0.1.26'):auth('github:ugexe')
20:36 moritz 0.1.32 is the current version
20:38 hythm Thanks moritz, I'm upgrading everything now, Will test after that
20:39 ryn1x joined #perl6
20:42 lizmat joined #perl6
20:44 tony-o is telemetry in blead ?
20:46 lizmat tony-o: yes, it lives in lib
20:48 ChoHag joined #perl6
20:48 comborico1611 I always thought Elements were the value stored in the Subscript.  The thing in the subscript is just called a value. That's lame.
20:49 tony-o lizmat: is it in the 6d preview?
20:50 tony-o fresh blead build and can't find Telemetry for 'use Telemetry'
20:50 lizmat tony-o: that's weird
20:50 lizmat m: use Telemetry
20:50 camelia rakudo-moar 825a8b0d0: ( no output )
20:50 lizmat works even in Camelia ?
20:50 tony-o oh dear.
20:51 comborico1611 I just realized the connection with camelia . . .
20:51 lizmat m: use Telemetry; snap; sleep .2
20:51 camelia rakudo-moar 825a8b0d0: OUTPUT: «Telemetry Report of Process #7349 (2017-11-16T20:51:28Z)␤Number of Snapshots: 2␤Initial/Final Size: 87740 / 92172 Kbytes␤Total Time:           0.21 seconds␤Total CPU Usage:      0.01 seconds␤No supervisor thread has been running␤␤wallclo…»
20:51 Ulti tony-o: have you switched to master?
20:52 Ulti at least that caught me out when I first looked for the Telemetry stuff since it was the same time (ish)
20:52 tony-o Ulti: was building blead with rakudobrew but i'll build from the repo
20:52 ugexe its probably because rakudobrew calls `moar-blead` moar-blead-master` now instead of `moar-blead-nom`, so `rakudobrew switch moar-blead` could pick eithe rone
20:52 tony-o ah
20:52 Ulti tony-o: yeah but did you update rakudobrew to look at master
20:53 ugexe probably wanna delete ~/.rakudobrew/moar-blead-nom, and also run `rakudobrew self-update`
20:53 tony-o nuking made it pick master instead of nom
20:53 tony-o ty.
20:53 Ulti rakudobrew build moar master && rakudobrew switch moar-master && rakudobrew nuke moar-nom
20:53 Ulti I think
20:54 Ulti yeah
20:54 ugexe moar-blead is not the same as moar-master
20:54 ugexe moar-blead should bring in blead nqp/moar as well
20:54 Ulti sure but it also doesnt switch from nom unless you nuke it in rakudobrew
20:54 Ulti so if you nuke it and rebuild it works
20:55 ugexe yes, but nuke moar-nom will not do that, and `moar-master` should be `moar-blead-master` (or just remove the -master)
20:56 Ulti 4m7.365s <--- dealing with a 44MB file :( I regret my choice to use Perl 6 for this task
20:56 tony-o ran nuke blead, self-update, and build blead and it switched from -nom to -master
20:56 tony-o lizmat++ for Telemetry
20:57 tony-o i can update benchmark now
20:58 Ulti ok interesting the lines IO part is only 36s of that 4 minutes
20:59 Ulti the grep with lots of .first into an array is slow I assume
20:59 Ulti ooo .race can work \o/
21:07 mcmillhj joined #perl6
21:09 pilne joined #perl6
21:13 Ulti weird the .race was twice as slow as just the normal grep
21:14 Ulti but I also gamed that 5 minutes down to 54s using a set
21:14 perlpilot .oO( that's because it's turtles all the way down! )
21:24 ivans joined #perl6
21:26 mcmillhj joined #perl6
21:30 cdg joined #perl6
21:33 cdg joined #perl6
21:34 Cabanossi joined #perl6
21:45 ryn1x joined #perl6
21:56 kitsunenokenja joined #perl6
22:02 espadrine joined #perl6
22:08 markmont joined #perl6
22:11 El_Che someone with access to http://rakudo.org/how-to-get-rakudo/#Installing-Rakudo-Star-Linux present?
22:12 TEttinger joined #perl6
22:16 lizmat decommute&
22:27 sena_kun joined #perl6
22:28 mr-foobar joined #perl6
22:30 ryn1x joined #perl6
22:42 zakharyas joined #perl6
22:45 tony-o m: require ::('Telemetry'); sub n { ::('Telemetry').new; }; sub r ($a, $b) { say $b - $a; }; r(n,n);
22:45 camelia rakudo-moar 825a8b0d0: OUTPUT: «Cannot resolve caller Numeric(Telemetry: ); none of these signatures match:␤    (Mu:U \v: *%_)␤  in sub r at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
22:53 MasterDuke joined #perl6
22:56 ryn1x joined #perl6
23:00 mson joined #perl6
23:30 ryn1x joined #perl6
23:56 ChoHag joined #perl6

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

Perl 6 | Reference Documentation | Rakudo