🦋 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.
adu how do you express empty? 02:25
wasn't something like <!> 02:26
Xliff asu: As in set empty? 02:29
Xliff m: my $a = ø; $a.gist.say 02:32
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
ø used at line 1
Xliff m: 'ø'.uniname.say
camelia LATIN SMALL LETTER O WITH STROKE
Xliff m: 'ø'.ord.say
camelia 248
Xliff m: my $a = ∅; $a.gist.say 02:33
camelia Set()
Xliff adu ^^
sourceable: ∅ 02:35
sourceable6 Xliff, No idea, boss. Can you give me a Code object?
Xliff sourceable: my $a = ∅
sourceable6 Xliff, github.com/rakudo/rakudo/blob/c7c1...ors.pm6#L9
adu Xliff, no empty grammar production 02:42
adu How you you represent the empty grammar production? 03:18
SmokeMachine m: say Empty 03:21
camelia ()
adu m: say "".match(token { Empty }) 03:25
camelia Nil
adu m: say "".match(token { <!> })
camelia Nil
adu m: say "".match(token { "something" }) 03:26
camelia Nil
adu m: say "".match(token { "" })
camelia 「」
adu There we go
timotimo m: say "".match(rx/<?>/) 03:29
camelia 「」
timotimo m: say "oh".match(rx/<?>/)
camelia 「」
AlexDaniel u: İ 07:43
unicodable6 AlexDaniel, U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE [Lu] (İ)
AlexDaniel this is so weird :D
moritz it's used in Turkey for uc('i') 08:43
El_Che I wonder if instead of declaring the name as a dependency, an uri with version (tag) could be declared. It solved the centralization problem 09:10
the only mandatory bit is forcing authors to use tags for releases, but that's something sane people do already 09:12
rbt t 14:39
gfldex lolibloggedalittle: gfldex.wordpress.com/2020/07/04/pi...made-easy/ 14:55
AlexDaniel gfldex: another meaning is “it's not provided by core yet” :P 15:15
but yes, I actually need something like this 15:16
moritz m: say <a b c>[0, 1] 15:21
camelia (a b)
moritz m: say <a b c>[0, 1]:kv.perl
camelia (0, "a", 1, "b")
moritz m: say <a b c>[0, 1]:p.perl
camelia (0 => "a", 1 => "b")
moritz I'm trying to get the index of the shortest element of an array 15:23
(and ingoring undefined values) 15:24
moritz is there anything more compact/readable than .pairs.grep(*.value.defined).min(*.value.chars).key; ? 15:24
gfldex AlexDaniel: The custom IO::Handle part or the whole thing? 15:34
Altai-man_ m: <a aa aaa a>.pairs.sort(*.value.chars).tail.key.say 15:36
camelia 2
Altai-man_ moritz, ^ maybe this one is a bit more easy to read. But not really very concise.
AlexDaniel Altai-man_: that's potentially slower 15:37
moritz m: say ('aaa', 'aa', 'a', Any).pairs.sort(*.value.chars).tail.key.say
camelia No such method 'chars' for invocant of type 'Any'
in block <unit> at <tmp> line 1
Altai-man_ Ah, and there are also undefined ones...
Ok, never mind.
AlexDaniel moritz: if you're not using sort, then you're potentially not even creating a copy of your initial array 15:40
it'll be seqs and iterators all the way through, if rakudo does things right
m: my @a = (‘foo’, ‘xxx’, ‘b’, Nil, ‘za’, ‘nnn’); say @a.pairs.min({.value.?chars // ∞}).key 15:43
camelia 2
AlexDaniel moritz: what about this? 15:44
moritz AlexDaniel: I like the sneaky way it avoids the extra grep, thanks :D
AlexDaniel m: my @a = (‘foo’, ‘xxx’, ‘b’, Nil, ‘za’, ‘nnn’); say @a[]:p.min({.value.?chars // ∞}).key 15:48
camelia 2
AlexDaniel a little bit of code golf :)
moritz I'm working on a small program that generates strings from regexes 15:50
in particular, shortest possible strings
I'm sure it's been done before (even in raku), this is just a way to solidify my understanding of regex semantics 15:51
lazy lists are gold for that :D 15:58
codesections question: are there limits (or ways to set limits) to the amount of resources a `hyper` operation takes up? I ask, because I was trying to build a shellscript like program to query zef for package info last night, and kept running into problems 16:00
I ended up using something along the lines of:
moritz codesections: .hyper(jobs => 3) iirc
codesections for $long-input.lines -> bution { f', 'info' $distribution }
moritz: thanks! That's the syntax I should have been using 16:01
moritz docs.raku.org/routine/hyper 16:02
it's degree, not jobs
codesections `hyper for $long-input.lines -> bution { f', 'info' $distribution }` was impressively capable of bringing even a pretty beefy dev machine to its knees! 16:03
moritz for $.long-input.lines.hyper(:2degree) -> $line { ... } maybe? 16:04
codesections Oh, there's my problem: I was reading the wrong docs page. I was on docs.raku.org/language/operators#i..._operators
(which doesn't mention degree) 16:05
Thanks for the pointer to the right page!
moritz enjoy, and good luck :D 16:09
samebchase- gfldex: wow. great post! 💯 16:25
gfldex :) 16:29
codesections > great post! 16:34
agreed
One question, though: is the complexity of this driven by wanting/needing to keep the async nature of shell pipes? 16:35
If you were willing to wait for the first task to finish, you could do something simple with `==>`, right?
moritz my @a = ['a', 'b'], ['X'], ['1', '2']; say cross(@a).perl; say cross(|@a).perl; 16:53
evalable6 (($["a", "b"], $["X"], $["1", "2"]),).Seq
(($["a", "b"], $["X"], $["1", "2"]),).Seq
moritz none of those seem to work
moritz what do I have to do to get the cross product of an array of arrays? 16:54
my @a = ['a', 'b'], ['X'], ['1', '2']; say cross(@a.map(*.list)).perl 16:55
evalable6 (("a", "X", "1"), ("a", "X", "2"), ("b", "X", "1"), ("b", "X", "2")).Seq
moritz aaaaargh, I HATE list handling
why do I need the .list here?
tobs m: my @a = ['a', 'b'], ['X'], ['1', '2']; say [X] @a 16:56
camelia ((a X 1) (a X 2) (b X 1) (b X 2))
tobs does this do what you needed? As for the *.list, I don't know :/ 16:57
moritz tobs: that'd help, but in the end I actually want to do cross(..., :with)
JJMerelo The .Seq will be introduced by the map, right? And then propagated to cross 16:59
tobs aha
m: say cross(['a', 'b'], ['X'], ['1', '2'])
camelia ((a X 1) (a X 2) (b X 1) (b X 2))
tobs so it seems to be signature of cross's doing
jnthn m: my @a = ['a', 'b'], ['X'], ['1', '2']; say [X] @a
camelia ((a X 1) (a X 2) (b X 1) (b X 2))
moritz tobs: if that works, I don't understand why cross(|@) doesn't work
cross(|@a) 17:00
JJMerelo: I don't see how the fact that map returns a Seq affects how &cross treats the individual items
JJMerelo moritz right... Well, if cross returns a Seq, I can't really see how you would make it return something else. Why is Seq a problem? 17:02
moritz JJMerelo: that's not my problem at all 17:03
my @a = ['a', 'b'], ['X'], ['1', '2']; say cross(@a)
evalable6 (([a b] [X] [1 2]))
moritz my problem is that in this example, cross treats each inner list as a single item
my @a = ['a', 'b'], ['X'], ['1', '2']; say cross(|@a)
evalable6 (([a b] [X] [1 2]))
moritz and here as well
but in
say cross(['a', 'b'], ['X'], ['1', '2']) 17:04
evalable6 ((a X 1) (a X 2) (b X 1) (b X 2))
moritz it doesn't
and I don't understand that, because my mental of anything(|@a) is that it behaves the same as anything(@a[0], @a[1], ...)
my @a = ['a', 'b'], ['X'], ['1', '2']; say cross(@a[0], @a[1], @a[2]) 17:05
evalable6 (([a b] [X] [1 2]))
moritz so putting the inner arrays into the outer array magically itemizes them 17:06
moritz so >.< close to switching to python
tobs IIRC everything in an array is by default itemized
or well, I don't know. That's a very dark corner of Raku for me. 17:07
moritz I know that array elems need to be containers to allow modifications, but I thought we were past the "a container itemizes" stage 17:08
maybe not
I hate all this list flattening and unflattening magic so much 17:09
JJMerelo It can get complicated and messy, yes...
moritz you know, in python `for i in x()` just throws an exception if x() doesn't return anything iterable
and a, b is always a two-element tuple, no matter the contents of a and b
and then it has an explicit concatenation operator 17:10
it sometimes requires a tiny bit of manual effort, but all the edge cases are perfectly logical and pretty easy to understand
in python, lazy generators and lists are distinct; again not always as comfortable as lazy lists, but performant and easy to understand 17:13
AlexDaniel moritz: is it the case of docs.raku.org/language/traps#Using...t_of_lists ? 17:23
I'm not really following 17:24
moritz: well, yes, Raku is really hard. Nothing is ever straightforward or easy to understand 17:26
there used to be a saying about “baby talk” or something like that, but one thing that people don't mention out loud is that nobody is ever able to learn any feature fully 17:28
AlexDaniel so Raku is fun when you start using it, but the further you go the more frustrated you get 17:29
all the quirks and edge cases bring so much mental load that it's almost unbearable 17:30
“A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away.” 17:32
there's a lot of things to take away from Raku, so you can probably guess what I think about the design :) 17:33
[Coke] tries an older version of rakudo to see if cro works on that. :| 17:34
(zef install cro on this box is soooooo slow. wtf.) 17:40
is there a way to get verbose test output with zef? 'zef test .' is just showing that tests failed. 17:50
timotimo does --verbose or --debug help? zef has many flags in general 17:52
[Coke] verbose did it, thanks 17:53
I tried test --help and it didn't show --verbose (probably a global option not one for the subcommand) 17:54
timotimo ah, possible 17:55
moritz gist.github.com/moritz/af5f3cfcd49...045c1060b9 my basic regex inverter 18:50
supports literals, char classes, alternatives(branches) and quantifiers 18:51
Geth ecosystem: 8b9cf5b873 | thundergnat++ (committed using GitHub Web editor) | META.list
Add Terminal-Boxer

Automatically generate boxed tables, primarily for use in a terminal.
See: github.com/thundergnat/Terminal-Boxer
18:53
[ptc] moritz: is that what was causing you headaches earlier this evening? 18:55
moritz [ptc]: I'd say Raku's list semantics caused the headaches, and I encountered them while implementing them :D 18:56
[ptc] :-D
moritz gist updated; now supports conjunctions 19:11
holyghost I've just passed my 1st year bachelor of arts (painting) ! 19:16
moritz I wonder if I should add a parser for the regexes :D
holyghost: congrats!
holyghost while working for perl mongers :-) 19:17
codesections (I don't know you but…) congrats! 19:18
moritz gist.github.com/moritz/af5f3cfcd49...045c1060b9 updated with a basic regex parser 20:34
it only supports word characters for literals and char class contents, otherwise it supports quantifiers, conjunctions and discjunctions, groups 20:36
moritz haven't tried really hard to get the precedence of the parser right, you can always use [] to correct precedence 20:37
[ptc] moritz: are you working on an update to your regex book? 20:50
moritz: just saw your tweet. That answered my question :-) 20:51
moritz nope. And I think it would be too much of a distraction from how regexes work, even if it's somewhat illustrative 20:53
it's a bit sad; the regex book is the one I'm most proud of, but it's the one with the fewest sales 20:54
lizmat but I bet it's a book that is more appreciated by the fewer people that *do* have it 20:55
[ptc] yup, definitely. I definitely enjoyed it while reviewing it :-) 20:57
moritz the feedback has been very positive 20:58
cpan-raku New module released to CPAN! LibXML (0.5.4) by 03WARRINGD 23:02