add small test to result.mlish
This commit is contained in:
parent
ea3ed2a762
commit
06bed29150
|
@ -26,11 +26,25 @@
|
|||
: (Option Int)
|
||||
-> (None {Int}))
|
||||
|
||||
;; args inferred in order, L-to-R, currently no backtracking
|
||||
(check-type
|
||||
(find (Nil {Int}) (λ ([x : Int]) (<= 2 x)))
|
||||
: (Option Int)
|
||||
-> (None {Int}))
|
||||
|
||||
;; reversing arg order leads to successful inference
|
||||
(define (find2 [pred : (→ X Bool)] [lst : (List X)] → (Option X))
|
||||
(match lst with
|
||||
[Nil -> None]
|
||||
[Cons fst rst ->
|
||||
(cond [(pred fst) (Some fst)]
|
||||
[else (find2 pred rst)])]))
|
||||
|
||||
(check-type
|
||||
(find2 (λ ([x : Int]) (<= 2 x)) Nil)
|
||||
: (Option Int)
|
||||
-> (None {Int}))
|
||||
|
||||
(define (find-min/max [lst : (List X)] [<? : (→ Y Y Bool)] [extract-key : (→ X Y)]
|
||||
→ (Option (× X X)))
|
||||
(match lst with
|
||||
|
|
Loading…
Reference in New Issue
Block a user