File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
src/com/github/beothorn/clojurecalc Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -2,5 +2,5 @@ Clojure Wrapper for libre office calc
2
2
3
3
Usage
4
4
5
- =clj("(+ 1 2 3 )")
5
+ =clj("(def fib-seq ((fn rfib [ a b ] (lazy-seq (cons a (rfib b (+ a b))))) 0 1)) (take 20 fib-seq )")
6
6
Original file line number Diff line number Diff line change 11
11
import com .sun .star .registry .XRegistryKey ;
12
12
import com .sun .star .uno .XComponentContext ;
13
13
import com .sun .star .table .XCellRange ;
14
+ import java .util .Iterator ;
14
15
15
16
public class ClojureCalcImpl extends WeakBase implements XServiceInfo , XLocalizable , XClojureCalc {
16
17
@@ -85,8 +86,10 @@ public String clj(String exp)
85
86
Thread .currentThread ().setContextClassLoader (parentClassLoader );
86
87
try {
87
88
IFn eval = Clojure .var ("clojure.core" , "load-string" );
88
- Object invoke = eval .invoke (exp );
89
- result = invoke .toString ();
89
+ IFn str = Clojure .var ("clojure.core" , "str" );
90
+ IFn apply = Clojure .var ("clojure.core" , "apply" );
91
+ Object evalResult = eval .invoke (exp );
92
+ result = apply .invoke (str , evalResult ).toString ();
90
93
}catch (Exception e ){
91
94
result = e .getMessage ();
92
95
} finally {
You can’t perform that action at this time.
0 commit comments