🦋 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.
rypervenche Is it possible to pull two values out of a hash at once? I'm currently pulling one out with: @data»<date> . Is there some way to do this without needing to use @data twice? 00:59
oh 01:00
I just figured it out. Just do @data»<date day-of-week>
guifa rypervenche: don’t you love how nicely slices are implemented? :-) 01:35
rypervenche Although it's returning an array of arrays and I'd like it to be an array of strings. I'll have to figure out how to change it. 01:38
guifa how are you making it? It should provide a list of the hash values 01:49
m: my %hash = a => 1, b => 2, c => 3; say %hash<a b c>.WHAT; say %hash<a b c>[0].WHAT 01:50
camelia (List)
(Int)
rypervenche No, I think it's normal. I'm doing this from an array of hashes. 01:57
I guess I'll have to do something like two for loops to change the inner arrays into strings.
guifa Don’t forget about the hyper operator, it can be useful at times for that 02:05
m: say %hash<a b c>».Str 02:06
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '%hash' is not declared. Did you mean any of these?
&hash
Hash

at <tmp>:1
------> 3say 7⏏5%hash<a b c>».Str
guifa err
m: my %hash = a => 1, b => 2, c => 3; say %hash<a b c>».Str
camelia (1 2 3)
rypervenche m: my %hash = %( :date("2020-02-28"), :day-of-week("Tue") ); my @data = %hash xx 3; say @data>><date day-of-week>;
camelia ((2020-02-28 Tue) (2020-02-28 Tue) (2020-02-28 Tue))
rypervenche I'd like to make "2020-02-28 Tue" a string, and therefore have a list of those strings. 02:07
guifa aaaaah you want to combing them
m: my %hash = %( :date("2020-02-28"), :day-of-week("Tue") ); my @data = %hash xx 3; say @data.map(*.<date day-of-week>.join: ‘ ‘); 02:08
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in curly single quotes; couldn't find final "’" (corresponding starter was at line 1)
at <tmp>:1
------> 3ata.map(*.<date day-of-week>.join: ‘ ‘);7⏏5<EOL>
guifa ahm
m: my %hash = %( :date("2020-02-28"), :day-of-week("Tue") ); my @data = %hash xx 3; say @data.map(*.<date day-of-week>.join: ' ');
camelia (2020-02-28 Tue 2020-02-28 Tue 2020-02-28 Tue) 02:09
rypervenche I may be doing this all wrong, but yeah. Trying to sort by date and also have the day-of-week available for printing in sorted order.
Ahhhh, good ol' map always doing what I need.
guifa I don’t know the whole of what you’re doing, but you can sort on just a key. 02:11
m: my @list = %(:4a, :1b), %(:1a, :6b), %(:3a, :9b), %(:0a, :5b); say @list.sort(*<a>)
camelia ({a => 0, b => 5} {a => 1, b => 6} {a => 3, b => 9} {a => 4, b => 1})
rypervenche I'm trying to count how many of each date and then print the date and day-of-week along with that number. I was thinking of throwing that string in a bag and then maniulating the string afterward to get the right order of text. 02:14
s/that number/the count/
rypervenche guifa: Got it working. Thanks a bunch. That was useful information. 03:00
cpan-raku New module released to CPAN! Syslog::Parse (0.0.1) by 03JMERELO 10:07
SmokeMachine first end to end execution! with a lot of stuff not implemented yet... www.irccloud.com/pastebin/qa7CbOM3/ 12:46
jjatria Quick question. Constants in Raku code: SNAKE_CASE or KEBAB-CASE? 12:51
tyil I prefer underscores simply because I'm already holding shift anyway 13:10
but it's completely up to you :)
cpan-raku New module released to CPAN! Syslog::Parse (0.0.2) by 03JMERELO 13:26
jjatria m: constant FOO-BAR-2 = ':(' 13:29
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing initializer on constant declaration
at <tmp>:1
------> 3constant FOO-BAR7⏏5-2 = ':('
dakkar m: my \a=1; 13:32
camelia ( no output )
dakkar m: my \a-1=1;
camelia 5===SORRY!5=== Error while compiling <tmp>
Term definition requires an initializer
at <tmp>:1
------> 3my \a7⏏5-1=1;
dakkar m: my $a-1=1;
camelia Use of uninitialized value of type Any in numeric context
in block <unit> at <tmp> line 1
Cannot modify an immutable Int (-1)
in block <unit> at <tmp> line 1
dakkar jjatria: two interesting things here! ① the syntax for identifiers is not what we were expecting ② sigil-less and sigilled identifiers produce different error messages 13:33
jjatria Not what we were expecting indeed! 13:34
jnthn This is so $foo-1 is actually the - operator 13:36
jjatria Yeah, I thought that might be the case. In a way it makes my life easier, since I have fewer decisions to make :) 13:37
SmokeMachine Now it's getting the properties... :) www.irccloud.com/pastebin/CovYBkUl/ 14:19
SmokeMachine www.irccloud.com/pastebin/FAxmIRji/ 14:41
I still need to implement the quantifiers... 14:44
SmokeMachine one more end to end example: gist.github.com/FCO/43a8f3b9d5aea0...c16f835094 17:04
Voldenet m: sub a(:$x, :$y) { say $x, $y }; sub b(:$z, :$r) { say $z, $r }; sub c(|e) { a(|(e<x y>:kv.Hash)); b(|(e<z r>:kv.Hash)); }; c(:x, :y, :z) 17:45
camelia TrueTrue
True(Any)
Voldenet isn't `|(e<x y>:kv.Hash)` needlessly verbose?
SmokeMachine Voldenet: hi! have you seen my new examples working? 17:47
lizmat m: sub a(:$x, :$y, *%_) { say $x, $y }; sub b(:$z, :$r, *%_) { say $z, $r }; sub c(|e) { a(|e); b(|e) }; c(:x, :y, :z) # Voldenet 17:51
camelia TrueTrue
True(Any)
lizmat Voldenet: in other words, let subs a and b eat all extra nameds
Voldenet: if this is about using subs in a class, then maybe making them private methods would be clearer ? 17:52
Voldenet that looks a lot better, thanks 17:59
and no, they're not methods in the class, it's a whole mess of a script at the moment :D 18:00
I wonder…
m: sub a(:$x, :$y, |) { say $x, $y }; sub b(:$z, :$r, |) { say $z, $r }; sub c(|e) { a(|e); b(|e) }; c(:x, :y, :z)
camelia TrueTrue
True(Any)
Voldenet ha, obviously
lizmat that would also eat additional positionals, which you probably don't want ?
Voldenet I don't mind - all subs take named arguments 18:02
lizmat which means you would like to be informed at compilation that you mistyped ":$a" by forgetting the ":" ? 18:03
.oO( been there, done that :-)
Voldenet I shouldn't have written so many arguments to subs in the first place and should've used a few configuration classes in the first place 18:08
Voldenet but it's too late, I like quick and dirty tools because they're quick to write and dirty to debug 18:08
lizmat well, I hope you have multi-letter variable names in there somewhere :-) 18:09
Voldenet SmokeMachine: I have now, but the question - will it work on any supplies at the end? Widely loved csv/tsv/windows events logs await 18:15
(just asking - it's possible to convert most of things into json anyway) 18:19
SmokeMachine Voldenet: it will be possible to write a interface to interpret your Supply data...
Voldenet Cool and good
SmokeMachine Voldenet: it will convert anything to raku struct 18:20
Geth ¦ problem-solving: lizmat assigned to jnthn Issue Should $foo ~~ Failure mark Failure in $foo as handled? github.com/Raku/problem-solving/issues/161 19:21
withp how would one declare a statically typed constant Map from Regexes onto Function handles (all of which take the same args and have the same return type) ? 19:41
Geth ecosystem: 08190b3894 | (Jonathan Stowe)++ | META.list
Renamed Perl6-Noise-Gang
19:47
Geth ¦ problem-solving: lizmat assigned to jnthn Issue Allow single-element Map/Hash to be treated as a Pair github.com/Raku/problem-solving/issues/162 20:11
lizmat A new Rakudo Star! dist.tyil.nl/raku/rakudo-star/ 20:14
Doc_Holliwood is luca ferrari in the house?
liz, just so you know, I am Herbert Bollermann 20:15
lizmat aaah... ok :-)
tyil++ 20:16
tyil ^_^
Doc_Holliwood Is Luca Ferrari in the house?
Doc_Holliwood That name is just as made up as Herbert Bollermann :D 20:16
lizmat hmmm... raku.org/downloads needs some adjustments 20:17
.oO( o what a tangled web we weave )
withp Ah nevermind my trouble was apparently in thinking that s/STUFF// was an object of type Regex, which it does not appear to be. REPL is a wonderful thing. 20:37
[Coke] I just wrote sub foo ($args) = { ... }; and it took me 2 minutes to realize what the bug was. 20:38
lizmat m: sub foo ($args) = { ... } 20:43
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3sub foo ($args)7⏏5 = { ... }
expecting any of:
new name to be defined
lizmat hmmm... error looks pretty awesome to me :-)
SmokeMachine new example using the new & operator www.irccloud.com/pastebin/PniCkltA/ 21:13
[Coke] lizmat: oh, yes, totally my fault, not raku's 21:23
Geth ¦ problem-solving: lizmat assigned to jnthn Issue Implement Adverb::Eject in core github.com/Raku/problem-solving/issues/163 21:24
tbrowder hi, folk! 23:12
anyone here use homebrew for osx? if so do you recommend it to an osx noob? 23:14
cpan-raku New module released to CPAN! Email::MIME (2.0.2) by 03RBT
[Coke] I've been happy with macports, if you want a second opinion. 23:27
but I know many folks who are happy homebrew users (including many p5ers) 23:28
cfa fwiw, i also like macports but have nothing against homebrew 23:48
also, afternoon all 23:49
tbrowder supposedly with homebrew i can get the gnu tools with same behavior as on linux as opposed to rhe bsd-like in normal osx 23:51
cfa tbrowder: coretools, gmake etc? 23:52
tbrowder that's what i think they advertise
i'll check more closely. i got the advert for them when i was looking foe emacs on mac... 23:54
my son is giving me an old mac mini i plan to use with a large screen tv, and do a little rakuing with it on the side ;-) 23:55
vrurg tbrowder: if memory serves me right, homebrew has much lesser number of ports. 23:56
tbrowder ah, that may be a deal breaker... 23:57
cfa the supposed advantage of homebrew over macports is that it leverages a lot of system-installed libraries
whereas macports tends to build its own, which in some cases are duplicates
the advantage is that everything is consistent and sandboxed
tbrowder ok, thnx, i guess it will be a new learning experience. so macports are from bsd people? 23:59