Skip to content

Instantly share code, notes, and snippets.

@kazh98
Created September 25, 2013 00:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazh98/6693578 to your computer and use it in GitHub Desktop.
Save kazh98/6693578 to your computer and use it in GitHub Desktop.
#lang racket
(require srfi/26)
(define *test-data* (port->string (current-input-port)))
(define lis (string-split *test-data*))
(define lis-l (map string-downcase lis))
(let ((table (make-hash)))
(for-each
(lambda (elt)
(hash-set! table elt (+ (hash-ref table elt 0) 1)))
lis-l)
(hash-for-each table
(cut printf "~S, ~S~%" <> <>)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment