News for hackers. Stuff that matters.
Re:Ante: A low-level functional language by HelloNurse on Friday June 17, 2022 @06:13AM (#31776156)
If fn 1 is an allowed function call syntax then fn (1) should be synonymous because 1 is expected to be the same as (1) except for a slightly different parse tree; but there might be good reasons to make fn 1 not a function call (for example, the implicit operator in a sequence of two expression without parentheses could be string concatenation rather than function application).
Re:Ante: A low-level functional language by curryhoward on Friday June 17, 2022 @06:37AM (#31776290)
> the implicit operator in a sequence of two expression without parentheses could be string concatenation rather than function application

You can design a language which uses `e1 e2` to represent any binary operation you like, but I'd argue that function application is more common than string concatenation, so it's more deserving of that syntax. Plus, it plays nicely with currying.

Re:Ante: A low-level functional language by dan-robertson on Sunday June 19, 2022 @05:42AM (#31797816)
I’ve sometimes thought that a reasonable alternate choice would be:

  f g = composition of f then g
  x.f = f applied to x
  x.f g h = in regular notation h(g(f(x))
Though slightly different precedence rules may be preferable.

I think the k in awk considered juxtaposition-as-string-concatenation to have been a mistake by the way.

Some other reasonable choices may be:

- disallowed syntax

- multiplication (which, for matrices, is a special case of function composition and application)

- inner join which can be seen a bit like function composition but for relations instead of functions

- sequencing (ie instead of ‘;’)

Re:Ante: A low-level functional language by ebingdom on Sunday June 19, 2022 @07:31AM (#31798348)
That's an interesting idea, but how does it work for functions of multiple arguments?

If functions are curried, then I suppose the syntax for `f x y` would be `y.(x.f)`, which maybe you could write as `y.x.f` if the associativity worked as such. But that means you have to provide your arguments in reverse order?

If functions are not curried, do you write `(x, y).f`?