[Ur] stateful structure?

Adam Chlipala adamc at impredicative.com
Thu Nov 3 08:51:44 EDT 2011


Gergely Buday wrote:
> Adam wrote:
>
>    
>>> Ok, but there is another problem here. How can I refer from an
>>> identifier to a value? A handy solution would be a hash table in perl
>>> or an array in other languages, but these are not available in Ur.
>>>        
>> I wouldn't advise taking Marc's choice of identifier literally.  You would
>> represent [counter_id] as the data you need, rather than a key into a table
>> containing that data.  I would just call the type [t], personally, and
>> definitely not include "ID" anywhere in the name.
>>
>> This seems just like what one often does in SML or OCaml, so you might want
>> to consult resources on those languages.
>>      
> I do not see what do you refer to. Could you give more details?
>    

No, sorry, I can't.  It's just normal to have abstract types in ML 
modules implemented with impure types like "ref".

For instance, OCaml's "Hashtbl":
     http://caml.inria.fr/pub/docs/manual-ocaml/libref/Hashtbl.html




More information about the Ur mailing list