This file contains hidden or 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
=> ((proxy [clojure.lang.RestFn] [] | |
(getRequiredArity [] 2) | |
(doInvoke [a b rest] | |
(println a b rest)))) | |
#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: RestFn$0> | |
=> ((proxy [clojure.lang.RestFn] [] | |
(getRequiredArity [] 2) | |
(doInvoke [a b rest] | |
(println a b rest))) 4 5) | |
4 5 nil |
This file contains hidden or 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
; A solution to https://4clojure.com/problem/102 that doesn't involve cl-format | |
#(clojure.string/replace % #"-." (fn [m] (-> m last Character/toUpperCase str))) |
This file contains hidden or 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
+------------------+ | |
| | | |
| | | |
+--------------------------+ Client | | |
| Data in (PUT) | | | |
| | | | |
| | | | |
| +------------------+ | |
| + ^ |
This file contains hidden or 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
=> (defmacro apply. | |
[method-name & object+args] | |
`(~method-name ~@(flatten object+args))) | |
#'user/apply. | |
=> (apply. .substring "foobar" [0 4]) | |
"foob" | |
; above works only at compile time, so won't work with seqs of undetermined length at runtime. A sane place to use eval: |
This file contains hidden or 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
;; no exception when declare/defn are top-level (unsurprisingly) | |
=> (list | |
(declare ^:dynamic p) | |
(defn q [] @p)) | |
(#'user/p #'user/q) | |
=> (binding [p (atom 10)] | |
(q)) | |
#<ClassCastException java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.IDeref> |
This file contains hidden or 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
=> (def ^:const a 5) | |
#'user/a | |
=> (defn b [] a) | |
#'user/b | |
=> (def a 10) | |
#'user/a | |
=> (b) | |
5 |
This file contains hidden or 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
;; requires [com.cemerick/pomegranate "0.0.2"] | |
;; i.e. https://github.com/cemerick/pomegranate | |
(use '[cemerick.pomegranate.aether :only (dependency-hierarchy resolve-dependencies)]) | |
=> (pprint | |
(dependency-hierarchy | |
'[[incanter "1.2.3"]] | |
(resolve-dependencies {:coordinates '[[incanter "1.2.3"]] | |
:repositories (merge cemerick.pomegranate.aether/maven-central {"clojars" "http://clojars.org/repo"})}))) |
This file contains hidden or 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
;; Clutch provides a pretty comprehensive API, but I'm frustated that 95% of database | |
;; interactions require using something other than the typical Clojure vocabulary of | |
;; assoc/conj/dissoc/get/seq/reduce/etc, even though those semantics are entirely appropriate | |
;; (modulo the whole stateful database thing). | |
;; | |
;; This is (the start of) an attempt to create a type to provide most of the | |
;; functionality of Clutch with a more pleasant, concise API (it uses the Clutch API | |
;; under the covers, and rare operations would generally remain accessible only | |
;; at that lower level). | |
;; |
This file contains hidden or 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
;; Example from _Clojure Programming_; exposition on it, Leiningen, hooks, | |
;; and compilation order found therein. http://www.clojurebook.com | |
(defproject com.clojurebook/lein-mixed-source "1.0.0" | |
:dependencies [[org.clojure/clojure "1.3.0"]] | |
:aot :all) | |
(require '(leiningen compile javac)) | |
(add-hook #'leiningen.compile/compile |
This file contains hidden or 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
Process: GitX [5035] | |
Path: /Applications/GitX.app/Contents/MacOS/GitX | |
Identifier: nl.frim.GitX | |
Version: 0.8.4 (0.8.4) | |
Code Type: X86-64 (Native) | |
Parent Process: launchd [328] | |
Date/Time: 2012-02-21 06:05:39.422 -0500 | |
OS Version: Mac OS X 10.7.3 (11D50b) | |
Report Version: 9 |