Quantcast
Channel: Active questions tagged ocaml - Stack Overflow
Viewing all articles
Browse latest Browse all 527

Append a list on to another in oCaml

$
0
0

I need a tail recursive function that appends a list1 infront of list2.

I tried it this way

let rec append lst1 lst2 acc =   match lst1 with   | [] -> acc @ lst2  | hd::tl -> append lst1 tl (hd::acc);;append [1;3;4] [3;4;2] [];;

But the result is "time out" every time


Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>