-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of [email protected]:bradford/infer
- Loading branch information
Showing
6 changed files
with
96 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
(ns infer.streaming) | ||
|
||
;;WARNING: gnarlley unguarded mutation back here. This is not meant to be called by multiple concurrent callers, it is meant to be used only in isolation. It can be wrapped with a checkpointer, but not a memoizer. It is stricly for use with updating streams. | ||
(defn rolling [f p n] | ||
(let [q (RollingQueue. n)] | ||
(fn [x] | ||
(if (.isPrimed q) | ||
(f x (.enqueue q x)) | ||
(let [pr (p x (.enqueue q x))] | ||
(if (.isPrimed q) pr Double/NaN)))))) | ||
|
||
;; (defn sum [new old] | ||
|
||
;; sum = sum - compoundQueueOfDoublesfixedLengthQueue.Enqueue(d) + d; | ||
;; return sum; | ||
;; } | ||
|
||
;; protected override double prime(double d) | ||
;; { | ||
;; sum = initialSum.Calculate(d); | ||
;; compoundQueueOfDoublesfixedLengthQueue.Enqueue(d); | ||
;; return sum; | ||
;; } | ||
;; } | ||
|
||
|
||
;;http://en.wikipedia.org/wiki/Selection_algorithm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters