File:  [Research Unix] / researchv10no / cmd / sml / src / util / list2.sml
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:35 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

(* Copyright 1989 by AT&T Bell Laboratories *)
(* list2.sml *)
(* functionals over pairs of lists *)

structure List2 = struct

fun app2 f ([],_) = ()
  | app2 f (_,[]) = ()
  | app2 f (a::l,b::m) = (f(a,b); app2 f (l,m))

fun map2 f ([],_) = []
  | map2 f (_,[]) = []
  | map2 f (a::l,b::m) = f(a,b)::(map2 f (l,m))

fun all2 pred ([],[]) = true
  | all2 pred (a::l,b::m) = pred(a,b) andalso all2 pred (m,l)
  | all2 pred _ = false;

end

unix.superglobalmegacorp.com

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