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
a = "22981635076420793197140440112363866165375145564586248763610635385945236317287043748330467627305717813726673479967228777612424589645162359871449118678990935704112591252723259506903857180164066459487282479000924936106359390615851255792782486783825611539272620689971356880964798332754380590030005771560309857523027375721429953891023929412773760555899367294679320436122766251589468422685308936932490108777565566638092564304030758367043977881571032676830821465574149105922106946888975837458532791503723665502656062459429016196415243948409471237970932916479524375074817705815197829260250003099752408091767320864127218772831828682399073865634365526847136046528335512087563161794873994019518959778146554153057008556254461291089006873847990013879516711046214367997203624910548139468568451262332355247109828375685915330115937613723644470698146282936341274372822625012192958803636595625994654162379966473175618778595285739852711797764004657981630164464755041460221238191191589365695497017625302761466469146309379417234199638118286 |
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
(import (java.io File FileInputStream) | |
'javax.imageio.ImageIO) | |
(use '[clojure.contrib.string :only (split)]) | |
(def x-values [117 279 440 599 763 923 1083 1245]) | |
(def base-path "/Users/jhickner/Desktop/") | |
(defn file-basename [file] (first (split #"\." (.getName file)))) | |
(defn files-in-dir [dir] |
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 test) | |
(defn ^:export encoding-example [] | |
(str "Hello " (name :foo))) | |
; goog.provide('test'); | |
; goog.require('cljs.core'); | |
; test.encoding_example = (function encoding_example(){ | |
; return cljs.core.str.call(null,"Hello ",cljs.core.name.call(null,"'foo")); | |
; }); | |
; goog.exportSymbol('test.encoding_example', test.encoding_example); |
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 ->js [o] | |
(cond | |
(map? o) (let [out (js-obj)] | |
(doseq [[k v] o] | |
(aset out (if (keyword? k) (name k) k) | |
(->js v))) | |
out) | |
(or (sequential? o) (set? o)) (.array (vec (map ->js o))) | |
:else o)) |
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 ->js [o] | |
(cond | |
(keyword? o) (name o) | |
(map? o) (let [out (js-obj)] | |
(doseq [[k v] o] | |
(aset out (->js k) (->js v))) | |
out) | |
(coll? o) (apply array (map ->js o)) | |
:else o)) |
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. | |
(ns repl.test | |
(:require [clojure.browser.repl :as repl] |
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
/* | |
Silly example - close over s (say a string) returning an instance | |
of an anonymous type that acts like a ClojureScript collection | |
(defn make-conjable [s] | |
(reify | |
ICollection | |
(-conj [_ c] (str s c)))) | |
*/ |
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
(defmacro locals | |
"Returns a map of locals, as keywords, to their values." | |
[] | |
(let [locals (keys &env)] | |
`(zipmap ~@(map vec [(map keyword locals) locals])))) | |
(let [x 10] | |
(let [y 20 | |
z (+ x y)] | |
(locals))) |
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 fj | |
(:import [java.util.concurrent RecursiveTask | |
ForkJoinPool])) | |
(set! *warn-on-reflection* true) | |
;; ----------------------------------------------- | |
;; Helpers to provide an idiomatic interface to FJ | |
(defprotocol IFJTask |
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
(defrecord web-socket | |
Object | |
(send [msg] ...) | |
(close [_] ...)) |
OlderNewer