The purpose of this program is to solve the following problem posed by Jon Bentley:
Given a text file and an integer k, print the k most common words in the file (and the number of their occurrences) in decreasing frequency.
(ns xn.test | |
(:require-macros [cljs.core.async.macros :refer [go alts!]] | |
(:require [xn.core :as xn] | |
[xn.util :as u] | |
[cljs.core.async :refer [<! take!]] | |
[xn.xhr :refer [request-body request-records chain-req]])) | |
(def sample-app | |
(reify | |
xn/Application |
#lang typed/racket | |
;;; Typed Racket version of Martin Grabmü̈ller's "Algorithm W Step by Step" | |
;;; http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.65.7733 | |
;;; This is my first use of Typed Racket. I am looking to change this from | |
;;; following Haskell idiom to following Racket idiom. | |
;; An expression is a variable, a literal, an application, |
;; This is at: https://gist.github.com/8655399 | |
;; So we want a rhyming dictionary in Clojure. Jack Rusher put up | |
;; this code here: | |
;; | |
;; https://gist.github.com/jackrusher/8640437 | |
;; | |
;; I'm going to study this code and learn as I go. | |
;; | |
;; First I put it in a namespace. |
(scss->clj "/Users/noprompt/git/yui/pure/src/grids/css/grids-core.css" | |
'pure.grids) | |
;; => | |
((ns | |
pure.grids | |
(:require [garden.stylesheet] [garden.units] [garden.def])) | |
(garden.def/defstyles | |
grids | |
[".pure-g" | |
{:letter-spacing "-0.31em"} |
// JVM sizing options | |
-server -Xms40g -Xmx40g -XX:MaxDirectMemorySize=4096m -XX:PermSize=256m -XX:MaxPermSize=256m | |
// Young generation options | |
-XX:NewSize=6g -XX:MaxNewSize=6g -XX:+UseParNewGC -XX:MaxTenuringThreshold=2 -XX:SurvivorRatio=8 -XX:+UnlockDiagnosticVMOptions -XX:ParGCCardsPerStrideChunk=32768 | |
// Old generation options | |
-XX:+UseConcMarkSweepGC -XX:CMSParallelRemarkEnabled -XX:+ParallelRefProcEnabled -XX:+CMSClassUnloadingEnabled -XX:CMSInitiatingOccupancyFraction=80 -XX:+UseCMSInitiatingOccupancyOnly | |
// Other options | |
-XX:+AlwaysPreTouch -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -XX:-OmitStackTraceInFastThrow |
(require '[schema.core :as s]) | |
(require '[schema.coerce :as coerce]) | |
(require '[schema.utils :as utils]) | |
(defn filter-schema-keys | |
[m schema-keys extra-keys-walker] | |
(reduce-kv (fn [m k v] | |
(if (or (contains? schema-keys k) | |
(and extra-keys-walker | |
(not (utils/error? (extra-keys-walker k))))) |
<!doctype html> | |
<style>body { padding: 0; }</style> | |
<script src='https://cdn.jsdelivr.net/p5.js/0.3.2/p5.min.js'></script> | |
<script src='out/goog/base.js'></script> | |
<script src='myproject.js'></script> | |
<script>goog.require('myproject.core')</script> |
(comment ; Fun with transducers, v2 | |
;; Still haven't found a brief + approachable overview of Clojure 1.7's new | |
;; transducers in the particular way I would have preferred myself - so here goes: | |
;;;; Definitions | |
;; Looking at the `reduce` docstring, we can define a 'reducing-fn' as: | |
(fn reducing-fn ([]) ([accumulation next-input])) -> new-accumulation | |
;; (The `[]` arity is actually optional; it's only used when calling | |
;; `reduce` w/o an init-accumulator). |
(ns my-transducers.core | |
(:require [clojure.core.async :as async])) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Understanding Transducers | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; | |
;; This is the source code for the blog post Understanding Transducers, found | |
;; here: http://elbenshira.com/blog/understanding-transducers | |
;; |
The purpose of this program is to solve the following problem posed by Jon Bentley:
Given a text file and an integer k, print the k most common words in the file (and the number of their occurrences) in decreasing frequency.