> Below is a quick tentative implementation of NbE, on a slightly
> restricted expression type (I removed the not-so-interesting Minus
> nodes).
Sorry, I forgot to give a small example of what the implementation
does. Really the obvious thing, but it may not be so obvious just
looking at the code.
- Mail original -
> De: "Diego Olivier Fernandez Pons"
> À: "caml-list"
> Envoyé: Dimanche 2 Octobre 2011 13:51:13
> Objet: [Caml-list] How to simplify an arithmetic expression ?
> OCaml list,
> It's easy to encapsulate a couple of arithmetic simplifications into a
> function that applies
On Sun, Oct 2, 2011 at 6:32 PM, Xavier Leroy wrote:
> NBE is neat, but I'm skeptical that it will work out of the box here:
> if you apply NBE to a standard evaluator for arithmetic expressions,
> it's not going to take advantage of associativity and distributivity
> the way Diego wants.
My idea
On Sun, Oct 2, 2011 at 10:08 AM, Gabriel Scherer wrote:
> One approach I like for such simplifications is the "normalization by
> evaluation" approach.
NBE is neat, but I'm skeptical that it will work out of the box here:
if you apply NBE to a standard evaluator for arithmetic expressions,
it's no
I forgot to mention that you need lablgtk2's adrien/mix branch for the
examples (and only for the examples iirc).
There are two reasons. It uses some additional API, especially
#as_something methods and "notify::foo" signals. lablwebkit also
requires a bug fix that it not merged into master yet.
> On Sun, Oct 2, 2011 at 1:51 PM, Diego Olivier Fernandez Pons
> wrote:
>> OCaml list,
>> It's easy to encapsulate a couple of arithmetic simplifications into a
>> function that applies them bottom up to an expression represented as a tree
>> let rec simplify = function
>> | Plus (e1, e2)
Hi,
I am pleased and relieved to announce lablgtk-react, a project to ease
the use of Functional Reactive Programming (FRP) for lablgtk-based
graphical user interfaces.
Currently, the project is available as a preview but I am happy with the
way it is looking and with the programming style it off
In my experience, the OCaml code doing recursive call and pattern
matching is a relatively bad way to reason about such rewrite systems.
Your questions are extremely pertinent, and relatively difficult to
answer in general.
For a start, I think your code indeed repeats useless traversals. This
can
OCaml list,
It's easy to encapsulate a couple of arithmetic simplifications into a
function that applies them bottom up to an expression represented as a tree
let rec simplify = function
| Plus (e1, e2) ->
match (simplify e1, simplify e2) with
| (Constant 0, _) -> e2
Le 30/09/2011 02:00, Taylor Venable a écrit :
> B. Although I link to Batteries (version 1.4.1) I don't use its IO
> layer.
If so, then my experience is probably irrelevant. But sometimes with
batteries there are "implicit" things. A long time ago I had a problem
which looked similar (output seemed
10 matches
Mail list logo