Skip to content

Instantly share code, notes, and snippets.

@erasmas
Created January 16, 2015 10:41
Show Gist options
  • Save erasmas/83c39441351a7fe1db26 to your computer and use it in GitHub Desktop.
Save erasmas/83c39441351a7fe1db26 to your computer and use it in GitHub Desktop.
WordCount in Cascalog
(ns cascalog-class.core
(:require [cascalog.api :refer :all]
[cascalog.ops :as c]))
(defmapcatop split
[^String sentence]
(.split sentence "\\s+"))
(def -main
(?<- (stdout)
[?word ?count]
((hfs-textline "input-dir") ?textline)
(split ?textline :> ?word)
(c/count ?count)))
;; https://github.com/sritchie/cascalog-class/blob/master/src/cascalog_class/core.clj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment