Skip to content

Commit eaea8dd

Browse files
committed
Usint to string from clojure
1 parent dd854a6 commit eaea8dd

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ Clojure Wrapper for libre office calc
22

33
Usage
44

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)")
66

src/com/github/beothorn/clojurecalc/ClojureCalcImpl.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import com.sun.star.registry.XRegistryKey;
1212
import com.sun.star.uno.XComponentContext;
1313
import com.sun.star.table.XCellRange;
14+
import java.util.Iterator;
1415

1516
public class ClojureCalcImpl extends WeakBase implements XServiceInfo, XLocalizable, XClojureCalc{
1617

@@ -85,8 +86,10 @@ public String clj(String exp)
8586
Thread.currentThread().setContextClassLoader(parentClassLoader);
8687
try {
8788
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();
9093
}catch(Exception e){
9194
result = e.getMessage();
9295
} finally {

0 commit comments

Comments
 (0)