Pip, distance 3
Joining the club of trivial no-comments-but-lots-of-no-ops golflang answers...
Given a set of integers, find the sum of all integers in $+g
GitHub repository for Pip
The code practically documents itself; maybe s/in/using/
for a more accurate description. Integers given as command-line arguments are read into the list g
, which is here folded on addition and the result auto-printed. Most everything else is just variables, which are no-ops.
I was a bit surprised at first that s, f
worked without complaining, since f
refers to the main function and taking the range of a code block doesn't make sense. But then I realized: the ,
range operator, when given a function argument, just constructs another function (as do many operators in Pip). So I think s, f
evaluates to {Given a set of integers, find the sum of all integers in " ",$+g}
. (Which is then discarded anyway.)
One final point: this code works with the current version of Pip, in which I haven't assigned G
to anything yet. If in some future version I make G
a binary or ternary operator, then a distance-4 version would be necessary. Using given
instead of Given
would work nicely.