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

How to write sublist of a char list as [’1’; ’2’; ’3’; ’’; ’’; ’4’; ’5’; ’’; ’6’], to = [[’1’; ’2’; ’3’] ; [’4’; ’5’] ; [’6’]]

$
0
0

I am currently learning OCaml and i couldn't make sublist even thought I can make a list without spaces as ['1'; '2'; '3'; '4'; '5'; '6']. I couldn't find any sources to my question so thanks for explaining it too please.

type chiffre = int (*0-9*);;type chiffreCar = char (* '0' - '9'*)type  nombre = chiffre list;;type txtnb =  chiffreCar list ;;let rec les_nb (a:txtnb) : txtnb =   match a with  | [] -> []  | '' :: tl -> les_nb(tl)  | hd::tl ->hd :: les_nb(tl) ;;

Viewing all articles
Browse latest Browse all 527

Trending Articles



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