caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: Jacques Carette <carette@mcmaster.ca>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] how to implement generic operators
Date: Tue, 25 Oct 2005 11:43:22 +1000	[thread overview]
Message-ID: <1130204602.18325.54.camel@rosella> (raw)
In-Reply-To: <435D35B7.2080905@mcmaster.ca>

On Mon, 2005-10-24 at 15:27 -0400, Jacques Carette wrote:
> skaller wrote:

> You really need your operations to be left-associative for that to make 
> sense... But in my toy interpreter for a subset of Maple (written in 
> Ocaml), I have
> type op = term -> term -> term * term
> and then in the eval() function for a term, a case
>    | Assoc ((f,init), l) -> List.fold_left f init l
> 
> f can be created from a term by applying a term-level lambda, 

I am already doing this for types. There is also a separate
programmable term evaluator however it works only on the syntax tree
(unbound terms).

My type term calculus has lambdas and products .. but no lists.
There is no real 'term' calculus (just ad hoc reduction
rules**).

Do you provide lists directly in the term calculus?
Or are they just constructed from products and sums?

It looks like I would have to

(1) provide a term calculator
(1a) extend the type calculator to support either lists
or
(1b) add sums and make sure recursion works

1a looks easier, clearly 1b is more general.

** the 'ad hoc' reduction rules are 'weak' things
like constant folding, plus some sophisticated
but very specialised rules for inlining and
substitution: there is no way I could really claim
this 'term calculator' I already have is a general
'calculus', in the same way that the type calculator is.


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


  reply	other threads:[~2005-10-25  1:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-24  5:20 skaller
2005-10-24 18:26 ` Ant: [Caml-list] " Martin Chabr
2005-10-25  1:09   ` skaller
2005-10-25  1:56   ` skaller
2005-10-24 19:27 ` Jacques Carette
2005-10-25  1:43   ` skaller [this message]
2005-10-25 15:52     ` Jacques Carette

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1130204602.18325.54.camel@rosella \
    --to=skaller@users.sourceforge.net \
    --cc=caml-list@yquem.inria.fr \
    --cc=carette@mcmaster.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).