I wrote the following scheme function, which works as expected when called in Dr Racket, but only returns half of the result when called using kawa.
(define getYValues (lambda (f base lst)
(if (null? lst)
base
(cons (f (car lst)) (getYValues f base (cdr lst)))
)
)
)
The values used for testing are:
(getYValues
(lambda (x)
(* x x)
)
'()
'(-5.0 -4.5 -4.0 -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 ))
In Dr Racket it returns the correct result: (25.0 20.25 16.0 12.25 9.0 6.25 4.0 2.25 1.0 0.25 0.0 0.25 1.0 2.25 4.0 6.25 9.0 12.25 16.0 20.25)
But called from our Java application using kawa it returns: (25.0 20.25 16.0 12.25 9.0 6.25 4.0 2.25 1.0 0.25 ...)
Does anyone know why the list is cut off and half of it replaced by ...?
I use Scheme.eval to call the function
Update/solution
The following code solved my problem:
LList list = new LList();
try {
list = (LList)scm.eval(schemeCall);
} catch (Throwable e) {
e.printStackTrace();
}
double[] yValues = new double[LList.length(list)];
for (int i = 0; i<yValues.length;i++) {
yValues[i] = ((DFloNum) list.get(i)).doubleValue();
}
Wild guess: it's possible that the list is complete, but only a part of it is displayed, for presentation purposes - the rest is assumed to be in the
...
part. To check, print thelength
of the list, it must be correct even if not all the elements are shown.