Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /smlnj-lib/trunk/Util/list-map-fn.sml
ViewVC logotype

Diff of /smlnj-lib/trunk/Util/list-map-fn.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 29, Thu Mar 12 01:05:59 1998 UTC revision 289, Sat May 22 21:01:25 1999 UTC
# Line 15  Line 15 
15    
16      val empty = []      val empty = []
17    
18        fun isEmpty [] = true
19          | isEmpty _ = false
20    
21      (* return the first item in the map (or NONE if it is empty) *)
22        fun first [] = NONE
23          | first ((_, value)::_) = SOME value
24    
25      (* return the first item in the map and its key (or NONE if it is empty) *)
26        fun firsti [] = NONE
27          | firsti ((key, value)::_) = SOME(key, value)
28    
29      fun insert (l, key, item) = let      fun insert (l, key, item) = let
30            fun f [] = [(key, item)]            fun f [] = [(key, item)]
31              | f ((elem as (key', _))::r) = (case Key.compare(key, key')              | f ((elem as (key', _))::r) = (case Key.compare(key, key')

Legend:
Removed from v.29  
changed lines
  Added in v.289

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0