Voicu Seiche
Voicu Seiche

Reputation: 70

Convert code from Lisp to F#

I have the following code in Lisp:

(defun Is_List_Even (lista)
  (cond 
    ((null lista) t)
    ((null (cadr lista)) nil)
    (t (Is_List_Even (cddr lista)))))

Can someone help me to write in F#? I'm new to F# and I'm in a hurry.

Regards, Voicu.

Upvotes: 0

Views: 312

Answers (1)

ygrek
ygrek

Reputation: 6697

let rec even = function
| [] -> true
| [_] -> false
| _::_::l -> even l

Upvotes: 5

Related Questions