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
;; Examples from: http://www.databasteknik.se/webbkursen/relalg-lecture/index.html | |
(def employees (table connection-info :employees)) | |
(def departments (table connection-info :departments)) | |
;;== Projection == | |
;; SELECT salary FROM employees | |
@(project employees #{:salary}) |
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
(-> (join [:employees :e] [:employees :b] {:e.mgr :b.nr}) | |
(select (= :b.name "John")) | |
(project :b.name)) |
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
Server Software: aleph | |
Server Hostname: localhost | |
Server Port: 9292 | |
Document Path: / | |
Document Length: 6 bytes | |
Concurrency Level: 50 | |
Time taken for tests: 9.565 seconds | |
Complete requests: 10000 |
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
;;; See the inspirational SO question: http://stackoverflow.com/questions/3346382 | |
(require 'clojure.contrib.trace) | |
(defn trace-ns | |
"Replaces each function from the given namespace with a version wrapped | |
in a tracing call. Can be undone with untrace-ns. ns should be a namespace | |
object or a symbol." | |
[ns] | |
(doseq [s (keys (ns-interns ns)) |
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
;new num branch results | |
(defn fib [n] | |
(if (>= 1 n) | |
1 | |
(+ (fib (dec n)) (fib (- n 2))))) | |
(time (fib 38)) | |
"Elapsed time: 3716.828 msecs" |
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 joy.proxytest) | |
;;== evilbase | |
(gen-class | |
:name joy.proxytest.evilbase | |
:prefix "evilbase-" | |
:post-init ctor | |
:methods [[tragedy [] void]] | |
:impl-ns joy.proxytest) |
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
;sample use idea: | |
(defn mapx | |
"Returns a lazy sequence consisting of the result of applying f to the | |
set of first items of each coll, followed by applying f to the set | |
of second items in each coll, until any one of the colls is | |
exhausted. Any remaining items in other colls are ignored. Function | |
f should accept number-of-colls arguments." | |
[f coll] | |
(gen-iter iter [f seq-cell] |
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 com.wangdera.slideshow | |
(:import (java.io File) | |
(javax.imageio ImageIO) | |
(javax.swing JFrame JPanel Timer) | |
(java.awt Dimension Frame Color))) | |
(def imagelist (atom [])) | |
(def running (atom true)) | |
(defmacro props [obj & properties] |
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
; Copyright (c) Rich Hickey. All rights reserved. | |
; The use and distribution terms for this software are covered by the | |
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) | |
; which can be found in the file epl-v10.html at the root of this distribution. | |
; By using this software in any fashion, you are agreeing to be bound by | |
; the terms of this license. | |
; You must not remove this notice, or any other, from this software. | |
(set! *warn-on-reflection* true) |
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
#!/usr/bin/perl4 | |
# Horrible, horrible, horrible edit of someone's | |
# even more horrible "reddit clone in 4 lines of perl". | |
use CGI ':standard'; | |
$dir = File::Basename::dirname( $0 ); | |
chdir $dir; |
NewerOlder