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
(* Syntax of Extensible Data Notation -- http://github.com/edn-format/edn | |
See https://github.com/edn-format/edn/issues/56 | |
This grammar is written in slightly extended version of Wirth Syntax | |
Notation. A description is appended to the end of this document. *) | |
(* start *) |
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 clj-gunzip.core | |
(:require [clojure.java.io :as io]) | |
(:require [clojure.string :as str]) | |
(:import java.util.zip.GZIPInputStream | |
java.util.zip.GZIPOutputStream)) | |
(defn gunzip | |
"Writes the contents of input to output, decompressed. | |
input: something which can be opened by io/input-stream. |
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 innerclassbuilderexample; | |
/* | |
* An example of a pattern for constructing immutable | |
* objects using a fluent builder implemented as an | |
* inner class. | |
* | |
* Some boiler plate code can be saved if one is willing to give up | |
* fluency in the Builder's interface. | |
*/ |
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 jardifference | |
(:import (java.util.jar JarFile JarEntry JarOutputStream)) | |
(:require (clojure.java [io :as io]) | |
(clojure [set :as set]))) | |
(defn jar-entry-seq | |
[^JarFile jf] | |
(enumeration-seq (.entries jf))) |
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 interval [x y] [x y]) | |
(defn plus [[a b] [c d]] [(+ a c) (+ b d)]) | |
(defn minus [[a b] [c d]] [(- a d) (- b c)]) | |
(def minmax (juxt min max)) | |
(defn times [[a b] [c d]] (minmax (* a c) (* a d) (* b c) (* b d))) | |
(defn divide [[a b] [c d]] (minmax (/ a c) (/ a d) (/ b c) (/ b d))) | |
(def half #(/ % 2)) | |
(defn ends->center [[a b]] [(half (+ a b)) (half (- b a))]) | |
(defn center->ends [[a b]] [(- a b) (+ a 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 bpsmannschott | |
(:import java.io.File) | |
(:import java.io.FileNotFoundException)) | |
(defn as-file [s] | |
"Return whatever we have as a java.io.File object" | |
(cond (instance? File s) s ; already a file, return unchanged | |
(string? s) (File. s) ; return java.io.File for path s | |
:else (throw (FileNotFoundException. (str s))))) |
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 people) | |
(defrecord Person [name age]) | |
(def persons [(Person. "Boris" 40) | |
(Person. "Betty" 32) | |
(Person. "Bambi" 17)]) | |
(def minor? #(-> % :age (<= 18))) |
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 libpsm.string | |
(:require [clojure.string :as str])) | |
(let [triml-with-pipe (comp #(str/replace-first % "|" "") | |
str/triml)] | |
(defn mstr* | |
"Multiline string with explicit left margin." | |
[s] | |
(str/join "\n" (map triml-with-pipe | |
(str/split-lines s))))) |
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
ERROR in (complex-sqrt) (run-test32965.clj:44) | |
Uncaught exception, not in assertion. | |
expected: nil | |
actual: java.lang.IllegalArgumentException: No method in multimethod 'sqrt' for di | |
spatch value: :clojure.contrib.complex-numbers/complex | |
at clojure.lang.MultiFn.getFn (MultiFn.java:115) | |
clojure.lang.MultiFn.invoke (MultiFn.java:157) | |
clojure.contrib.test_complex_numbers/fn (test_complex_numbers.clj:291) | |
clojure.test$test_var__6804$fn__6805.invoke (test.clj:644) | |
clojure.test/test_var (test.clj:644) |
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 3ba1fbf6833c21724659646518a4b999d783840d Mon Sep 17 00:00:00 2001 | |
From: Andreas Schwab <[email protected]> | |
Date: Fri, 26 Dec 2008 16:49:30 +0000 | |
Subject: [PATCH] (keymap-canonicalize): Properly preserve keymap prompt. | |
--- | |
lisp/ChangeLog | 2 ++ | |
lisp/subr.el | 6 +++--- | |
2 files changed, 5 insertions(+), 3 deletions(-) |