• Stars
    star
    64
  • Rank 463,579 (Top 10 %)
  • Language
    Clojure
  • Created almost 11 years ago
  • Updated almost 11 years ago

Reviews

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

Repository Details

Write Java inside Clojure

javastar

Write Java inside Clojure:

(require '[tailrecursion.javastar :refer [java*]])

(defn sum-doubles [arr]
  (java* [] double [doubles]
    "double s = 0;
     double[] arr = ~{};
     for(int i = 0; i < arr.length; i++) {
       s += arr[i];
     }
     return s;"
     arr))

(sum-doubles (double-array 10 1.0)) ;=> 10.0

(defn hi-from-java [name]
  (java* [] String [String] "return \"hi \" + ~{} + \"!\";" name))

(hi-from-java "Bob") ;=> "hi Bob!"

(defn add2 [x y]
  (java* [] long [long long] "return ~{} + ~{};" x y))

(add2 1 2) ;=> 3

(java* [clojure.lang.Var clojure.lang.RT]
       Object [String String]
       "Var str = RT.var(\"clojure.core\",\"str\");
        return str.invoke(~{},\" \", ~{}, \"!\");"
       "holy"
       "cow") ;=> "holy cow!"

Requires Java 1.6 JDK or higher.

Dependency Build Status

[tailrecursion/javastar "1.1.6"]

License

Copyright © 2013 Alan Dipert

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

More Repositories

1

boot

A Clojure build tool
Clojure
111
star
2

lein-simpleton

A Leiningen plugin to serve files out of a local directory -- very similar to Python's SimpleHTTPServer
Clojure
68
star
3

ring-edn

EDN handler for Ring
Clojure
63
star
4

cljson

Clojure/ClojureScript library for accelerated browser data deserialization
Clojure
62
star
5

ring-proxy

HTTP proxy ring middleware for Clojure web applications.
Clojure
47
star
6

hlisp-starter

Simple hlisp project setup.
JavaScript
42
star
7

cljs-priority-map

PersistentPriorityMap for ClojureScript
Clojure
33
star
8

wigwam

PHP REPL and other stuff
PHP
21
star
9

stasis

A collection of experiments related to the idea of compiling things
Clojure
19
star
10

hoplon.io

Source code for the website.
CSS
18
star
11

boot-datomic

run the datomic transactor embedded in a boot pod
Clojure
17
star
12

monocopy

Store arbitrary Clojure data in Datomic efficiently
Clojure
15
star
13

clojure-adapter-servlet

A shim to create a clojure-friendly servlet container interface.
Clojure
13
star
14

javelin-demos

Demos demonstrating the Javelin dataflow library for ClojureScript.
Clojure
12
star
15

hiprepl

A Clojure REPL bot for Atlassian HipChat
Clojure
11
star
16

presioke

Presentation karaoke app in ClojureScript using Hoplon
CSS
10
star
17

hoplon-deploy-heroku

Example application with everything needed to deploy to heroku.
Clojure
9
star
18

bo

A minimal implementation of LightTable's BOT Architecture.
HTML
9
star
19

boot.core

Core libraries for the Boot Clojure build tool.
Clojure
8
star
20

parenthescope

Experimental structural editing formats and utilities
Clojure
8
star
21

boot-jetty

a simple webserver for boot
Clojure
7
star
22

boston-clojure-hoplon-demo

Clojure
5
star
23

boot.ring

Tasks to start ring servers in the Boot build tool
Clojure
5
star
24

boot-heredoc

Parse files and replace string blocks with a Clojure string.
Clojure
5
star
25

javastarjnr

Example of using jnr-ffi to load native libraries in Clojure.
Clojure
5
star
26

lein-hlisp

Hlisp -> clojurescript compiler plugin for leiningen.
Clojure
4
star
27

boot.task

Useful tasks for the boot Clojure build tool.
Clojure
4
star
28

pixel

tracking pixel library in clojure
Clojure
3
star
29

hoplon.hammerjs

Adds HammerJS events to Hoplon
Clojure
3
star
30

extype

Hierarchical exceptions with data for Clojure.
Clojure
3
star
31

hoplon-uberwar

A minimal hoplon hello world uberwar
Clojure
3
star
32

orcus

Clojure
3
star
33

boot.notify

Notification tasks for the boot Clojure build tool
Clojure
2
star
34

stoke

structural editor leiningen plugin
Clojure
2
star
35

hoplon-garden-example

Example of using lein-garden with Hoplon to generate CSS.
Clojure
2
star
36

hlisp-template

Leiningen template for HLisp projects.
Clojure
1
star
37

boot-ng

Experimental next generation Clojure build tool
Clojure
1
star
38

boot.task.tomcat

Boot task to create a standalone Tomcat development server.
Clojure
1
star
39

lein-proxy

Leiningen plugin. Serves static files and proxies requests.
Clojure
1
star
40

boot-proxy

HTTP Boot proxy task.
Clojure
1
star
41

warp

Exception handling control flow for Clojure.
Clojure
1
star
42

boot-bucket

task for syncing boot output to an amazon web services (aws) s3 bucket.
Clojure
1
star