🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
cpan-raku New module released to CPAN! JSON::Fast (0.12) by 03TIMOTIMO 00:18
cpan-raku New module released to CPAN! JSON::Hjson (0.0.2) by 03AKIYM 00:22
pocloq How do I get an Array or a List from the command line?raku -e 'sub MAIN ( Array :$arr ) { say ++$, $_ for $arr }' --arr="<1 2 3>" 1[<1 2 3>] 00:56
this only gets a single element into the array 00:58
rbt This might be closer:
raku -e 'sub MAIN (:@arr ) { say ++$, $_ for @arr }' --arr=a --arr=b
pocloq doing --arr="first" --arr="second" also only creates a single element
rbt Otherwise, you might need to take a string and split on space or comma or something. 00:59
pocloq i was hoping there would be some kind of syntax that allows for array/list creation straight from the command line… 01:00
without having to repeat the switch for every element
rbt Has anyone considered changing Travis-CI to use rakubrew downloadables rather than building via rakudobrew? It would significantly shorten build times across the board. 01:40
JJMerelo CommaIDE stopped working again... 06:55
Geth doc: 00669aef5b | (JJ Merelo)++ | doc/Type/Cool.pod6
Fixes unimatch example.

Closes #3509. Also grammar fixes, and added explanation.
07:25
linkable6 Link: docs.raku.org/type/Cool
DOC#3509 [closed]: github.com/Raku/doc/issues/3509 `unimatch 'A', 'Ll'` should return `False`
grondilu wasn't there a :defined adverb to test the existence of a hash entry ? Like %foo<bar> :defined ? 07:27
m: my %foo; say %foo<bar> :defined
camelia Unexpected named argument 'defined' passed
in block <unit> at <tmp> line 1
grondilu m: my %foo; say %foo<bar> :exists 07:29
camelia False
grondilu oh, ok
grondilu just search "raku hash entry test" and learned about :exists
*searched
lizmat .ask tbrowder does one of your modules provide this? www.reddit.com/r/rakulang/comments...inet_ntoa/ 11:20
tellable6 lizmat, I'll pass your message to tbrowder
tbrowder lizmat: hi 11:25
it's supposed to. it has routines to convert ip to/from binary. i haven't looked at in a while--an update is in the works but the released version should work. i didn't thint to add aliases for inet* and nt* becasuse i was just pr 11:28
porting the perl version to raku.
Net::IP 11:29
oh, i see releasd new the api version in april. 11:30
.tell lizmat ^^^^ 11:31
tellable6 tbrowder, I'll pass your message to lizmat
lizmat answered the question on r/rakulang 11:37
afk for a few hours&
El_Che Zero_Dogg: need to investigate the integration with bintray, where the packages are hosted 12:32
Zero_Dogg: certainly something worth enabling
Zero_Dogg El_Che: yeah, I want to update to a more recent raku, the packages look like a great way to do it, but found it a bit odd it was disabling gpg 12:34
El_Che it's https and they have a checksum generated in travis (hence public), so in that sense they are safe for mitm 12:36
but, I agree it would be a very nice to have
[Coke] lizmat: in review, I don't think we need Rakudo Star as a core thing, no. 13:13
(also, didn't see this in review yet, but clicking on "older versions" on the initial d/l page paradoxically shows you newer versions 13:14
I think having builds of compiler releases and zef work. I don't think we need a bundle with all the modules bundled in Star. 13:15
(but I admit, I am not a typical user). 13:16
codesections Ok, syntax question: I have a list of Lists that I'd like to transform into Bags. I can do that in separate lines like this: 15:03
m: my $lists = ((first => 1, first => 2), (key => 40, key => 2)); my %bag1 is Bag = $lists.head; my %bag2 is Bag = $lists.tail; say "bag1: {%bag1}\nbag1: {%bag2}" 15:04
camelia bag1: first(3)
bag1: key(42)
codesections But I thought I could do the same thing with destructuring assignment:
m: my $lists = ((first => 1, first => 2), (key => 40, key => 2)); my (%bag1 is Bag, %bag2 is Bag) = $lists; say "bag1: {%bag1}\nbag1: {%bag2}" 15:05
camelia bag1: first 1 first 2 key 40 key 2
bag1:
codesections but that doesn't work – am I not getting the syntax right, or is that way of using destructuring assignment just not supported? 15:06
jnthn Destructuring is done via binding 15:07
But you aren't quite wanting to destructure there, but rather coerce
widnow 20 15:08
m: my $lists = ((first => 1, first => 2), (key => 40, key => 2)); my (Bag() $bag1, Bag() $bag2) := $lists; say "bag1: $bag1\nbag2: $bag2"; 15:09
camelia bag1: first(3)
bag2: key(42)
jnthn There's not really a way to do it with the % sigil (coercion in signatures is about the value in the container)
But you can do it as above
Key thing to know: destructuring is done with signatures, so everything you know about writing those, you can apply to destructuring too. 15:10
grondilu Is there an elegant way to create the array [0], [1], [2] ... [n] ? 15:14
m: say [$++] xx 10
camelia ([0] [1] [2] [3] [4] [5] [6] [7] [8] [9])
codesections Very helpful, thanks!
grondilu hum I guess that will do
El_Che someone here discussed Rakudo Star, binaries and the pain of getting rakudo onto macos: in my opinion, a easy way is to use homebrew to install a prcompiled rakudo compiler (and NOT rakudo-starm also present in homebrew) 15:16
thus the link we provide here raku.org/downloads/others.html is outdated 15:17
jnthn grondilu: Yeah, another one is `(^10)>>.Array` but I'm not sure how much more elegant it is. :)
El_Che in the beginning only rakudo-star was in homebrew
grondilu oh I had no idea $x.Array could create [$x] 15:18
m: say pi.Array
camelia [3.141592653589793]
grondilu nice. 15:19
I'm guessing it inherits from Any
m: say Any.Array
camelia [(Any)]
grondilu m: say Mu.Array
camelia No such method 'Array' for invocant of type 'Mu'
in block <unit> at <tmp> line 1
Voldenet m: print join "", map({ "|$_|" }, split "", "wut") 15:20
camelia |||w||u||t|||
Voldenet i do wonder why there's 0-width chars on the beginning of that string
[Coke] m: say Cool.Array 15:21
camelia [(Cool)]
grondilu m: say "foo".split("").elems 15:22
camelia 5
grondilu you want to use .Comb instead
.comb
m: say "foo".comb.elems
camelia 3
grondilu "" is actually present at the beginning of any string 15:23
and the end
m: say "wut".comb.map({"|$_|"}).join 15:24
camelia |w||u||t|
Voldenet I know that there is, but I still wonder why :D
grondilu the empty string occurs everywhere, including before w and after t
[Coke] m: say "foo".split("",:skip-empty).elems
camelia 3
grondilu ok my bad, I can't explain this actually 15:25
oh it's 3, my bad again
Voldenet this happened because I was porting perl5 script 15:26
grondilu well raku is not back compatible
p5: print split "", "wut" 15:27
Voldenet bah, ofc, hence the name change :P
grondilu splitting with an empty string as first argument is kind of a degenerate case, semantics is not obvious to interpret. 15:29
IMHO
tobs should have written your p5 script with `split //, …` because that would have errored in Raku :P 15:31
Voldenet Well yes, some languages just adopted the convention of "" meaning "split into 1-character strings array" and its meaning is completely arbitrary ;) 15:32
tobs (but no, I can't say anything helpful either)
Voldenet m: use nqp; my @l = nqp::split("", "test"); @l.map({"|$_|"}).say 15:36
camelia (|t| |e| |s| |t|)
Voldenet huh
lizmat [Coke]: feels to me that zef should be part of core then ? 15:39
or at least something like zef
[Coke] or maybe have a package that includes rakudo,nqp,moar and zef. 15:53
(er, includes those packages)
patrickb Coke: the packages nxadm prepares as well as the precompiled packages offered on rakudo.org provide those components. 16:05
(Note that I'm talking about the packages on rakudo.org/downloads , not the Rakudo Star bundle.) 16:06
jdv79 why should zef be in core? iirc pip isn't in python core. 16:08
i don't believe cpanm is in core though CPAN likely is but cpanm is more used now, right? 16:09
lizmat there *is* a cpan client in the perl core distribution afaik, so you don't need to install something to be able to install something 16:10
eery python does ship with a module installer afaik, if not pip it's something that can install pip 16:11
jdv79 so there would be a installer in raku core that only newbies use until someone in here says "just use zef"
hmm...
eery ah, no, pip is included by default, since 3.4 16:12
afresh1 FreeBSD ships with a "pkg" tool that can only install the real "pkg" tool
eery you could build/package it without it which some distro maintainers may do if they want to have separate packages, but if you download source and build it produces pip 16:13
lizmat hmmm.. i like the idea of having a "zef" stub that can only install itself, and *then* do whatever it was asked to do
eery is zef very large/are there competing package managers? 16:14
codesections the trend with languages more recently seems to be to include a language package manager (e.g., Go and Rust both do so)
patrickb I'd answer both questions with no. 16:15
jdv79 a zef trampoline?
lizmat a zef trampoline would ensure the most recent zef would be installed 16:16
you would need internet access for it, but then you would anyway if you want to install something else anyway
eery would you want the most recent version of zef vs. what is guaranteed to work with a given version of rakudo? 16:17
patrickb lizmat: Why is a recent zef preferable to a zef as old as its rakudo?
lizmat eery: the system dependent things are part of the core
zef doesn't know how to install modules, it just knows what to call in the core to install a module
tobs is there a way to include some wrapper c++ code, which is compiled and installed as %*RESOURCES, to ease nativecalling in a module? 16:19
patrickb I don't see why a zef installer is preferable to just bundling zef itself.
tobs just a starting point for cargo culting would be enough
codesections zef could also run `zef upgrade zef`, couldn't it?
eery FWIW, FreeBSD's pkg command is likely packaged separately as it's incompatible with an older/auxillary package management tool/database 16:22
lizmat patrickb: well that *was* my original suggestion :-)
tbrowder gy 16:24
g'day, raku people! 16:25
lizmat tbrowder o/
tbrowder i'm doing some more porting from perl to raku and typically i name a ported module with the same basename and new extension 16:26
lizmat \o/ 16:27
unfortunately rakumod follows pm in alpha sort order and the using prog sees the perl module first. the 16:28
the immediate solution is a rename or separate lib dirs. 16:29
lizmat tbrowder: but Rakudo should try the .rakumod extension first 16:30
are you saying that it doesn't?
tbrowder question: couldn't raku reject a module without
**** no it doesn't 16:31
lizmat that'd be a bug
tbrowder i'm not talking about installed modules, just plain local modules in the local file tree 16:32
lizmat yeah, that's a bug
and confirmed it
tbrowder ok, thnx!
cpan-raku_ New module released to CPAN! Red (0.1.15) by 03FCO
tbrowder filing bug now... 16:33
SmokeMachine I've added some new "answers" on the Red cookbook, could some one take a look, please? github.com/FCO/Red/blob/master/doc...ookbook.md 17:25
[Coke] as long as we don't end up with a-packge-for-each-module like I've seen elsewhere. 18:07
(which maybe is a fine model, but always seemed weird to me.) 18:08
rypervenche It's nice for users, but I imagine it could be dependency hell. 18:15
[Coke] as a user, I hated it, because i'd get some via packages, but it's not like it covered all cpan 18:55
ShimmerFairy I really wish OS package managers could mesh with subject-specific package managers so the OS guys don't feel the need to ban things like CPAN and tlmgr 20:24
tobs re my question from before about compiling native code upon module installation: zef executes a Build.pm file in the distribution during its build stage. Apparently I knew this in the past. 20:37
melezhik I've added multiple hosts deployement in asyncronous mode in Sparrowdo/Sparky. Also tagging feature. github.com/melezhik/sparrowdo/wiki...amic-hosts 21:13
I am going to describe all this in the next RakuOps issue 21:14
lizmat melezhik++
melezhik basicly now Raku have alternative to ansible/rex/chef configuration management tool... 21:15
I've already played with my free tier aws account running multiple ec2 instances and configure them asynchronously and it looks cool for me ))) 21:16
it still has rough egdes, but basic layout looks good for me ...
and plays well with terraform - github.com/melezhik/sparrowdo/wiki...ntegration 21:17
I know u/bobthecimmerian already started to play with it ... But I need more testers ... )))) 21:18
SmokeMachine I’ve made some more adds on the cook book, is someone is interested: fco.github.io/Red/tutorials/cookbook 22:01
SmokeMachine Or the file on github: github.com/FCO/Red/blob/master/doc...ookbook.md 22:04
lizmat twitter.com/liztormato/status/1281...7373849608 # SmokeMachine 22:05
lizmat sleep& 22:08
SmokeMachine lizmat: thank you! 22:12
codesections Does Raku have a way to unzip? (That is, perform the inverse operation of the Zip method/operator and transform a list of lists into multiple lists? 22:18
)
jnthn codesections: I don't think there's a builtin for it, but you can get it by combining a couple of them, I think... 22:32
m: sub unzip(@x, $n) { roundrobin(@x.batch(3)) }; dd unzip 1..12, 3 22:33
camelia ((1, 4, 7, 10), (2, 5, 8, 11), (3, 6, 9, 12)).Seq
jnthn oops, I wrote 3 where I wanted $n to generalize it :)
codesections Hmm, I don't *think* that's what I meant. (1, 2, 3) Z <a b c> produces ((1 a) (2 b) (3 c)) 22:35
I'm looking to go from ((1 a) (2 b) (3 c)) back to (1, 2, 3) and ('a', 'b', 'c')
Unless I'm confused, I don't think the roundrobin + batch solution does that? 22:36
codesections wait, yes it does. I was confused. 22:37
Thanks, I see how it works now. Very helpful :)
jnthn I probably coulda picked a better example input :) 22:38
codesections wait, actually, I just realized there's a (very cool) better way: 22:40
tobs you mean zip it again? :)
codesections yeah, basically 22:41
Why does that work?
tobs m: say [Z] (<a b c> Z <1 2 3>) 22:41
camelia ((a b c) (1 2 3))
codesections m: [Z] ((1, 'a'), (2, 'b'), (3, 'c')) 22:42
camelia Potential difficulties:
Useless use of [Z] in sink context
at <tmp>:1
------> 3<BOL>7⏏5[Z] ((1, 'a'), (2, 'b'), (3, 'c'))
tobs the [Z] now zips over three lists, each of which 2-element list
codesections m: say [Z] ((1, 'a'), (2, 'b'), (3, 'c'))
camelia ((1 2 3) (a b c))
tobs sorry to steal your thunder 22:45
codesections Ok, yeah, I see it now. That's *really* cool
jnthn Oh, I totally didn't think of that one :)
That is cute.
tobs someone in this channel once remarked that zipping is a way of transposing a matrix (turning rows into columns) and that made an impression on me
codesections That is a helpful way of putting it 22:46