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",
|
||||
"width": 300,
|
||||
"collapsed": true
|
||||
"width": 300
|
||||
},
|
||||
"right": {
|
||||
"id": "b83c16dd7908c658",
|
||||
|
@ -246,11 +246,10 @@ val shard = 'a list -> 'a list -> 'a list -> 'a list = <fun>
|
||||
|
||||
## Exercise 5.1
|
||||
```Ocaml
|
||||
let assos k l =
|
||||
if (k < 0) then
|
||||
invalid_arg "k not natural"
|
||||
else
|
||||
match l with
|
||||
| -> failwith "not found"
|
||||
| (k,y)::t -> y
|
||||
| _ -> assos k t
|
||||
let assos k = function
|
||||
[] -> failwith "not found"
|
||||
| (k2, v2)::t when k2 = k -> v2
|
||||
| (k2, v2):: t when k < k2 -> faiwith "not found"
|
||||
| e::t -> assoc k t
|
||||
val assos = 'a -> ('a + 'b) list -> 'b = <fun>
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user