In rust this tends to look like
let s = vec!["string1", "string2"]
.map(String::from)
.map(|s| s.split('-'))
// etc...
Note that julia is doing some magic there - it knows that the fn x->x.^2
applies to the elements, and sum
applies to the whole array. In haskell you'd probably (I'm not an expert) need to use the functor
or applicative
typeclasses when mapping the first function over the array. I wrote a blurb about these higher order constructs on urlo.
Edit There's also operator precedence to consider. In haskell, there are 2 ways of doing function application: func arg
and func $ arg
. The latter has much lower precedence, so you can do things like
func1 . func2 . func3 $ arg
(where .
is the compose operator).