Moved to a proper Git repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns srepl.core | |
(:use [clojure.main :only [repl]] | |
[clojure.pprint :only [pprint with-pprint-dispatch code-dispatch]]) | |
(:import (jline.console ConsoleReader) | |
(jline.console.completer Completer)) | |
(:gen-class)) | |
(defmulti super-dispatch class) | |
(defmethod super-dispatch :default [thing] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns overtunes.songs.at-all | |
(:use | |
[overtone.live :only [at now]] | |
[overtone.inst.sampled-piano :only [sampled-piano]])) | |
(defn bpm [beats-per-minute] | |
(let [start (now) | |
ms-per-minute (* 60 1000) | |
ms-per-beat (/ ms-per-minute beats-per-minute)] | |
#(+ start (* ms-per-beat %)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Modified SpamLord.java to call clojure code | |
public List<Contact> processFile(String fileName, BufferedReader input) { | |
List<Contact> contacts = new ArrayList<Contact>(); | |
// for each line | |
Matcher m; | |
String email; | |
try { | |
List results = new spamlord().process(input); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; My first bit of Clojure. | |
;; https://code.google.com/codejam/contest/2270488/dashboard#s=p3 | |
(def test_chests '({:name 1 :opener 1 :contents ()} {:name 2 :opener 1 :contents (1 3)} {:name 3 :opener 2 :contents ()} {:name 4 :opener 3 :contents (2)})) | |
(defn remove-first [pred lst] | |
(if (pred (first lst)) (rest lst) (cons (first lst) (remove-first pred (rest lst))))) | |
;; Return sequence of chest names to open all the chests starting with the given list (multiset) of keys. | |
;; Return nil if there is no combination that opens all the chests. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun nrepl-eval-expression-at-point-in-repl () | |
(interactive) | |
(let ((form (nrepl-expression-at-point))) | |
;; Strip excess whitespace | |
(while (string-match "\\`\s+\\|\n+\\'" form) | |
(setq form (replace-match "" t t form))) | |
(set-buffer "*nrepl*") | |
(goto-char (point-max)) | |
(insert form) | |
(nrepl-return))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; | |
using System.Threading.Tasks; | |
namespace Tests | |
{ | |
public class CurrentThreadTaskScheduler : TaskScheduler | |
{ | |
protected override void QueueTask(Task task) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; from leiningen, use [dorothy/dorothy "0.0.3"] | |
(require '[dorothy.core :as dot]) | |
;; dataflow copied from chat | |
;; https://github.com/pedestal/samples/blob/master/chat/chat-client/app/src/chat_client/behavior.clj | |
(def dataflow '{:transform | |
{:outbound {:init {} :fn outbound-transform} | |
:inbound {:init {} :fn inbound-transform} | |
:nickname {:init nil :fn nickname-transform}} | |
:effect {:outbound send-message-to-server} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn clj->js | |
"Recursively transforms ClojureScript maps into Javascript objects, | |
other ClojureScript colls into JavaScript arrays, and ClojureScript | |
keywords into JavaScript strings." | |
[x] | |
(cond | |
(string? x) x | |
(keyword? x) (name x) | |
(map? x) (.strobj (reduce (fn [m [k v]] | |
(assoc m (clj->js k) (clj->js v))) {} x)) |
OlderNewer