Skip to content
JiSE: Java in S-Expression
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/jise Support strings as case label Mar 19, 2019
.gitignore Add deps.edn Mar 1, 2019
LICENSE first commit Feb 21, 2019 Update example code on README Mar 6, 2019

JiSE: Java in S-Expression

JiSE is Clojure's embedded DSL for making it as easy (or maybe even easier?) to write imperative code than in Java.


(require '[jise.core :refer [defclass]])

(defclass Counter
  (def ^int c)
  (defm Counter [^int c]
    (set! (.-c this) c))
  ^:public ^int
  (defm inc []
    (inc! (.-c this))))

;; You can use the defined class (`Counter`) as an ordinary Java class
(def c (Counter. 10))
(.inc c) ;=> 11
(.inc c) ;=> 12
(.inc c) ;=> 13

;; Also, you can even write quite imperative code easily as follows:

(defclass Qsort
  ^:public ^:static
  (defm qsort [^{:tag [int]} xs ^int left ^int right]
    (when (< left right)
      (let [p (aget xs (/ (+ left right) 2))
            l left
            r right]
        (while (<= l r)
          (while (< (aget xs l) p) (inc! l))
          (while (> (aget xs r) p) (dec! r))
          (when (<= l r)
            (let [tmp (aget xs l)]
              (aset xs l (aget xs r))
              (aset xs r tmp)
              (inc! l)
              (dec! r))))
        (Qsort/qsort xs left r)
        (Qsort/qsort xs l right)))))

(def arr (int-array [3 1 4 1 5 9 2]))
(Qsort/qsort arr 0 (dec (count arr)))
(seq arr)
;=> (1 1 2 3 4 5 9)


Copyright © 2019 Shogo Ohta

This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at

This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.