My efforts to port http://www.youtube.com/watch?v=f6kdp27TYZs to Clojure.
func boring(msg string) {
for i := 0; ; i++ {
fmt.Println(msg, i)
time.Sleep(time.Second)
}
# Grammar for Python | |
# Note: Changing the grammar specified in this file will most likely | |
# require corresponding changes in the parser module | |
# (../Modules/parsermodule.c). If you can't make the changes to | |
# that module yourself, please co-ordinate the required changes | |
# with someone who can; ask around on python-dev for help. Fred | |
# Drake <fdrake@acm.org> will probably be listening there. | |
# NOTE WELL: You should also follow all the steps listed in PEP 306, |
private def getForecast:Try[JsValue] = { | |
val ts = date.getTime / 1000 | |
val u = { | |
if (date == new Date()) new URL(s"https://api.forecast.io/forecast/$apiKey/$lat,$lon?units=$units") | |
else new URL(s"https://api.forecast.io/forecast/$apiKey/$lat,$lon,$ts?units=$units") | |
} | |
val s = new Scanner(u.openStream(), "UTF-8") | |
Try{s.useDelimiter("\\A").next().asJson} | |
} |
(defstruct trie-node :word-fragment :type :children) | |
(defn type-switch [node type-val] | |
(assoc node :type type-val)) | |
(defn switch-to-word [node] | |
(type-switch node :word)) | |
(defn switch-to-nonword [node] | |
(type-switch node :nonword)) | |
; constructors |
git_tracked_files = `git ls-files -z`.split("\x0") | |
gem_ignored_files = `git ls-files -i -X .gemignore -z`.split("\x0") | |
spec.files = git_tracked_files - gem_ignored_files |
package main | |
import ( | |
"fmt" | |
"io" | |
"log" | |
"net/http" | |
"os" | |
) |
(ns foo.core | |
(:refer-clojure :exclude [slurp])) | |
(defmacro slurp [file] | |
(clojure.core/slurp file)) | |
;; In CLJS | |
(ns bar.core | |
(:require [foo.core :include-macros true :refer [slurp]])) |
""" | |
(C) Mathieu Blondel - 2010 | |
License: BSD 3 clause | |
Implementation of the collapsed Gibbs sampler for | |
Latent Dirichlet Allocation, as described in | |
Finding scientifc topics (Griffiths and Steyvers) | |
""" |
My efforts to port http://www.youtube.com/watch?v=f6kdp27TYZs to Clojure.
func boring(msg string) {
for i := 0; ; i++ {
fmt.Println(msg, i)
time.Sleep(time.Second)
}
/* The API controller | |
Exports 3 methods: | |
* post - Creates a new thread | |
* list - Returns a list of threads | |
* show - Displays a thread and its posts | |
*/ | |
var Thread = require('../models/thread.js'); | |
var Post = require('../models/post.js'); |
;; based on core.logic 0.8-alpha2 or core.logic master branch | |
(ns sudoku | |
(:refer-clojure :exclude [==]) | |
(:use clojure.core.logic)) | |
(defn get-square [rows x y] | |
(for [x (range x (+ x 3)) | |
y (range y (+ y 3))] | |
(get-in rows [x y]))) |