TLDR: Is there a Haskell library that offers function definitions (preferably with concise notation or naming) for handling common patterns of multi-argument function composition such as those in APL?
Full Question:
I'm new to Haskell and I have recently found myself asking the types of compositi...
> Write a function that takes a character vector or scalar and returns a Boolean vector indicating anywhere an element is followed by an element of the same value.
@essielovett I'll have a look. Should be fixed now (or whenever it finishes building).
But since we have a simple vector of mixed types, the internal representation will blow up into a vector of pointers to scalar arrays. That means the 2=/ has to go pointer chasing n times. Oof.
@rabbitgrowth Exactly.
An obvious efficient (and correct) solution is {''≡⍵:'' ⋄ 0,⍨2=/⍵} but here is a challenge: Write it so it is both efficient and doesn't have a guard.
@B.Wilson The only case where this has a drop in efficiency is when you have characters in the range 128–255 (and similarly for multi-byte chars) where the character data can be stored internally as unsigned integers, but the numeric representation is signed, so it'll blow up to twice the width.
@Adám Wait. I didn't grok this properly. Why is 128-255 special? Since registers are at least 32bits wide, doesn't all of Unicode fit in the range of both signed and unsigned integers?