f# - 将代码从 Lisp 转换为 F#

标签 f# lisp

我在 Lisp 中有以下代码:

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

有人可以帮我用 F# 写吗?我是 F# 的新手,我很赶时间。

问候, 声音。

最佳答案

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

关于f# - 将代码从 Lisp 转换为 F#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2287308/

相关文章:

generics - f# 可区分联合泛型

lisp - 普通LISP加法程序

lisp - 以编程方式在函数中嵌入多个列表元素

f# - 如何在 fsi 中运行 .fsx

replace - F#:替换为 .Replace ("oldValue","newValue")

F# 计算表达式 : Can one be used to simplify this code?

collections - 对 F# 中 List.mapi 的行为感到困惑

Lisp Coerce 和 Set 函数解释

function - 将函数作为参数传递 - lambda 表达式错误?

lisp - 为什么Common Lisp中不存在原始的 `call-with-current-continuations`