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

SCM Repository

[smlnj] View of /sml/trunk/benchmarks/todo/bh/bhutil.sml
ViewVC logotype

View of /sml/trunk/benchmarks/todo/bh/bhutil.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 193 - (download) (annotate)
Fri Nov 20 17:43:59 1998 UTC (22 years, 5 months ago) by monnier
File size: 476 byte(s)
Initial revision
structure bhUtil = 
    struct
	open Array

	fun intsto 0 = []
	  | intsto n = n :: intsto (n-1)
	    
	fun pr s = print (s^"\n")
	    
	fun maparray f a = 
	    let fun aux 0 = update(a,0,f (sub(a,0)))
		  | aux k = (update(a,k,f (sub(a,k)));
			     aux (k-1))
	    in
		aux ((length a)-1)
	    end
	
	fun foldarray f a acc = 
	    let val l = length a
		fun aux 0 acc = f (sub(a,0),acc)
		  | aux k acc = f (sub(a,k),aux (k-1) acc)
	    in
		aux (l-1) acc
	    end
    end

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