home *** CD-ROM | disk | FTP | other *** search
/ Treasure Hunt 2001 PRESSKIT / TH2001_PRESSKIT.iso / demo / scol_install / Partition / comm / stdlib.pkg < prev    next >
Encoding:
Text File  |  2000-09-18  |  1.2 KB  |  59 lines

  1. fun searchlist (l,f,x)= 
  2.   if l==nil then nil 
  3.   else if exec f with [(hd l) x] then hd l 
  4.   else searchlist tl l f x;; 
  5.  
  6. fun deletelist (l,x)= 
  7.   if l==nil then nil 
  8.   else let l->[l2 next] in if l2==x then next 
  9.   else l2::deletelist next x;; 
  10.  
  11. fun apply_on_list(l,f,x)= 
  12.   if l==nil then 0 
  13.   else let l -> [a nxt] in 
  14.     (
  15.       exec f with [a x]; 
  16.       apply_on_list nxt f x
  17.     );; 
  18.  
  19. fun rev_apply_on_list(l,f,x)= 
  20.   if l==nil then 0 
  21.   else let l -> [a nxt] in 
  22.     (rev_apply_on_list nxt f x; exec f with [a x];0);; 
  23.  
  24. fun search_in_list(l,f,x)= 
  25.   if l==nil then nil 
  26.   else let l -> [a nxt] in if exec f with [a x] then a 
  27.   else search_in_list nxt f x;; 
  28.  
  29. fun remove_from_list(l,p)= 
  30.   if l==nil then nil 
  31.   else let l -> [a nxt] in if a==p then nxt 
  32.   else a::remove_from_list nxt p;; 
  33.  
  34. fun create_tab(n,f,x)= 
  35.   let mktab n nil -> t in 
  36.   (
  37.     let 0->i in 
  38.     while i<n do 
  39.     (
  40.       set t.i=exec f with [i x]; 
  41.       set i=i+1
  42.     ); 
  43.     t
  44.   );; 
  45.  
  46. fun LimitText (obj,n,nn)= 
  47. {
  48.   let _GETlineCount obj -> count in 
  49.   { 
  50.     while count-n>0 do 
  51.     { 
  52.       _DELline obj 0; 
  53.       set count=count-1; 
  54.     }; 
  55.     _SCROLLtext obj 0 count-nn-1; 
  56.     0 
  57.   } 
  58. };;
  59.