File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626 uses : DeLaGuardo/setup-clojure@13.0
2727 with :
2828 lein : 2.9.1
29+ bb : latest
2930
3031 - uses : actions/setup-node@v4
3132 with :
3637
3738 - name : Run node tests
3839 run : lein doo node once
40+
41+ - name : Run babashka tests
42+ run : |
43+ # This installs a bb dev build. Once bb is released, we can remove this and run bb test:bb instead
44+ bash <(curl https://raw.githubusercontent.com/babashka/babashka/master/install) --dev-build --dir .
45+ ./bb test:bb
Original file line number Diff line number Diff line change 1+ {:tasks
2+ {test:bb {:extra-paths [" src" " test" ]
3+ :extra-deps {io.github.cognitect-labs/test-runner
4+ {:git/tag " v0.5.0" :git/sha " b3fd0d2" }
5+ org.clojure/test.check {:mvn/version " 1.1.1" }}
6+ :task cognitect.test-runner/-main}}}
Original file line number Diff line number Diff line change 3535 ; ; Java's native hash is too slow,
3636 ; ; overriding hashCode significantly speeds things up
3737 Object
38- ( hashCode [_] (coord-hash a b))
38+ # ? @( :clj [( hashCode [_] (coord-hash a b))] )
3939 (equals [_ that]
4040 (and (= (i/get-order a) (i/get-order (.-a ^Coord that)))
4141 (= (i/get-order b) (i/get-order (.-b ^Coord that)))))
4242 (toString [_]
4343 (str " [" (i/get-value a) " ," (i/get-value b) " ]" ))
4444
45- Comparable
46- (compareTo [this that]
47- (- (.hashCode this) (.hashCode that))))
45+ #? @(:bb []
46+ :clj [Comparable
47+ (compareTo [this that]
48+ (- (.hashCode this) (.hashCode that)))]))
4849 :cljr
4950 (deftype Coord [^Node a
5051 ^Node b]
Original file line number Diff line number Diff line change 99; ;
1010
1111(ns ^:no-doc editscript.util.pairing
12- #? (:clj
12+ #? (:bb (:require [clojure.data.priority-map])
13+ :clj
1314 (:import [clojure.lang IPersistentStack IPersistentMap IPersistentCollection]
1415 [java.io Writer])
1516 :cljr
6869 (set-right b nil )
6970 (merge-nodes (merge-nodes a b) (two-pass n)))))
7071
71- #?(:clj
72+ #?(:bb nil
73+ :clj
7274 (deftype PriorityMap [^:unsynchronized-mutable ^HeapNode heap
7375 ^:unsynchronized-mutable map]
7476 IPersistentCollection
175177 (set! heap n)
176178 this))))
177179
178- (defn priority-map
179- " A priority queue that also functions as a map.
180+ #?(:bb (def priority-map clojure.data.priority-map /priority-map )
181+ :default
182+ (defn priority-map
183+ " A priority queue that also functions as a map.
180184 Backed by a pairing heap implementation, and a regular map.
181185 NB. We do not implement `decrease-key` for the pairing heap,
182186 instead just insert the item again with a new priority."
183- ([]
184- (->PriorityMap nil {}))
185- ([& keyvals]
186- {:pre [(even? (count keyvals))]}
187- (reduce conj (priority-map ) (partition 2 keyvals))))
187+ ([]
188+ (->PriorityMap nil {}))
189+ ([& keyvals]
190+ {:pre [(even? (count keyvals))]}
191+ (reduce conj (priority-map ) (partition 2 keyvals) ))))
You can’t perform that action at this time.
0 commit comments