r/programminghorror • • 1d ago

One pipe through String, Array, and Map

Post image
0 Upvotes

10 comments sorted by

3

u/NatoBoram 1d ago

Looks like Elixir. Pipes are very cool.

15

u/monotone2k 1d ago

How is this horror? Looks like pretty standard query stuff.

0

u/Agitated-Display6382 1d ago

I dislike that map({x.value.length()}) still contains the original value. A map should just return the computed value

1

u/Elfet 1d ago

x is `Entry[string, Array[string]]` with { key, value }

How else do you map a Map{}?

0

u/Agitated-Display6382 1d ago

After map, I would expect to have only the computed value. Sort of: given f

foreach x in myArray yield return f(x)

Not: yield return (x, f(x))

2

u/Elfet 1d ago

1

u/Agitated-Display6382 1d ago

2

u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" 1d ago

Why are all your comments at 0 instead of the default 1? Did you piss someone off enough that they are using a bot to instantly downvote every comment you make?

-1

u/Agitated-Display6382 1d ago

Nice explanation! I always remove my own upvote.