News for hackers. Stuff that matters.
Re:Sisal: a functional parallel programming language by prodigal_erik on Monday June 27, 2016 @07:25AM (#11985458)
It's hard to beat Haskell operator sections where you can just write

  (* 2)
and get an anonymous function that does

  \x -> x * 2
Re:Sisal: a functional parallel programming language by RodgerTheGreat on Monday June 27, 2016 @07:57AM (#11985568)
In K, you could just say

  2*
Re:Sisal: a functional parallel programming language by pathsjs on Monday June 27, 2016 @11:26AM (#11986766)
In Scala and in Factor too! ;-)
Re:Sisal: a functional parallel programming language by gizmo686 on Monday June 27, 2016 @08:27PM (#11990615)
It would be nice if Haskell could figure out (-) functions; as it is, it always consider things like (- 2) to be a number, not a function (even when only a function would typecheck).
Re:Sisal: a functional parallel programming language by prodigal_erik on Tuesday June 28, 2016 @11:47PM (#11999356)
ML might have had the right idea, using op~ for unary negation and op- for binary subtraction. I definitely would not want parsing to depend on type declarations; that's a slippery slope towards Perl...
Re:Sisal: a functional parallel programming language by gizmo686 on Wednesday June 29, 2016 @12:06AM (#11999425)
I suspect that you could do this already using typeclasses. We want (-2) to be a function of the type `Num a => a -> a`, so we could, in theory, make functions of this type an instance of Num.

I do not immediately see this causing problems for correct programs, but it would probably lead to horribly confusing problems in incorrect code, including converting some type errors into runtime errors.

A simpler approach is to say that you can not have a space after the unary "-", so (-2) parses to a numeric literal, and (- 2) parses to a function.