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
signature Ordered = | |
sig | |
type T | |
val eq : T * T -> bool | |
val lt : T * T -> bool | |
val leq : T * T -> bool | |
end | |
(* HEAP *) |
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
(declare insert) | |
(declare find-min) | |
(declare delete-min) | |
(declare empty-heap) | |
(declare is-empty?) | |
(declare heap-seq) | |
(deftype LeftistHeap [^Integer rank ^Integer elem left right] | |
clojure.lang.IPersistentStack | |
(peek [this] |
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 sandbox.words | |
(:require [clojure.string :refer [blank? trim join]])) | |
(def split-at-chars #{\newline \space \tab}) | |
(defn cut-single-line [text column-length] | |
(if (> (count text) column-length) | |
(let [line (drop-while (complement split-at-chars) (reverse text)) | |
length (count line)] | |
(cond |
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
-module(dojo2). | |
-import(lists,[nth/2]). | |
-include_lib ("eunit/include/eunit.hrl"). | |
-compile(export_all). | |
lookup(K,[{K,V}|_Tl]) -> | |
V; | |
lookup(K,[{_D,_V}|Tl]) -> | |
lookup(K, Tl); | |
lookup(_K,[]) -> |
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
-module(dojo4). | |
-import(lists,[nth/2]). | |
-include_lib ("eunit/include/eunit.hrl"). | |
-compile(export_all). | |
rand_list(Size) -> | |
lists:map(fun(X)-> random:uniform(100) end, lists:seq(1,Size)). | |
grid(Size) -> | |
lists:map(fun(X)-> rand_list(Size) end, lists:seq(1,Size)). |
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 dojo.core) | |
(def prices {:A 2.5 | |
:B 3.0}) | |
(def zones-map {"Asterix" :A | |
"Aldgate" :A | |
"Barbican" :B | |
"Balham" :B}) |
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 sudoku.core | |
(:use clojure.set) | |
(:use [clojure.contrib.seq :only [find-first]])) | |
(defn select-row [vek i] | |
(let [start (- i (rem i 9)) | |
end (+ start 9)] | |
(set (for [e (range start end)](vek e))))) | |
(defn select-column [vek i] |
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
package dream; | |
import sleep.Sleeper; | |
public class Dream { | |
int num = 0; | |
public void dream(final Sleeper s) { | |
if (num++ < 10) { | |
Thread thread = new Thread(new Runnable() { | |
public void run() { |
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 code-dojo.core | |
(:use [code-dojo.core] [clojure.math.combinatorics] [clojure.java.io :only (reader)]) | |
(:use [speclj.core])) | |
(def dictionary | |
(map #(.toLowerCase %) | |
(line-seq (reader "english_words.txt")))) | |
(defn same-length [len coll] | |
(filter #(= len (count %)) coll)) |
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 l0ad-theme (name) | |
(interactive | |
(list | |
(intern (completing-read "Load custom theme: " | |
(mapcar 'symbol-name (custom-available-themes)))))) | |
((load-theme name t))) |
OlderNewer