Hi Tomas,
> I wasn't aiming for speed with this first version but rather for
> understanding of the underlying concepts, namely how evaluation and
> shallow binding works and creating simple but generic and powerful Java
> FFI. If you have a look at the code, you'll find that only necessary
> minimum is implemented in Java, the rest is in java.wl file.
Yes, that's all right. I also remember you've told me that when we met
in Berlin. You wanted to implement only the absolute minimum in Java,
and the rest in Lisp.
> > java wl ErsatzLisp Pil32 Pil64
> > +---------------------------------------
> > (fibo 22) | 25 0.19 0.015 0.016
> > (fibo 23) | 45 0.25 0.026 0.024
> > (fibo 24) | 69 0.36 0.041 0.039
> > (fibo 25) | 122 0.52 0.060 0.063
>
> Interesting. Just curious: how did you measure those times?
I put the following 6 lines into a file 'x':
(de fibo (N)
(if (> 2 N)
1
(+ (fibo (dec N)) (fibo (- N 2))) ) )
(fibo 25)
(bye)
and then did
$ time cat x |java wl
...
$ time cat x |ersatz/picolisp
...
$ time cat x |bin/picolisp
...
>
> > respond, however, and if I press the button it crashes with a
> > RuntimeException. Can the reason be that I'm usin OpenJDK?
>
> Works fine for me. I'm using:
>
> $ java -version
> java version "1.6.0_18"
> OpenJDK Runtime Environment (IcedTea6 1.8.1) (6b18-1.8.1-0ubuntu1)
> OpenJDK 64-Bit Server VM (build 16.0-b13, mixed mode)
I have almost the same. The only differences are (6b18-1.8.1-2) instead
of (6b18-1.8.1-0ubuntu1) and (build 16.0-b13, mixed mode).
> What is the stack trace you get?
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException:
InvocationTargetException: (jnew [class java.math.BigInteger] (X 'toString))
at wl.err(wl.java:64)
at wl$39.fn(wl.java:1178)
at wl.apply(wl.java:416)
at wl.eval(wl.java:403)
at wl.eval(wl.java:410)
at wl.xrun(wl.java:391)
at wl.xrun(wl.java:398)
at wl.applyC(wl.java:449)
at wl.apply(wl.java:415)
at wl.eval(wl.java:403)
at wl.eval(wl.java:410)
at wl$30.fn(wl.java:999)
at wl.apply(wl.java:416)
at wl.eval(wl.java:403)
at wl.eval(wl.java:410)
at wl.xrun(wl.java:391)
at wl.xrun(wl.java:398)
at wl$33.fn(wl.java:1052)
at wl.apply(wl.java:416)
at wl.eval(wl.java:403)
at wl.eval(wl.java:410)
at wl.xrun(wl.java:391)
at wl.xrun(wl.java:398)
at wl.applyC(wl.java:449)
at wl.apply(wl.java:415)
at wl.eval(wl.java:403)
at wl.eval(wl.java:410)
at wl$41$1.invoke(wl.java:1229)
at $Proxy0.actionPerformed(Unknown Source)
at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2012)
at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2335)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:404)
at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:253)
at java.awt.Component.processMouseEvent(Component.java:6108)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:5873)
at java.awt.Container.processEvent(Container.java:2105)
at java.awt.Component.dispatchEventImpl(Component.java:4469)
at java.awt.Container.dispatchEventImpl(Container.java:2163)
at java.awt.Component.dispatchEvent(Component.java:4295)
at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4461)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4125)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4055)
at java.awt.Container.dispatchEventImpl(Container.java:2149)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4295)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:604)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
Cheers,
- Alex
--
UNSUBSCRIBE: mailto:[email protected]?subject=unsubscribe