doc-src/Tutorial/Datatype/lookup
author wenzelm
Fri, 21 Dec 2001 23:16:17 +0100
changeset 12587 3f3d2ffb5df5
parent 5851 15ce4c1c8313
permissions -rw-r--r--
HOL/record: shared operations ("more", "fields", etc.) now need to be always qualified;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5851
15ce4c1c8313 New section on advanced datatypes.
nipkow
parents:
diff changeset
     1
consts   lookup :: ('a,'v)trie => 'a list => 'v option
15ce4c1c8313 New section on advanced datatypes.
nipkow
parents:
diff changeset
     2
primrec "lookup t [] = value t"
15ce4c1c8313 New section on advanced datatypes.
nipkow
parents:
diff changeset
     3
        "lookup t (a#as) = (case assoc (alist t) a of
15ce4c1c8313 New section on advanced datatypes.
nipkow
parents:
diff changeset
     4
                              None => None
15ce4c1c8313 New section on advanced datatypes.
nipkow
parents:
diff changeset
     5
                            | Some at => lookup at as)"