Does Haskell have a splat operator like Python and Ruby?

前端 未结 3 1521
忘了有多久
忘了有多久 2021-01-01 19:23

In Python and Ruby (and others as well, I\'m sure). you can prefix an enumerable with * (\"splat\") to use it as an argument list. For instance, in Python:

3条回答
  •  伪装坚强ぢ
    2021-01-01 20:18

    Yes, you can apply functions to tuples, using the tuple package. Check out, in particular, the uncurryN function, which handles up to 32-tuples:

    Prelude Data.Tuple.Curry> (+) `uncurryN` (1, 2)
    3
    

提交回复
热议问题