On Sat, 2006-09-02 at 09:37 -0400, Peter Tanski wrote:
> > No, the problem is I never defined
> >
> > <a,b,c>
> >
> > The <> here has 3 arguments. The 'obvious' definition is
> >
> > <f,g,h> (a,b,c) = (f a, g b, h c)
> >
> > which is what we want. Etc for 4, 5. I can easily
> > define <> in the Felix *compiler*. There is no way to
> > define it in *Felix*.
> >
> > You can't even write out its type.
> >
> > The pattern calculus will solve this. (I hope).
>
> How will pattern calculus solve it?
Recursive expansion of patterns n times for variable
n allows them to match ANY tuple. The user can write
the match, and reduction rules, straight into the
library.
> (This is a real question, not a
> jibe.) Felix is unlike other functional languages in that the
> operators have definite types
I don't understand what you mean.
> (in Haskell the tuple operator is not a
> type but an operation;
Still don't understand: Felix has both a tuple
constructor AND a tuple type constructor.
> > But whilst I can define say
> >
> > (f,g,h) @@ (a,b,c) = (f a, g b, h c)
> >
> > Of course in the compiler I can do it easily.
>
> Do you think it would be feasible to create an extension where a
> programmer working in Felix could do this?
Yes, I think the pattern calculus can do it easily.
The point is: the underlying Ocaml data structure is already
a list, and hence you can fold over it already (in Ocaml).
There's just no way to write functions which operate on
bound terms: the macro processor CAN do it already, for
untyped unbound terms (but you lose lexical scoping etc:
macro processing sucks :)
> (Meta-programming, see
> below.) It shouldn't matter in the end, if the result of defining
> these operators is to create a programming language that *is*
> category theory. Want a user-base? Introduce this to researchers :)
Indeed, but it has to work first :)
> In any case, I asked how you are implementing this because if it
> seems like a laborious project maybe another set of hands would help.
The pattern calculus implementation for TYPE terms is done
in a crude form. Grep for
`BTYP_case
in the sources.
It already works, although I'm not sure
if it is correct. Unfortunately, the Felix type system
supports type functions and products:
c | -> | *
but not sums, so I don't have many constructors to play
with other than constants like 'int' :)
So actually if someone could read the paper and help
me understand if the implementation is right .. that
would help! Reading my Ocaml code is not a thing
to look forward to (but I can explain what some
of it does .. :)
--
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