Advertisement
operaatoors

ML saraksts

Mar 10th, 2016
2,964
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. val preteji_1 = implode o rev o explode;
  2. val teksts = "roberts";
  3. val preteji = preteji_1 teksts;
  4.  
  5. - use "md_var_1.sml";
  6. [opening md_var_1.sml]
  7. val fun_preteji = fn : string -> string
  8. val teksts = "roberts" : string
  9. val preteji = "strebor" : string
  10. val it = () : unit
  11.  
  12. fun preteji_2(ievads,izvads) = if null(ievads) then izvads
  13. else preteji_2(tl(ievads), hd(ievads)::izvads);
  14.  
  15. - use "md_var_2.sml";
  16. [opening md_var_2.sml]
  17. val preteji = fn : 'a list * 'a list -> 'a list
  18. val it = () : unit
  19.  
  20. - preteji([1,2,3,4,5,10],[]);
  21. val it = [10,5,4,3,2,1] : int list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement