Quadratics, Point-Free Form, and Named Parameters
Point-free form is just a fancy way of saying no named parameters. There are are many different possible algorithms for converting from a language with named parameters to another without any. I am about to release a version of Cat which supports optional named parameters. The turning point in making this decision to add support for named parameters to a version of Cat occured when I tried to implement a simple quadratic equation with names. A quadratic equation is any equation of the form: a*x^2 + b*x + c.
Writing that out in point-free form is some kind of nastiness resembling:
define quadratic_point_free
{
[dupd [sqr] dip swap [*] dip] dipd [* +] dip +
}
(note: I didn’t even bother testing that version :-p)
The next Cat version (not yet released, still undergoing some final testing) now supports:
define quadratic_eqn(x a b c)
{
x sqr a * x b * + c +
}
The interpreter does the conversion to point-free form automatically. I know that concatenative purists will roll their eyes, but keep in mind, that this is just a superficial conversion. The underlying Cat code is still concatenative in nature. The interpreter has an internal switch (in the source code only for now) to prevent this conversion and only allow point-free code.
[…] cdiggins.com Christopher Diggins « Quadratics, Point-Free Form, and Named Parameters […]
Pingback by cdiggins.com » Blog Archive » Cat 0.10.0 is now available at Google Code — March 29, 2007 @ 10:50 pm