• Stars
    star
    279
  • Rank 147,967 (Top 3 %)
  • Language
    JavaScript
  • Created almost 13 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

himera

ClojureScript compiler as service with a simple in-browser REPL.

Try it on Heroku

Build

lein deps
lein cljsbuild once

Usage

To start Himera locally using Leiningen, type the following from the project directory.

lein run 8080

Then visit http://localhost:8080/ and never stop typing. For example, common ClojureScript functions and macros work as expected:

    (map (fn [n] (* n n n)) [1 2 3 4])
	;=> (1 8 27 64)
	
	(for [[k v] {:a 1 :b 2}] [v k])
	;=> ([1 :a] [2 :b])
	
	(if (< x 10) :less :more)
	;=> :less
	
	(defn sqr [n] (* n n))
	
	(map sqr [1 2 3])
	;=> (1 4 9)
	
	(deftype Cons [h t])
	
	(.-t (Cons. 1 108))
	;=> 108
	
	(defmulti classify-age :age)
	
	(defmethod classify-age 36 [_] :ancient)
	
	(classify-age {:age 36})
	;=> :ancient

To use jQuery from the Himera REPL, try the following:

    (def anchor (js/jQuery "a"))
	
	(.text anchor)
	;=> "Source..."
	
	(.text anchor "Github repo...")

To exercise the compilation service from the command line, try the following:

    $ curl -X POST -H "Content-Type: application/clojure" \
	    -d '{:expr ((fn foo [x] (js/alert x)) 42)}' \
		http://localhost:8080/compile
	
	#=> {:js "(function foo(x){\nreturn alert.call(null,x);\n}).call(null,42)"}

Current limitations

  • No way to override functions defined in cljs.core
  • defrecord access is not working
  • Creating namespaces does not work
  • Other problems not yet discovered
  • ClojureScript's / function is not munged properly

Plans

  • Fix the limitations above
  • Stateless service
  • More clients
  • Dynamic JS library loading
  • Other plans not yet devised

Thanks

Thanks to Tim McCormack, Paul Michael Bauer, and Anthony Grimes for the hard work in blazing the trail for online Clojure and ClojureScript REPLage and compilationation. Also thanks to Craig Andera and Chris Redinger for moral support and letting me bounce insane ideas off of them.

License

Copyright (C) 2012-2015 Fogus and Cognitect, Inc.

Distributed under the Eclipse Public License, the same as Clojure.

More Repositories

1

lemonad

a functional programming library for javascript. an experiment in elegant JS.
JavaScript
658
star
2

thunks

posts and code related to personal studies
374
star
3

ulithp

A micro LISP implementation in 24 lines of Ruby.
Ruby
270
star
4

papers-i-love

Computer science and computer-adjacent papers (and sometimes books) that have influenced me deeply.
261
star
5

lithp

McCarthy's Lisp in Python with macros. A celebration of 50+ years of symbolic processing.
Python
257
star
6

baysick

An embedded Insane-specific Language for Scala implementing the BASIC programming language
Scala
246
star
7

trammel

Contracts programming with Clojure
Clojure
242
star
8

bacwn

clojure + datalog = <3
Clojure
137
star
9

minderbinder

converting one thing into another thing via Clojure.
Clojure
88
star
10

codd

a relational algebra library for JavaScript
JavaScript
60
star
11

skiing

a clojure combinator zoo
Clojure
44
star
12

tori-lisp

an ersatz lisp for tiny birds. a code riff.
JavaScript
42
star
13

evalive

various eval functions and macros for use with clojure. a code riff.
Clojure
33
star
14

unfix

Infix and Postfix library for Clojure that was cut from the book.
Clojure
31
star
15

lang-genealogy

Forth
9
star
16

reinen-vernunft

Code conversations in Clojure regarding the application of pure reasoning algorithms.
Clojure
8
star
17

tathata

An implementation of Clojure pods.
Clojure
7
star
18

thneed

An eclectic set of Clojure utilities that I've found useful enough to keep around.
Clojure
5
star
19

gamut-of-games

a repository of rules for games in text formats
4
star
20

fogos

Assembly
3
star
21

russ-forth

Russforth is a teeny-tiny Forth-esque implementation in Ruby.
Ruby
3
star
22

tafl

a clojure library to manipulate and query table-like data structures.
Clojure
3
star
23

spec-experiments

Clojure
1
star
24

battlestation

a description of my home battle station
1
star
25

abs-oddity

Clojure
1
star