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

Pascal Triangle in OCaml: Get next line as a list

$
0
0

I am trying to get an OCaml function which gives the next line of a Pascal's triangle as a list for example:

(next_line: int -> list -> int list)

let get_next_line [1;1] returns [1;2;1] and so on.

I tried something like this but don't know how to go forward:

let rec next_line lst acc = match lst with| [] -> [1]| hd::tl -> (* need directions here *)

enter image description here


Viewing all articles
Browse latest Browse all 531

Trending Articles



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