-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathths.cl
More file actions
20 lines (17 loc) · 768 Bytes
/
ths.cl
File metadata and controls
20 lines (17 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(defvar *dbg* nil)
;-streaming: ;can open file, but also useful for (hadoop)streaming
(defun handle-stream (&optional (in *standard-input*))
(let ((tot 0))
(loop for line = (read-line in nil nil) while line do
(let ((n (num-str line)))
(when (numberp n) (incf tot n))
(when *dbg* (format t "~%~a" n))))
(format t "~%tot=~a~%" tot)))
(handle-stream)
;could have used cl-json to parse out, but cut works during a streaming job as well
;mongo> cat zips.json | cut -d',' -f5 | cut -d':' -f2 | sbcl --core km.core --script ts.cl
;tot=248709873
;upcoming:
;http://www.sbcl.org/manual/#sb_002dconcurrency
;;use sb-concurrency:mailbox maybe something pregel like
;&try http://storm-project.net/ about/multi-language.html