Hacker News new | ask | show | jobs
by Joker_vD 588 days ago
An array in Powershell, when piped to a command, automatically get this command invoked for each of the array's element and the results are combined into a new output array, which can be piped further.

A junction in Raku, when given as an argument to a function, automatically applies this function to each of the junction's element and the results are combined into a new junction as a result.

I don't know, seems like a pretty clear parallel to me. And since the Powershell's behaviour is quite often undesirable, I agreed with the original commenter that perhaps the junctions could also be somewhat annoying to use instead of just working normal lists: after all, "s in ('this', 'that', 'other')" is about just as clear as "$string ~~ “this”|”that”|”other”" but doesn't require support for magical self-destructuring containers in the language.

1 comments

Since I rarely use junctions myself -- and never in the manner of applying non-boolean operations across their values -- the connection to automatic function application wasn't clear to me from your initial comment.

I can see the parallel now, so thank you for clarifying.

EDIT: On further reflection, another reason that the connection escaped me is that even after applying functions across a junction’s values, the junction is never useful (without significant and unnecessary effort) for accessing any individual values that it contains.

Anyway, thanks for sharing your thoughts and bearing with me.