The generic allocation program takes the one slice
The slice lane merged after this program was written and as-slice went with it. Nine calls, one name.
This commit is contained in:
parent
bb274432a7
commit
69c1116efc
@ -21,7 +21,7 @@
|
||||
{:where (ordered? $t)}
|
||||
(let [v (vec-new $t)]
|
||||
(dotimes [i (len xs)] (push v (at xs i)))
|
||||
(sort (as-slice v))
|
||||
(sort (slice v))
|
||||
v))
|
||||
|
||||
;; The same, against a named allocator rather than the context's. Both arities
|
||||
@ -30,7 +30,7 @@
|
||||
{:where (ordered? $t)}
|
||||
(let [v (vec-new $t al)]
|
||||
(dotimes [i (len xs)] (push v (at xs i)))
|
||||
(sort (as-slice v))
|
||||
(sort (slice v))
|
||||
v))
|
||||
|
||||
;; A Map whose key is the variable. The predicate is what lets the hash and the
|
||||
@ -71,17 +71,17 @@
|
||||
fs [2.5 0.5 1.5]
|
||||
a (sorted (slice ns 0 4))
|
||||
b (sorted (slice fs 0 3))]
|
||||
(println (at (as-slice a) 0)) ; 1
|
||||
(println (at (as-slice a) 3)) ; 9
|
||||
(println (at (as-slice b) 0)) ; 0.5
|
||||
(println (len (as-slice b))) ; 3
|
||||
(println (at (slice a) 0)) ; 1
|
||||
(println (at (slice a) 3)) ; 9
|
||||
(println (at (slice b) 0)) ; 0.5
|
||||
(println (len (slice b))) ; 3
|
||||
(free a)
|
||||
(free b))
|
||||
|
||||
(let [ns [4 2 8]
|
||||
ar (arena-new 4096)
|
||||
c (sorted-in (slice ns 0 3) ar)]
|
||||
(println (at (as-slice c) 0)) ; 2
|
||||
(println (at (slice c) 0)) ; 2
|
||||
(free-all ar))
|
||||
|
||||
(let [ns [7 7 3]
|
||||
@ -105,8 +105,8 @@
|
||||
(invoke-restart 'retry))]
|
||||
(let [ns [9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4]
|
||||
d (sorted-in (slice ns 0 16) tight)]
|
||||
(println (len (as-slice d))) ; 16
|
||||
(println (at (as-slice d) 0)) ; 0
|
||||
(println (len (slice d))) ; 16
|
||||
(println (at (slice d) 0)) ; 0
|
||||
(free d)))
|
||||
(println (> failures 0)) ; true
|
||||
(set-alloc-budget tight 0))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user