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 jsArr | |
"Recursively converts a sequential object into a JavaScript array" | |
[seq] | |
(.array (vec (map #(if (sequential? %) (jsArr %) %) | |
seq)))) | |
(defn jsObj | |
"Convert a clojure map into a JavaScript object" | |
[obj] | |
(.strobj (into {} (map (fn [[k v]] |
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
require "thread" | |
class Delay | |
def initialize(&thunk) | |
@semaphore = Mutex.new | |
@thunk = thunk | |
@evaluated = false | |
end | |
def value |
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
# Update: This micro-blog is now also a guide on clojurescript.org: | |
# http://clojurescript.org/guides/native-executables | |
# Hello! This is a micro-post about how to produce native executables | |
# from ClojureScript source. The basic idea is to produce a | |
# JavaScript file using the ClojureScript compiler, and then use a | |
# Node.js tool called nexe (https://github.com/jaredallard/nexe) to | |
# compile that into an executable. The resulting file can be run | |
# without requiring a node install on the target machine, which can | |
# be handy. |