Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Mathematica has a nice syntax for function application, mapping over lists, etc. It's also possible to define such operators in Haskell, which has the added advantage of type-safety.

  f @ {1,2,3} == f[{1,2,3}]
  f /@ list == map(f, list)
  f @@ {1,2,3} == f[1,2,3]

  (#1 * 2) /@ {1,2,3} == {2,4,6}
etc.


That's like F# operator |>

    f |> g == g(f)
    [1 .. 3] |> Seq.map (fun x -> x * x) |> Seq.sum |> printfn "%A" // prints 14




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: