2

With reference to my previous question, Executing a lisp function from Java I was able to call lisp code from Java using ABCL. But the problem is, the already existing lisp code uses CL-PPCRE package. I can not compile the code as it says 'CL-PPCRE not found'. I have tried different approaches to add that package, including 1) how does one compile a clisp program which uses cl-ppcre? 2)https://groups.google.com/forum/#!topic/cl-ppcre/juSfOhEDa1k

Doesnot work! Other thing is, that executing (compile-file aima.asd) works perfectly fine although it does also require cl-pprce

(defpackage #:aima-asd
(:use :cl :asdf))

(in-package :aima-asd)

(defsystem aima
  :name "aima"
  :version "0.1"
  :components ((:file "defpackage")
           (:file "main" :depends-on ("defpackage")))
   :depends-on (:cl-ppcre))

The final java code is

interpreter.eval("(load \"aima/asdf.lisp\")");
interpreter.eval("(compile-file \"aima/aima.asd\")");
interpreter.eval("(compile-file \"aima/defpackage.lisp\")");
interpreter.eval("(in-package :aima)");
interpreter.eval("(load \"aima/aima.lisp\")");
interpreter.eval("(aima-load 'all)");

The error message is

Error loading C:/Users/Administrator.NUIG-1Z7HN12/workspace/aima/probability/domains/edit-nets.lisp at line 376 (offset 16389)
#<THREAD "main" {3A188AF2}>: Debugger invoked on condition of type READER-ERROR
  The package "CL-PPCRE" can't be found.
[1] AIMA(1): 

Can anyone help me?

Community
  • 1
  • 1

2 Answers2

2

You need to load cl-ppcre before you can use it. You can do that by using (asdf:load-system :aima), provided that you put both aima and cl-ppcre into locations that your ASDF searches.

Svante
  • 50,694
  • 11
  • 78
  • 122
  • I was finding it very confusing and techy to do it, it was giving me errors, so i used QuickLisp, loaded quicklisp.lisp and used the statement: interpreter.eval("( load \"aima/quicklisp.lisp\")"); interpreter.eval("(load \"aima/quicklisp/setup.lisp\")"); interpreter.eval("(in-package :ql)"); interpreter.eval("(ql:quickload :cl-ppcre)"); – Hamda Binte Ajmal Jan 28 '15 at 12:57
  • 1
    @HamdaBinteAjmal, you should post that as an answer; it's a pretty good solution. (I think the in-package part is redundant, though.) – Samuel Edwin Ward Jan 28 '15 at 21:14
2

I used QuickLisp to add cl-ppcre (because nothing else worked for me). Here is what I did

(load \"~/QuickLisp.lisp\")")
(quicklisp-quickstart:install) 
(load "~/quicklisp/setup.lisp")
(ql:quickload :cl-ppcre)

First 2 lines are only a one time things. Once quickLisp is installed you can start from line 3.

  • There is also `ql:add-to-init-file`, which adds Quicklisp to the CL implementation's iinit file so that it is automatically loaded on startup. – Svante Jan 30 '15 at 09:16