|
|
|
|
|
by awwaiid
1981 days ago
|
|
There are a TON of experiments and language mash-ups in Raku. Let's see here.... Types can include guard clauses that are evaluated at runtime. Typed multi-dispatch on top of that. In addition to normal "sets" it has "junctions", like some sort of funky quantum superposition or something. In theory those can be made parallel at some point. Stuff like that. One that is particularly funky is the "whatever-star". This is a "" char that can be used in a few places to mean more or less... whatever. For example: <4 5 6 7>.map(-> $x { $x + 7 }) # result: (11 12 13 14)
That stabby inline lambda there can be sugared down in a lot of ways, including with the whatever-star: <4 5 6 7>.map(* + 7) # result: (11 12 13 14)
... I've not seen anything quite like that in other languages, not sure if it is a new invention or if only nobody else is crazy enough to try it. And yes, you can use multiplication next to it to make it look crazier: <4 5 6 7>.map(* * 7) # result: (28 35 42 49)
(also yes, ( * *) will take two inputs and multiply them.)I will note though that dwelling on these crazy/fun edge cases is amusing, but programs can look quite a bit more like a basic ruby app (with sigils) if you so desire. |
|