Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Managing a polymorphic environment
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Diego Olivier Fernandez Pons <Diego.FERNANDEZ_PONS@e...>
Subject: [Caml-list] Managing a polymorphic environment
    Bonjour,

Here is an other type related problem :

I would like to have an environment that associates strings to values

let x = ...
Env.add x "the number of elements in the knapsack"
let c = ...
Env.add c "the total cost of the knapsack"


The idea is of course to be able to pretty-print the result

# Env.print_int x;;
the number of elements in the knapsack is 10 - : unit = ()
# Env.print_float c
the total cost of the knapsack is 100.0 - : unit = ()


Env data structure can be based on equallity only since the user is
supposed to add comments only for the most important variables. The
simplest idea is once more hashing all variables. But one would like
to avoid collisions.


Any suggestion ?


        Diego Olivier

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners