[armedbear-devel] Re: What are you working on?

Rolando Pereira rolando_pereira at sapo.pt
Fri Aug 30 19:30:17 UTC 2013


ubikation _ <ubikation-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org> writes:

> What projects are people working on using ABCL? If they are
> open-source, would you mind sharing a link to the repository?

Since the lack of answers is slightly disappointing I guess I can post
something regarding an experiment I did an afternoon a couple months ago
which tried to link Jython to ABCL.

Since it was an experiment I didn't put the source code online. Also
currently the source is basically just a "*slime-scratch*" buffer saved
to a file which means that the code is a hairy mess.

But here's an example to show how to use it:

> (add-to-classpath "/home/rolando/src/jython/jython-standalone-2.5.3.jar")
> (defvar *interpreter* (jss:new 'org.python.util.PythonInterpreter))
> 
> (#"exec" *interpreter* "import feedparser")
> 
> (defvar *rss-parse* (gethash "parse"
>                       (py-unwrap (#"getDict"
>                                    (gethash "feedparser"
>                                      (py-unwrap (#"getLocals" *interpreter*)))))))
> 
> ;; Get the ABCL mailing list RSS                                     
> (defvar *rss* (pycall *rss-parse* "http://rss.gmane.org/gmane.lisp.armedbear.devel"))

Having defined the "*rss*" variable you can then do this:

> CL-USER> (gethash "title" (nth 1 (gethash "entries" (py-unwrap *rss*))))
> "Web frameworks with ABCL (was Re: SBCL->ABCL migration questions)"
> T

Something I wanted to make was importing the Python modules as Lisp
functions so instead of defining the "*rss-parse*" as

> (defvar *rss-parse* (gethash "parse"
>                       (py-unwrap (#"getDict"
>                                    (gethash "feedparser"
>                                      (py-unwrap (#"getLocals" *interpreter*)))))))

you could do:

> (feedparser:parse "http://rss.gmane.org/gmane.lisp.armedbear.devel")

and that would also allow you slime's autocomplete to complete the
python code.

I've thought about doing the above using a macro around the "inspect"
Python module, but never got around to it.


Best Regards,
Rolando Pereira



More information about the armedbear-devel mailing list