let moja_matrika1 = [[1; 2]; [3; 4]];;
let moja_matrika2 = [[4; 7; 8]; [3; 2; 1]];;
let rec does_it_contain (lis1, lis2) =
if (List.hd lis1 = []) then false
else if (List.hd lis1 = lis2) then tru
所以,我想用Tsdl这里是我所做的: 我找不到SDL 2.0.5与apt-get所以我下载了它,./configure && make && sudo make install opam install tsdl 然后创建了一个文件main.ml(作为一个例子给出的上tsdl website): open Tsdl
open Result
let main() = match Sdl.ini
数组的前n个元素 我在ocaml的以下功能,总结第一c元素作为参数传递的数组: let rec sum_array c a =
if c < 0 then 0
else a.(c) + sum_array (c - 1) a;;
我碰巧知道什么阵a是先进的,所以我想设置这个。我试过了: fun c -> let int_array = [| 1 ; 2 ; 3 ; 4 ;
写一个在例子11.38的yearday类型上正确工作的相等运算符(调用它= /)。 (您可能需要查找支配闰年出现的规则。) 实例11.38:type yearday = YMD of int * int * int | YD of int * int;; 我有OCaml中工作这很难,很想看看如何可以做到这一点。
所以,当你定义模块的结构,它可以延长另一个模块关闭它: module Base = struct
type t = Name of string
end
module Child = struct
include Base
end
Child.Name "test"
(* - : Child.t = Child.Name "test" *)
然而,随着recu
我'其实还挺新OCAML和努力学习。 我在我的一个功能上遇到了一个大问题。 这是一个简单的函数(下面),里面我试图检查一个电子邮件地址的有效性,检查它是否有'@',然后''。并在每个之前和之后的文本。 (我不想使用正则表达式,我'真的很抱歉,如果你只知道怎么做,用正则表达式,但我不会考虑的正则表达式的答案^^“)。 下面是代码,预先感谢您: let checkMail mail =
if Str