mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
More useable signature for 'Array.element-count'.
This commit is contained in:
parent
b23d60616b
commit
0301837072
@ -85,7 +85,7 @@
|
||||
(defn element-count [a e]
|
||||
(let-do [c 0]
|
||||
(for [i 0 (count a)]
|
||||
(when (= e @(nth a i)) (set! c (Int.inc c))))
|
||||
(when (= e (nth a i)) (set! c (Int.inc c))))
|
||||
c))
|
||||
|
||||
(defn aupdate [a i f]
|
||||
|
@ -23,3 +23,7 @@
|
||||
(defn /= [a b]
|
||||
(not (= (the Char a) b)))
|
||||
)
|
||||
|
||||
(defmodule CharRef
|
||||
(defn = [a b]
|
||||
(Char.= @a @b)))
|
||||
|
@ -83,7 +83,7 @@
|
||||
(let [x @(Array.nth data (/ n 2)) ; else
|
||||
l (- x (/ (from-int interval) 2.0))
|
||||
cf (Array.index-of data x)
|
||||
f (Array.element-count data x)]
|
||||
f (Array.element-count data &x)]
|
||||
(+ l (/ (* (from-int interval) (- (/ (from-int n) 2.0) (from-int cf)))
|
||||
(from-int f)))))))
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
(for [i 0 len]
|
||||
(let [c (Array.nth &cs i)]
|
||||
(do
|
||||
(if (Int.< 0 (Array.element-count &(the (Array Char) @&separators) @c))
|
||||
(if (Int.< 0 (Array.element-count &(the (Array Char) @&separators) c))
|
||||
(if (= 0 (String.count &word))
|
||||
() ;; no word
|
||||
(do (set! result (Array.push-back @&result @&word))
|
||||
|
Loading…
Reference in New Issue
Block a user