Re:Clio: A functional, distributed programming language that...
by efdb on Thursday March 18, 2021 @07:09AM
(#26501469)
i really like the syntax, very intuitive use of ->
[ Parent
| on HN ]
Re:Clio: A functional, distributed programming language that...
by runeks on Thursday March 18, 2021 @11:14AM
(#26503527)
I wonder if there’s such a thing as intuitive syntax.
As far as I can see, the arrow signifies function application. Why do you consider “a -> f” more intuitive than, say, “f(a)” or “f a”?
Re:Clio: A functional, distributed programming language that...
by aloisdg on Thursday March 18, 2021 @11:35AM
(#26503737)
because a -> f -> g -> h is better than h(g(f(a))). It is the functional way of doing the OOP fluent builder pattern: a.f().g().h()
It is the pipe operator (F#, Elixir, Haxe, etc.). There is a proposal to add it to js too.
Re:Clio: A functional, distributed programming language that...
by mlajtos on Thursday March 18, 2021 @11:55AM
(#26503978)
On top of that, it is a symmetrical to fat arrow functions, which is a shorthand for lambda:
fun: x => x * 2
res: 4 -> fun
Re:Clio: A functional, distributed programming language that...
by vorticalbox on Thursday March 18, 2021 @03:05PM
(#26506314)
I have always used ramdajs for this.
const R = require('ramda');
R.pipe(a,f,g,h)