[SOLVED] CS计算机代考程序代写 let rec map f xs = match xs with

30 $

File Name: CS计算机代考程序代写_let_rec_map_f_xs_=_match_xs_with.zip
File Size: 584.04 KB

SKU: 0490139036 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


let rec map f xs = match xs with
| [] -> []
| x :: xt -> (f x)::(map f xt)

let rec fold f a xs = match xs with
| [] -> a
| x :: xt -> fold f (f a x) xt

let rec fold_right f xs a = match xs with
| [] -> a
| x :: xt -> f x (fold_right f xt a)

let length xs = fold (fun a _ -> succ a) 0 xs

let rev xs = fold (fun a x -> x :: a) [] xs

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS计算机代考程序代写 let rec map f xs = match xs with
30 $