|
|
|
|
|
by Mystery-Machine
314 days ago
|
|
PHP: $result = $arr
|> fn($x) => array_column($x, 'tags') // Gets an array of arrays
|> fn($x) => array_merge(...$x) // Flatten into one big array
|> array_unique(...) // Remove duplicates
|> array_values(...) // Reindex the array.
; // <- wtf
Ruby: result = arr.uniq.flatten.map(&:tags)
I understand this is not pipe operator, but just look at that character difference across these two languages.// <- wtf This comment was my $0.02. |
|
I'm thinking of something like this:
which then can be in the following way: Or if we just created an alias for then #then method: then it can be used like in this way: