vmode   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/core/math.xtm

Implementation

;; naive mode needs to be replaced!
(bind-func vmode
  (lambda (buf:float* len:i64)
    (let ((h (vsort buf len))
          (p NaNf) (l 0) (largest 0) (j:float 0.0) (i 0))
      (dotimes (i len)
        (if (= p (pref buf i))
            (set! l (+ l 1)) ;; increment l
            (set! l 0))
        (set! p (pref buf i))
        (if (> l largest)
            (begin
              (set! largest l)
              (set! j p))))
      j)))


Back to Index

Similar Entries