🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
mscha m: enum Dir <N E S W>; my Dir %opposite{Dir} = N=>S, E=>W, S=>N, W=>E; 10:02
camelia Type check failed in binding to parameter 'key'; expected Dir but got Str ("N")
in block <unit> at <tmp> line 1
mscha enum Dir <N E S W>; my Dir %opposite{Dir} = :N(S), :E(W), :S(N), :W(E);
m: enum Dir <N E S W>; my Dir %opposite{Dir} = :N(S), :E(W), :S(N), :W(E);
camelia Type check failed in binding to parameter 'key'; expected Dir but got Str ("N")
in block <unit> at <tmp> line 1
mscha m: enum Dir <N E S W>; my Dir %opposite{Dir} = N,S, E,W, S,N, W,E;
camelia ( no output )
mscha Is there an elegant/short syntax to create a pair that doesn't stringify the key? 10:03
araujo hello 10:04
lizmat mscha: I don't think so: Pair.new(N,S) is the shortest I could come up with 11:00
m: sub infix:<P>(\a,\b) { Pair.new(a,b) }; enum Dir <N E S W>; my Dir %opposite{Dir} = N P S, E P W, S P N, W P E 11:04
camelia ( no output )
lizmat m: sub infix:<P>(\a,\b) { Pair.new(a,b) }; enum Dir <N E S W>; my Dir %opposite{Dir} = N P S, E P W, S P N, W P E; dd %opposite
camelia Hash[Dir,Dir] %opposite = (my Dir %{Dir} = Dir::N => Dir::S, Dir::E => Dir::W, Dir::S => Dir::N, Dir::W => Dir::E)
lizmat m: enum Dir <N E S W>; my Dir %opposite{Dir} = DIr::N=>S, Dir::E=>W, Dir::S=>N, Dir::W=>E; 11:06
camelia Could not find symbol '&N' in 'GLOBAL::DIr'
in block <unit> at <tmp> line 1
lizmat m: enum Dir <N E S W>; my Dir %opposite{Dir} = Dir::N=>S, Dir::E=>W, Dir::S=>N, Dir::W=>E;
camelia ( no output )
lizmat mscha: ^^ perhaps shorter
mscha Thanks, lizmat! 11:07
Geth advent/main: dc57da7869 | (Elizabeth Mattijsen)++ (committed using GitHub Web editor) | raku-advent-2023/authors.md
Schedule day 12 and 14
11:54
mort does raku have some way of doing what C++ would call pure virtual methods, or what Go or Java would call interfaces 13:57
nemokosch I suppose that would be a role with a method that has a dummy missing implementation (e.g yadda-yadda operator) 14:18
Geth advent/main: ac4c7b5d10 | ab5tract++ (committed using GitHub Web editor) | raku-advent-2023/authors.md
Update authors.md
14:43
Geth advent/main: cce3035002 | (Elizabeth Mattijsen)++ (committed using GitHub Web editor) | raku-advent-2023/authors.md
Make sure holes in schedule remain
15:24
gdown Is there a builtin way to index multidimensional arrays by a single variable containing the index? For example: `my @idx = 1,2; [[1,2,3],[4,5,6],[7,8,9]].multidimensional-index(@idx)` => 6 16:48
tbrowder__ .tell lizmat i tried to comment on Q article but couldn't get the right link, but here it is: 16:56
tellable6 tbrowder__, I'll pass your message to lizmat
tbrowder__ .tell lizmat "m
tellable6 tbrowder__, I'll pass your message to lizmat
tbrowder__ .tell lizmat "notably quoteable" 16:57
tellable6 tbrowder__, I'll pass your message to lizmat
grondilu m: my @idx = 1,2; [[1,2,3],[4,5,6],[7,8,9]][|@idx]
camelia ( no output )
grondilu m: my @idx = 1,2; say [[1,2,3],[4,5,6],[7,8,9]][|@idx]
camelia ([4 5 6] [7 8 9])
grondilu hum
grondilu m: my @idx = (1;2); say [[1,2,3],[4,5,6],[7,8,9]][|@idx] 16:58
camelia ([4 5 6] [7 8 9])
antononcube @grondilu I also thought that slip can be used, but not so much. 🙂 One has to use 1;2 -- I am not sure how make it from a list. 17:00
@gdown Good question! One -- unelegant -- solution is to use this definition : sub multidimensional-index(@pos) { -> @a { reduce( {$^a.slice($^b).head }, @a, |@pos) } } . 17:10
@gdown If one knows what is the actual infix operator corresponding to ; in this expression @a[1;2] , then a simple function can be defined. 17:12
nemokosch gdown: || to the rescue (will come with 6.e) 17:20
m: use 6.e.PREVIEW; my @idx = 1,2; [1,2,3],[4,5,6],[7,8,9].say 17:21
evalable6 Cannot test e22987f4cae5b26163a18c3e76e9fead37e601bf (Commit exists, but an executable could not be built for it)
linkable6 (2023-12-08) github.com/rakudo/rakudo/commit/e22987f4ca Simplify internal QX sub
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Undeclared routine: use used at line 1 (in Raku please use "v" prefix for pragma (e.g., "use v6;", "use v6.c;") instead)
nemokosch yeah damn v
m: use v6.e.PREVIEW; my @idx = 1,2; [1,2,3],[4,5,6],[7,8,9].say
evalable6 Cannot test e22987f4cae5b26163a18c3e76e9fead37e601bf (Commit exists, but an executable could not be built for it)
Raku eval 6
librasteve 🍬 17:23
scullucs Is that a "slip, slio"? 17:24
lucs * slip, slip 17:25
nemokosch I think technically it's a prefix || operator
m: use v6.e.PREVIEW; my @idx = 1,2; ||@idx andthen .WHAT.say; 17:26
evalable6 Cannot test e22987f4cae5b26163a18c3e76e9fead37e601bf (Commit exists, but an executable could not be built for it)
Raku eval (Slip)
linkable6 (2023-12-08) github.com/rakudo/rakudo/commit/e22987f4ca Simplify internal QX sub
nemokosch only says slip
I don't know how it works, to be honest
m: use v6.e.PREVIEW; my @idx = 1,2; ||@idx andthen .&dd;
evalable6 Cannot test e22987f4cae5b26163a18c3e76e9fead37e601bf (Commit exists, but an executable could not be built for it)
Raku eval slip(1, 2)
librasteve i nominate the name 'slid operator' since its a slip with extra dims 17:36
gdown Oh, sweet! I saw that syntax in the design docs, but I assumed I misunderstood it. I didn't realize it just wasn't implemented yet 17:42
librasteve there's a hint of what is going on here in the docs say so (1,2; 3,4) eqv ((1,2), (3,4));
lizmat . 17:43
tellable6 2023-12-10T16:56:13Z #raku <tbrowder__> lizmat i tried to comment on Q article but couldn't get the right link, but here it is:
2023-12-10T16:56:43Z #raku <tbrowder__> lizmat "m
2023-12-10T16:57:15Z #raku <tbrowder__> lizmat "notably quoteable"
librasteve fwiw I would be interested how to mix prefix '|' and prefix '||' to handle slices in multidims
lizmat tbrowder_: not sure I understand what you're saying 17:46
antononcube @nemokosch ''|| to the rescue (will come with 6.e)" -- Cheating!!! 17:47
tbrowder__ "notable quoteables" is a reference to a weekly segment on our fave news show. it features short clips of mostly celebreties saying something catchy, profound, timely, or stupid. your Q article falls in the profound and timely categories and it is definitely "quotable!" a bad pun maybe, but i couldn't resist. :-D 18:25
lizmat aaah... ok, I'll take that as a compliment then :-) 18:29
Xliff \o 20:33
Xliff Is there a way to emulate a character class but for multi character sets? 20:33
So I want to do something like this / <-[<>]>+ /
But replacing '<' with '[%' and '>' with '%]' -- and the observant amongst you may be able to suss out the use case. :) 20:34
tbrowder__ lizmat: it definitely is! 21:28