So, I have a function f that takes a string as input. I want to create a function g that maps f to a vector of strings. I.e.
g 'Hello' 'world'
should yield
(f 'Hello')(f 'world')
Here's what I did:
g ← {f¨⍵}
And this works just fine for the example above. However, it doesn't work when the right argument is just one string, as it maps f to every character of that string. For example:
g 'Hello'
yields
(f 'H')(f 'e')(f 'l')(f 'l')(f 'o')
Of course, I wanted the output to be f 'Hello'.
I could write
g ← {f¨⊂⍵}
So that 'Hello' would be interpreted as
┌─────┐
│Hello│
└─────┘
But then 'Hello' 'world' will be interpreted as
┌─────────────┐
│┌─────┬─────┐│
││Hello│world││
│└─────┴─────┘│
└─────────────┘
And then it won't map correctly.
Is there a way to solve this succinctly?