Applicative programming basically sucks, and for a really simple reason:
application
has ugly properties.
Categorical (arrow, point free) programming is really nice because the
principal operation
is function composition, and that's an associative operation.
This style of Cat-egorical programming was always intended for Felix, it is no
accident
the language is named for a very smart Cat.
Now, recently I added a new operator:
#f // means f()
That seems quite a trivial waste of a previously unused symbol .. but I'm
about to do worse and use up another one:
@x // means fun () { return x; }
I call these functions drop and lift.
Lift (@) takes a value and makes it lazy, that is, it wraps it up into a
function
which when called with unit argument returns that value.
Drop (#) calls a function with unit argument.
So here's a new way to do a calculation:
@ x . f1 . f2 . f3 .f4 . #
Basically, you lift the argment to a function, compose it with the functions
you'd be applying, then finally drop the result back to a value. Note the
dots here are meant to be reverse composition (not reverse application).
In between the lift and drop operations, we have a composition chain,
which, being associative, allows arbitrary factorisation.
[Actually ... it may make more sense to take f@ to be drop, since @
looks a bit like () anyhow .. :]
Since we now have a lot more TeX operators, I will probably disambiguate
operator . which currently means: struct field, reverse application, and
composition.
--
john skaller
[email protected]
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language