> The above is something that I put together the other day to load qi
> via asdf.
Thanks!
> It is not particularly well tested, and may be wrong in part.
> The fully qualified symbols are mainly there to make it clearer which
> language we're dealing with.
> Also, it needs to stop polluting cl-user -- probably a "QI" package
> which handled the CL side would work better, but this should get you
> started.
>
> Once you've done that, you can start qi with (require 'qi) (in-qi) (|
> qi|::|qi|).
Just curious - why the explicit requirement of accepting the GPL? I've
never encountered that before, and I don't think the GPL itself requires
it - certainly not when the usage doesn't involve distribution.
CY
The original one posted doesn't.
Assuming that attachments work with groups, the attached code does.
You'll still need to link or rename "Qi 9.1.txt" to qi.lisp.
The code is quite horrible and only very briefly tested (since I just hacked
it together). I don't understand Qi in any deep way yet, so it's probably
doing things more stupidly than necessary. Use at your own risk :)
Hopefully this can be made more civilized and integrated into Qi proper.
I'm thinking that switching from (in-qi) ... (out-qi) to (qi ...) and
(prolog ...) might be a better approach. What do people think?
There is also (qi:repl) which drops you into the normal qi environment with
no easy means of escape -- you might break out using catch/throw.
Ah, one thing that I haven't shown here is turning on type checking mode.
In this case, when (in-qi), you'll receive back two values for each top-level
evaluation -- the first is the result, the second the type, so that you can
capture both with multiple-value-bind if you want to.
* (map (* 7) [1 2 3])
(7 14 21)
(list number)
Here's a transcript which is the best documentation at the moment.
Also see test.lisp which shows how to switch to prolog and back.
---
* (require 'qi)
NIL
* (compile-file "test")
; compiling file "/home/zhivago/lisp/qi/Qi 9.1/test.lisp" (written 16
JAN 2008 11:36:07 PM):
; /home/zhivago/lisp/qi/Qi 9.1/test.fasl written
; compilation finished in 0:00:00
#P"/home/zhivago/lisp/qi/Qi 9.1/test.fasl"
NIL
NIL
* (load "test")
======> Warning: the following variables are free in test: X; Y;
T
* (qi::test)
(1 2)
* (qi:in-qi)
NIL
* (map (* 7) [1 2])
(7 14)
* (test)
(1 2)
* (out-qi)
NIL
* *package*
#<PACKAGE "COMMON-LISP-USER">
*
----