doc-src/Tutorial/Datatype/assoc
author paulson
Tue, 22 Aug 2000 10:59:15 +0200
changeset 9675 0fe0dce56bd8
parent 5851 15ce4c1c8313
permissions -rw-r--r--
updated to latest versions of ttbox and ttbreak
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5851
15ce4c1c8313 New section on advanced datatypes.
nipkow
parents:
diff changeset
     1
consts   assoc :: "('key * 'val)list => 'key => 'val option"
15ce4c1c8313 New section on advanced datatypes.
nipkow
parents:
diff changeset
     2
primrec "assoc [] x = None"
15ce4c1c8313 New section on advanced datatypes.
nipkow
parents:
diff changeset
     3
        "assoc (p#ps) x =
15ce4c1c8313 New section on advanced datatypes.
nipkow
parents:
diff changeset
     4
           (let (a,b) = p in if a=x then Some b else assoc ps x)"