FAQ Database Discussion Community


OCaml cons purpose

ocaml,cons
I'm reading through the language manual for OCaml and came across the "cons" operator, denoted as :: However, it's not explained at all what it is, and what its typically used for. ...

Difference between CDR, CAR and REST, FIRST and possible implementation?

list,lisp,common-lisp,cons,cdr
I'm learning a little bit about functional programming in LISP and here's what I've bumped into: LISP uses CAR, CDR functions as well as FIRST and REST functions. Both related to lists. From what I've learned so far, there's a difference between these two, but I don't quite see what...

What is wrong with this OCAML function?

ocaml,reverse,cons
Here is my original code. let rec reverse l = match l with | [] -> [] | (h::t) -> (reverse t) :: h ...