Annotation of researchv10no/cmd/sml/doc/examples/awk/stringtab.sml, revision 1.1

1.1     ! root        1: (* stringtab.sml *)
        !             2: 
        !             3: functor StringTable(type elem val default: elem) = 
        !             4: struct
        !             5: 
        !             6:   type awkTable = elem ref Stringmap.stringmap
        !             7: 
        !             8:   fun new() = Stringmap.new(): awkTable
        !             9: 
        !            10:   fun set (t: awkTable) (s:string, x:elem) : unit =
        !            11:       let val r = Stringmap.map t s in r := x end
        !            12:       handle Stringmap.Stringmap => Stringmap.add t (s,ref x)
        !            13: 
        !            14:   fun get (t: awkTable) (s:string) : elem =
        !            15:       !(Stringmap.map t s)
        !            16:       handle Stringmap.Stringmap => default
        !            17: 
        !            18:   fun app (t: awkTable) (f: string * elem -> unit) =
        !            19:       Stringmap.app (fn (s,ref e) => f(s,e)) t
        !            20: 
        !            21: end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.