Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2004-08-12 (14:48)
From: Diego Olivier Fernandez Pons <Diego.FERNANDEZ_PONS@e...>
Subject: [Caml-list] Managing a polymorphic environment

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 Archives:
Bug reports: FAQ:
Beginner's list: