We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9798e4b commit 4ff0858Copy full SHA for 4ff0858
typed-racket-test/succeed/sub1-int-gt-1.rkt
@@ -0,0 +1,13 @@
1
+#lang typed/racket
2
+
3
+;; From this stack overflow question by Lyu Yao Ting:
4
+;; Type mismatch issue of sub1
5
+;; https://stackoverflow.com/questions/58887937/type-mismatch-issue-of-sub1
6
7
+(define-predicate one? One)
8
+(: pick1 (-> Positive-Integer (Listof Any) Any))
9
+(define pick1
10
+ (λ (n lat)
11
+ (cond [(one? n) (car lat)]
12
+ [else (pick1 (sub1 n)
13
+ (cdr lat))])))
0 commit comments