This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html Set by lizmat on 8 June 2022. |
|||
01:04
Manifest0 left
|
|||
_tailgate | What does the ^ mean in $^a and $^b in this code: 'bca'.comb.sort({$^b cmp $^a}).join ? Thanks! | 03:14 | |
vendethiel | docs.raku.org/language/variables#The_^_twigil | 03:22 | |
09:02
Manifest0 joined
09:06
Manifest0 left
09:17
dakkar joined
09:20
Manifest0 joined
10:11
bazzrrr0 joined
14:17
bazzrrr0 left
|
|||
antononcube | Is there are an operator I can use to apply a function, &f , to an array of arguments, my @arr = [1, 12, 4]? I know I can do &f(|@arr) , and I can program a corresponding operator. But maybe there are built-in operator(s) doing that already. | 17:02 | |
Related question, if I have an array of functions/subs and an array of numbers, then can specify if a "cross product" of function-to-arugment application with X ? For example, [&f, &g] X<op> [1,2,3] , where <op> is a certain operator. | 17:06 | ||
17:32
dakkar left
|
|||
SmokeMachine | m: sub call(&func, |c) { func |c }; [&say, &put, ¬e, &warn] X[&call] <bla ble bli blo> # <-- antonnoncube | 17:43 | |
camelia | Potential difficulties: Useless use of X[&call] in sink context at <tmp>:1 ------> { func |c }; [&say, &put, ¬e, &warn] ⏏X[&call] <bla ble bli blo> # <-- antonno bla ble bli blo bla ble bli blo bla ble… |
||
SmokeMachine | m: sub call(&func, |c) { func |c }; quietly [&say, &put, ¬e, &warn] X[&call] <bla ble bli blo> # <-- antonnoncube | ||
camelia | bla bla ble bli blo bla ble bli blo ble bli blo bla in sub call at <tmp> line 1 ble in sub call at <tmp> line 1 bli in sub call at <tmp> line 1 blo in sub call at <tmp> line 1 |
||
antononcube | @SmokeMachine Thanks! This is useful. But, I assume it also means that there are no built-in operators for that kind of specs. | 18:15 | |
gfldex | m: my @a = 1,2,3; @a».&{ .&say, .¬e }; | ||
Raku eval | 1 2 3 1 2 3 | ||
antononcube | 👍🤔 | 18:19 | |
@gfldex Thanks that seems like a good solution. (I do not consider it great, though. Just good enough.) | 18:47 | ||
gfldex | m: multi sub infix:<o»>(@f, *@a) { @a.hyper.map(-> $e { @f.map( -> &f { f($e) }) }) }; say (&say, ¬e) o» <1 2 3>; | 18:54 | |
Raku eval | 1 2 3 ((True True) (True True) (True True)) 1 2 3 | ||
gfldex | @antononcube You are likely better of to write your own operator. That way you can hyper if you like or drop return values if you don't need them and add adverbs to control behaviour. | 18:55 | |
So to answer your initial question: There is no such operator … yet. Because you didn't write it. :-> | 18:57 | ||
antononcube | @gfldex > You are likely better of to write your own operator. | 19:05 | |
The solution you give is good, but it is too OOP for my taste. | 19:06 | ||
20:45
hudo joined
20:58
hudo left
|