Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 501385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:11:03+00:00 2026-05-13T06:11:03+00:00

Long story: I am doing a project for my functional programing class, and I

  • 0

Long story:

I am doing a project for my functional programing class, and I thought of writing an AI controller in Lisp, for the Mario AI competition.

I was looking over frameworks/libraries/ways of calling Lisp code from Java, or even better Lisp-Java intercommunication.

I have looked at Jacol, but it is old, and it does not compile fine for me.

My best choice so far is: Jatha.
It is really neat, although some lisp constructs are not yet implemented, one can easily define his own constructs. For example mapcar and cond are not implemented.
I have implemented my own mapcar, named mapp in Lisp like this:

(defun map* (f l r) 
  (if (null l)
      r
      (map* f (rest l) (cons (funcall f (first l)) r))))

(defun mapp (f l)
    (reverse (map* f l nil)))

Now I have a simple function that uses this, for example, a function that numbers how many atoms there are in a non-linear list

(defun myfunc (l)
  (if (atom l)
      '1
      (apply '+ (mapp 'myfunc l)))) 

(myfunc '(6 2))

This all works fine in clisp
Now to call Lisp code from Java I used Jatha. All one has to do is import the Jatha library in the java project and load a lisp file like this (ex):

import org.jatha.*;
import org.jatha.dynatype.*;

public class Main {

    public static void main(String[] args) {
        Jatha lisp = new Jatha(false, false);
        lisp.init();
        lisp.start();
        LispValue file = lisp.makeString("X:\\lispproject\\test1.lisp");
        LispValue rez1 = lisp.load(file);
    }
}

While that code works fine in clisp, and other implementations, this code produces a StackOverflow


run:
APPLY: fn = +, args = ((1 1))
S: ((+ (QUOTE 1) (QUOTE 1)))
Exception in thread "main" java.lang.StackOverflowError
at java.lang.Long.toString(Long.java:242)
at java.lang.Long.toString(Long.java:100)
at java.lang.String.valueOf(String.java:2946)
at org.jatha.dynatype.StandardLispInteger.toString(StandardLispInteger.java:113)
at org.jatha.dynatype.StandardLispCons.toString(StandardLispCons.java:152)
at org.jatha.dynatype.StandardLispCons.toStringAsCdr_internal(StandardLispCons.java:174)
at org.jatha.dynatype.StandardLispCons.toString(StandardLispCons.java:153)
at org.jatha.dynatype.StandardLispCons.toStringAsCdr_internal(StandardLispCons.java:174)
at org.jatha.dynatype.StandardLispCons.toString(StandardLispCons.java:153)
at org.jatha.dynatype.StandardLispCons.toStringAsCdr_internal(StandardLispCons.java:174)
at org.jatha.dynatype.StandardLispCons.toString(StandardLispCons.java:153)
at org.jatha.dynatype.StandardLispCons.toString(StandardLispCons.java:152)
at org.jatha.dynatype.StandardLispCons.toString(StandardLispCons.java:152)
at org.jatha.dynatype.StandardLispCons.toStringAsCdr_internal(StandardLispCons.java:174)
at org.jatha.dynatype.StandardLispCons.toString(StandardLispCons.java:153)
at org.jatha.dynatype.StandardLispCons.toString(StandardLispCons.java:152)
at org.jatha.dynatype.StandardLispCons.toStringAsCdr_internal(StandardLispCons.java:174)
at org.jatha.dynatype.StandardLispCons.toString(StandardLispCons.java:153)
at org.jatha.dynatype.StandardLispCons.toString(StandardLispCons.java:152)
at org.jatha.dynatype.StandardLispCons.toStringAsCdr_internal(StandardLispCons.java:174)
at org.jatha.dynatype.StandardLispCons.toString(StandardLispCons.java:153)
at org.jatha.dynatype.StandardLispCons.toString(StandardLispCons.java:152)
at org.jatha.dynatype.StandardLispCons.toStringAsCdr_internal(StandardLispCons.java:174)
at org.jatha.dynatype.StandardLispCons.toString(StandardLispCons.java:153)
at org.jatha.dynatype.StandardLispCons.toString(StandardLispCons.java:152)
at org.jatha.dynatype.StandardLispCons.toStringAsCdr_internal(StandardLispCons.java:174)
at org.jatha.dynatype.StandardLispCons.toString(StandardLispCons.java:153)
at org.jatha.dynatype.StandardLispCons.toString(StandardLispCons.java:152)
at org.jatha.dynatype.StandardLispCons.toStringAsCdr_internal(StandardLispCons.java:174)
at org.jatha.dynatype.StandardLispCons.toString(StandardLispCons.java:153)
at org.jatha.dynatype.StandardLispCons.toString(StandardLispCons.java:152)
at org.jatha.dynatype.StandardLispCons.toStringAsCdr_internal(StandardLispCons.java:17

So my question is, why does it do this? Is my code wrong?
Is it a bug in Jatha? See for yourself, it doesn’t take long to set up.
Have you ever done something similar?
Do you know any other better ways to do this? All I want is to call from Java some Lisp code, get it executed, and get back results computed by the Lisp code.
Thanks.

[Edit] Fixed code, pasted something wrong.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:11:04+00:00Added an answer on May 13, 2026 at 6:11 am

    ABCL is a Common Lisp implementation that runs directly in the JVM – possibly it is the best option to run Common Lisp side by side with Java.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing a project for a class which focuses on storing a huge matrix
I'm doing some error correction in Java and to cut a long story short;
Long story short, I have a substantial Python application that, among other things, does
Long story short, we found files promoting prescription drugs on our server that we
Long story short, I have an ASP.NET application I'm trying to debug and at
Long story short, I'm developing a theme template for a blog that enables you
Long story short, the database I'm using needs to get looked at. Until that
Long story short is I tried to quickly update a single row in SQL
Long story short, I'm making a custom Swing component that's basically a JTable with
Long story, long: I am adding a web interface (ASPX.NET: VB) to a data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.