vault backup: 2023-10-16 15:07:24
This commit is contained in:
parent
f625d132c9
commit
a0ba6c4c75
3
.obsidian/workspace.json
vendored
3
.obsidian/workspace.json
vendored
@ -81,8 +81,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"direction": "horizontal",
|
"direction": "horizontal",
|
||||||
"width": 300,
|
"width": 300
|
||||||
"collapsed": true
|
|
||||||
},
|
},
|
||||||
"right": {
|
"right": {
|
||||||
"id": "b83c16dd7908c658",
|
"id": "b83c16dd7908c658",
|
||||||
|
@ -246,11 +246,10 @@ val shard = 'a list -> 'a list -> 'a list -> 'a list = <fun>
|
|||||||
|
|
||||||
## Exercise 5.1
|
## Exercise 5.1
|
||||||
```Ocaml
|
```Ocaml
|
||||||
let assos k l =
|
let assos k = function
|
||||||
if (k < 0) then
|
[] -> failwith "not found"
|
||||||
invalid_arg "k not natural"
|
| (k2, v2)::t when k2 = k -> v2
|
||||||
else
|
| (k2, v2):: t when k < k2 -> faiwith "not found"
|
||||||
match l with
|
| e::t -> assoc k t
|
||||||
| -> failwith "not found"
|
val assos = 'a -> ('a + 'b) list -> 'b = <fun>
|
||||||
| (k,y)::t -> y
|
```
|
||||||
| _ -> assos k t
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user