Skip to content

Commit 07c3f9c

Browse files
committed
Fix for fn? + contains for string
Signed-off-by: James Hamlin <jfhamlin@gmail.com>
1 parent dd665cf commit 07c3f9c

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

pkg/runtime/rtcompat.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ func (rt *RTMethods) Contains(coll, key any) bool {
127127
case IPersistentSet:
128128
return coll.Contains(key)
129129
// TODO: other types
130+
case string:
131+
n := lang.MustAsInt(key)
132+
return n >= 0 && n < lang.Count(coll)
130133
}
131134
panic(fmt.Errorf("contains? not supported on type: %T", coll))
132135
}

pkg/stdlib/clojure/core.glj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6209,7 +6209,7 @@ fails, attempts to require sym's namespace and retries."
62096209
"Returns true if x implements Fn, i.e. is an object created via fn."
62106210
{:added "1.0"
62116211
:static true}
6212-
[x] (or (instance? github.com:glojurelang:glojure:pkg:runtime.*Fn x) (instance? github.com:glojurelang:glojure:pkg:lang.IFn x)))
6212+
[x] (or (instance? github.com:glojurelang:glojure:pkg:runtime.*Fn x) (instance? github.com:glojurelang:glojure:pkg:lang.FnFunc x)))
62136213

62146214

62156215
(defn associative?

pkg/stdlib/clojure/core/loader.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/rewrite-core/rewrite.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@
352352
;; Replace instance? checks for clojure.lang.Fn with OR expression checking both runtime.*Fn and IFn
353353
(sexpr-replace '(instance? clojure.lang.Fn x)
354354
'(or (instance? github.com:glojurelang:glojure:pkg:runtime.*Fn x)
355-
(instance? github.com:glojurelang:glojure:pkg:lang.IFn x)))
355+
(instance? github.com:glojurelang:glojure:pkg:lang.FnFunc x)))
356356

357357
;; ===== Exception Handling =====
358358
(sexpr-replace 'Exception. 'github.com:glojurelang:glojure:pkg:lang.NewError)

0 commit comments

Comments
 (0)