vault backup: 2023-10-13 15:51:29
This commit is contained in:
parent
f955d7c0fc
commit
83f1ecc9c0
@ -198,8 +198,14 @@ val insert_nth: 'a -> int -> 'a list -> 'a list = <fun>
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Exercise 3.4
|
## Exercise 3.4
|
||||||
```
|
```Ocaml
|
||||||
# let insert_post x y list = match list with
|
# let insert_post x y = function
|
||||||
| [] -> failwith "list is too large or empty"
|
| [] -> failwith "list is too large or empty"
|
||||||
| e::t -> if e = x then e::y::t else e::insert_post x y (t);;
|
| e::t -> if e = y then e::x::t else e::insert_post x y t;;
|
||||||
val insert_post : 'a -> a' list -> list = <fun>
|
val insert_post : 'a -> 'a -> a' list -> list = <fun>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Exercise 3.5
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user