Comment detail

隣り合う二項の差 (Nested Flatten)

	
1
2
3
4
5
6
7
8
#light
let rec diff = function
    | [] -> failwith "invalid argument"
    | x::[] -> failwith "invalid argument"
    | x::x'::[] -> (x'-x)::[]
    | x::x'::xs -> (x'-x)::diff (x'::xs)

let xs = [3;1;4;1;5;9;2;6;5]
修正。
1
2
3
4
5
6
7
#light
let rec diff = function
    | [] -> []
    | x::[] -> []
    | x::x'::xs -> (x'-x)::diff (x'::xs)

let xs = [3;1;4;1;5;9;2;6;5]

Index

Feed

Other

Link

Pathtraq

loading...