On Thu, 2006-08-31 at 14:26 -0400, Peter Tanski wrote:

> > What's point-free style?
> 
> Here is another example:
> 
> getSongFiles :: Plist -> [String]
> getSongFiles = pTypeListToStrings . songFiles . onePDictToMap . tracks

Excuse me .. do you mean like this:

-------------------------------
#import <flx.flxh>

#infix 10 "@" compose

fun compose[a,b,c] (f: b -> c, g: a-> b) (x:a) => f (g x);;

fun sq(x:int)=> x * x;
fun db(x:int)=> x + x;

print$ the sq @ the db $ 3; endl;
------------------------------

[EMAIL PROTECTED]:/work/felix/svn/felix/felix/trunk$ flx --test --force ab
36
--------------------------------

Sorry but the 'the' is needed, since functions can be overloaded,
merely writing 'sq' would denote a set of functions, which is
the wrong kind. 'the' converts a singleton set to its sole member
(and fails otherwise).

Composition is but one of a host of what I call 'categorical
combinators'. Here is another one:

        <f,g> (a,b) = (f a, g b)

And now we have a law (using . for composition):

        <f,g> . <h,k> = <f . h, g . k>

in other words <_,_> commutes with _ . _
[If you draw a picture you get a commuting square]

BTW: I don't think you can implement <_._> because it
needs to be an chainable operator, that is, accept
arbitrary n arguments, since tuple formation isn't associative.
Composition is, so a binary operator is enough.

There are a LOT of these operators. I plan to add them all,
but before I do I need to list them and try to figure a systematic
notation.

The HARD part is every such 'executable' expression has a 
corresponding typing .. the type terms ALSO have to be
combined.

Unfortunately, the same notation cannot be used. For example:

        val a : int * int = 1,2;

Why not use ',' for the type:

        int,int

Wouldn't that be better, so the typing is symmetrical with
the expressions?

The answer is NO. Unfortunately. Because tupling ALSO means
something quite different for types:

        typedef fun pair (U: TYPE, V: TYPE): TYPE => U * V;
        typedef pis = pair (int, string);

You see that 'int,string' is actually a pair of types.
This is NOT the same thing as a tuple type. The 'pair'
above is a bifunctor

        pair: TYPE * TYPE -> TYPE

and so its argument is a pair (int, string) which is tuple
one level up in the kinding system. [Unlike Ocaml or Haskell,
Felix has an explicit kinding system, but the work on it
isn't finished]

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to