From: ·············@gmail.com
Subject: common lisp external modules
Date: 
Message-ID: <546cb330-d42f-4c05-be2e-7daa8e39e4f9@f63g2000hsf.googlegroups.com>
Hi,

I've spent a long time on figuring out how to get clisp modules to
work and I'm sick of it. The documentation mentions "clisp-link" tool
but how should I use that? The required so called ``linking-set''
consists of some lisp.a, module.h, makevars files that are not where
they're supposed to be. That's driving me crazy.

Is there somebody who can explain me 'the process of getting clisp
module (matlab in this case) to work' or at least point me to some
'good' source of information? Apart from clisp documentation and it's
few words about 'clisp-link' I've found no *good* expaination by now.

Any help appreciated

--
M

From: Ralf Mattes
Subject: Re: common lisp external modules
Date: 
Message-ID: <g1uqru$8ur$1@news01.versatel.de>
On Sun, 01 Jun 2008 07:20:30 -0700, peculiar.mail wrote:

> Hi,
> 
> I've spent a long time on figuring out how to get clisp modules to
> work and I'm sick of it.

Could you elaborate a bit about _how_ you spent your time?

>  The documentation mentions "clisp-link" tool
> but how should I use that? The required so called ``linking-set''
> consists of some lisp.a, module.h, makevars files that are not where
> they're supposed to be. That's driving me crazy.

Within the first three treasures google send back after a query for
'clisp clisp-link' where 

 http://www.niksula.cs.hut.fi/~tsiivola/clisp-ffi-howto.html

 http://fsugtsr.org/magazine/issue2/clisp.html

Even so I have long ago abandoned CLISP (and never did FFI) this all
sounds pretty simple to me.


 
> Is there somebody who can explain me 'the process of getting clisp
> module (matlab in this case) to work' or at least point me to some
> 'good' source of information? Apart from clisp documentation and it's
> few words about 'clisp-link' I've found no *good* expaination by now.

Read the above mentioned stuff. Or, maye, define what you mean by 'good'.

 HTH Ralf Mattes
From: ·············@gmail.com
Subject: Re: common lisp external modules
Date: 
Message-ID: <e5990fb2-bd72-4aaa-8532-ecad148685db@j22g2000hsf.googlegroups.com>
On 1 Cze, 20:47, Ralf Mattes <····@mh-freiburg.de> wrote:

[...]
>
> Could you elaborate a bit about _how_ you spent your time?

well, I don't have that much time, sorry. But trust me I'm not *just*
complaining, I did the google search homework. I tried to compile the
module manualy, etc.

> >  The documentation mentions "clisp-link" tool
> > but how should I use that? The required so called ``linking-set''
> > consists of some lisp.a, module.h, makevars files that are not where
> > they're supposed to be. That's driving me crazy.
>
> Within the first three treasures google send back after a query for
> 'clisp clisp-link' where
>
>  http://www.niksula.cs.hut.fi/~tsiivola/clisp-ffi-howto.html
>
>  http://fsugtsr.org/magazine/issue2/clisp.html
>
> Even so I have long ago abandoned CLISP (and never did FFI) this all
> sounds pretty simple to me.

Once again - if it was that simple as using google I'd hardly bother
you (or anybody). Besides, when I've came accross those two links I
thought the same at first, you know. But then I tried to follow and
I'm stuck. And it is only because I don't know how the system works.
In other words I don't really need wizards,tools (clisp-link?) I just
need to know what is required, why and how to put it together.

>
> > Is there somebody who can explain me 'the process of getting clisp
> > module (matlab in this case) to work' or at least point me to some
> > 'good' source of information? Apart from clisp documentation and it's
> > few words about 'clisp-link' I've found no *good* expaination by now.
>
> Read the above mentioned stuff. Or, maye, define what you mean by 'good'.


The stuff is not helpful. It deals with things I have pretty good
understandind of and leaves the interesting part uncovered. For
example:

[second link]
"
To generate the linking set the command is

clisp-link add-module-set fact-module $CLISP/base base+fact

You can now see a directory called base+fact which contains the
extended clisp.The command combined the linking set in directory
$CLISP/base and the module in directory fact-module to a new linking
set in directory base+fact.
"

Now, would you be so kind and tell me why (if it's so silly simple) I
get sort of message:
"(...)/base does not contain a clisp linking set"
instead of having my module prepared? Probably because *the tool*
can't find required files! Luckily, there's no such file anywhere!
Moreover in the documentation files are listed but nothing more.

I did everything under cygwin on windows XP, clisp-2.45.

>  HTH Ralf Mattes

regards

--
M
From: Ralf Mattes
Subject: Re: common lisp external modules
Date: 
Message-ID: <g25sh4$3rp$1@news01.versatel.de>
On Mon, 02 Jun 2008 15:16:02 -0700, peculiar.mail wrote:

> On 1 Cze, 20:47, Ralf Mattes <····@mh-freiburg.de> wrote:
> 
> [...]
>>
>> Could you elaborate a bit about _how_ you spent your time?
> 
> well, I don't have that much time, sorry. But trust me I'm not *just*
> complaining, I did the google search homework. I tried to compile the
> module manualy, etc.
> 
>> >  The documentation mentions "clisp-link" tool
>> > but how should I use that? The required so called ``linking-set''
>> > consists of some lisp.a, module.h, makevars files that are not where
>> > they're supposed to be. That's driving me crazy.
>>
>> Within the first three treasures google send back after a query for
>> 'clisp clisp-link' where
>>
>>  http://www.niksula.cs.hut.fi/~tsiivola/clisp-ffi-howto.html
>>
>>  http://fsugtsr.org/magazine/issue2/clisp.html
>>
>> Even so I have long ago abandoned CLISP (and never did FFI) this all
>> sounds pretty simple to me.
> 
> Once again - if it was that simple as using google I'd hardly bother
> you (or anybody).

How should we know? You didn't tell us (once again?) what you've done so
far to grcok ffi linkeage.

>  Besides, when I've came accross those two links I
> thought the same at first, you know. But then I tried to follow and I'm
> stuck. 


Did you work through the example step by step? Did that fail?
(Just did it here an everythink worked out fine).


> And it is only because I don't know how the system works. In
> other words I don't really need wizards,tools (clisp-link?) I just need
> to know what is required, why and how to put it together.


You don't understand how the system works but you _do_ know that you don't
need provided tools? Let my bow in amazement ... 
This is open source - open up clisp-link in the text editor of your choice
(Notepad?)  and figure out what it's doing.

> 
> 
>> > Is there somebody who can explain me 'the process of getting clisp
>> > module (matlab in this case) to work' or at least point me to some
>> > 'good' source of information? Apart from clisp documentation and it's
>> > few words about 'clisp-link' I've found no *good* expaination by now.
>>
>> Read the above mentioned stuff. Or, maye, define what you mean by
>> 'good'.
> 
> 
> The stuff is not helpful. It deals with things I have pretty good
> understandind of and leaves the interesting part uncovered. For example:

So - please tell us mere mortals what things you already understand, and
what you don't understand.

> [second link]
> "
> To generate the linking set the command is
> 
> clisp-link add-module-set fact-module $CLISP/base base+fact
> 
> You can now see a directory called base+fact which contains the extended
> clisp.The command combined the linking set in directory $CLISP/base and
> the module in directory fact-module to a new linking set in directory
> base+fact.
> "
> 
> Now, would you be so kind and tell me why (if it's so silly simple) I
> get sort of message:

But that's not what you don't understand, that's what doesn't work on your
box!

> "(...)/base does not contain a clisp linking set" 


> instead of having my
> module prepared? 

Because, maybe, your clisp lis correct? Maybe you don't have a linking set
installed. Here on Debian/Ubuntu on has to install the clisp-dev package
to get the linking set in all it's glory. Can't help you with Cygwin,
sorry. This looks like an incomplete development environment to me.

 Cheers, RalfD



 
> Probably because *the tool* can't find required files!
> Luckily, there's
> no such file anywhere! Moreover in the documentation files are listed
> but nothing more.
> 
> I did everything under cygwin on windows XP, clisp-2.45.
> 
>>  HTH Ralf Mattes
> 
> regards
>
From: ·············@gmail.com
Subject: Re: common lisp external modules
Date: 
Message-ID: <72d7bd4c-7f00-4228-9794-8f6f16f43c98@e39g2000hsf.googlegroups.com>
On Jun 2, 6:16 pm, ·············@gmail.com wrote:
> Now, would you be so kind and tell me why (if it's so silly simple) I
> get sort of message:
> "(...)/base does not contain aclisplinking set"
> instead of having my module prepared? Probably because *the tool*
> can't find required files! Luckily, there's no such file anywhere!
> Moreover in the documentation files are listed but nothing more.

it would be helpful if you did "ls (...)/base".
From: ·············@gmail.com
Subject: Re: common lisp external modules
Date: 
Message-ID: <30320f42-89c7-4d83-9f03-482607c2257a@m3g2000hsc.googlegroups.com>
Hey guys, thank you all for helping me.

However I have some important things to do now and (unwillingly) I
need to put that off for a few days. But thanks for hints. I'll try
them when I have time.

regards
--
M
From: szergling
Subject: Re: common lisp external modules
Date: 
Message-ID: <ae007901-4ca8-45f8-9374-b4e35d10f633@i18g2000prn.googlegroups.com>
On Jun 2, 2:20 am, ·············@gmail.com wrote:
> I've spent a long time on figuring out how to get clisp modules to
> work and I'm sick of it. The documentation mentions "clisp-link" tool
> but how should I use that? The required so called ``linking-set''
> consists of some lisp.a, module.h, makevars files that are not where
> they're supposed to be. That's driving me crazy.
>
> Is there somebody who can explain me 'the process of getting clisp
> module (matlab in this case) to work' or at least point me to

[[...]]

Sorry for the late reply,

Are you still going at it? Do you still want clisp modules to work, or
do you just want to link to Matlab? I have a very minimal system
(probably not more than 20 functions) to talk to Matlab, originally
using clisp's :matlab, but more recently, just using cffi. With cffi,
that means you don't need a special clisp build, just a plain vanilla
clisp would do. You can even use other implementations (my stuff is
only casually tested on other Lisps: didn't work on Lispworks because
there seem to be issues with threads).

I probably spent not more than a few hours on this, so it's very rough
and probably bug ridden. It is mostly hand-written/hand-rolled, and
there is no grovelling or automated parsing.

It allows me to do things like:

;; Call Matlab's plot.
;; Ran from a buffer (slime-eval-last-sexp)
(with-hold (:clear t)
  (mplot theta-silt manual-silt "b.")
  (mplot theta-silt derivative-silt "r.")
  (mplot theta-silt simulated-silt "g.")
  ;; (mplot theta z0 "y.")
  )

Or from the REPL,

;; #l is a reader macro for directly going to Matlab

CL-USER> #l polyfit (theta, sim, 1)
"ans =
    9.7718    0.8716
"
CL-USER> #l help polyfit
" POLYFIT Fit polynomial to data.
    P = POLYFIT(X,Y,N) finds the coefficients of a polynomial P(X) of
    degree N that fits the data Y best in a least-squares sense. P is
a
    row vector of length N+1 containing the polynomial coefficients in
    descending powers, P(1)*X^N + P(2)*X^(N-1) +...+ P(N)*X + P(N+1).

    [P,S] = POLYFIT(X,Y,N) returns the polynomial coefficients P and a
    structure S for use with POLYVAL to obtain error estimates for
    predictions.  S contains fields for the triangular factor (R) from
a QR
    decomposition of the Vandermonde matrix of X, the degrees of
freedom
    (df), and the norm of the residuals (normr).  If the data Y are
random,
    an estimate of the covariance matrix of P is (Rinv*Rinv')*normr^2/
df,
    where Rinv is the inverse of R.

    [P,S,MU] = POLYFIT(X,Y,N) finds the coefficients of a polynomial
in
    XHAT = (X-MU(1))/MU(2) where MU(1) = MEAN(X) and MU(2) = STD(X).
This
    centering and scaling transformation improves the numerical
properties
    of both the polynomial and the fitting algorithm.

    Warning messages result if N is >= length(X), if X has repeated,
or
    nearly repeated, points, or if X might need centering and scaling.

    Class support for inputs X,Y:
       float: double, single

    See also POLY, POLYVAL, ROOTS.

    Reference page in Help browser
       doc polyfit

"
NIL
CL-USER> (matlab:copy-lisp-to-matlab (list-to-array manual) "manual")
; No value
CL-USER> (mcommand "inv([1 2 3 ; 0 1 0 ; 1 1 1])")
"ans =
   -0.5000   -0.5000    1.5000
         0    1.0000         0
    0.5000   -0.5000   -0.5000
"
NIL

etc. I can also simulate slime-eval-last-sexp for Matlab's .m files
using an Emacs function. It allows individual lines in a file to be
selected & sent to Matlab.

(defun matlab-eval-line ()
  (interactive)
  (save-excursion
    (beginning-of-line)
    (let ((start (point)))
      (end-of-line)
      (let* ((end (point)))
        (slime-interactive-eval
         (format "(mcommand \"%s\")"
                 (buffer-substring-no-properties
                  start end)))))))


Sooo... if you still want it, gimme a yell, and I'll go dig up the
code.
From: ·············@gmail.com
Subject: Re: common lisp external modules
Date: 
Message-ID: <1b3a0af8-a5ad-4514-8e89-108f35cd7d5c@p25g2000hsf.googlegroups.com>
On 5 Cze, 07:48, szergling <···············@gmail.com> wrote:
> On Jun 2, 2:20 am, ·············@gmail.com wrote:
>
[...]
>
> Sorry for the late reply,
>
> Are you still going at it? Do you still want clisp modules to work, or
> do you just want to link to Matlab? I have a very minimal system
> (probably not more than 20 functions) to talk to Matlab,(...)


That'd be of great help.
Well I merely want to run matlab from within lisp code, do some
computation and recieve the result. This is it. And let me tell you
sth. - I'm not that much in lisp as you. And I belive that
compilation, linkage, any developement under linux would be easier for
me. However I need to do that under windows and that's probably the
reason of all problems. The win32 binary package includes unix native
*.sh scripts, clisp-link, etc. but *does not* contain valid linking
set - why? isn't it a little odd?
But you pointed out one thing that I haven't tried... thanks.

And sorry, I should have been more specific in my previous posts. When
I said that I don't need the tool I meant that I can do the
compilation myself if the provided script can be run under windows
without problems and yes, I indeed read the clisp-link script. But I
was still missing something. At the same time I didn't want to compile
the whole clisp just to get one module working. Anyway I'll try one
more thing.

I really appreciate your support.

>
> Sooo... if you still want it, gimme a yell, and I'll go dig up the
> code.

Would you dig it up please? :)

regards
--
M
From: ·············@gmail.com
Subject: Re: common lisp external modules
Date: 
Message-ID: <9ebd2009-ffd5-4d97-a219-cc4521daee01@z66g2000hsc.googlegroups.com>
On Jun 5, 1:28 pm, ·············@gmail.com wrote:
> On 5 Cze, 07:48, szergling <···············@gmail.com> wrote:
>
> > On Jun 2, 2:20 am, ·············@gmail.com wrote:
>
> [...]
>
> > Sorry for the late reply,
>
> > Are you still going at it? Do you still want clisp modules to work, or
> > do you just want to link to Matlab? I have a very minimal system
> > (probably not more than 20 functions) to talk to Matlab,(...)
>
> That'd be of great help.
> Well I merely want to run matlab from within lisp code, do some
> computation and recieve the result. This is it. And let me tell you
> sth. - I'm not that much in lisp as you. And I belive that
> compilation, linkage, any developement under linux would be easier for
> me. However I need to do that under windows and that's probably the
> reason of all problems. The win32 binary package includes unix native
> *.sh scripts, clisp-link, etc. but *does not* contain valid linking
> set - why? isn't it a little odd?
> But you pointed out one thing that I haven't tried... thanks.
>
> And sorry, I should have been more specific in my previous posts. When
> I said that I don't need the tool I meant that I can do the
> compilation myself if the provided script can be run under windows
> without problems and yes, I indeed read the clisp-link script. But I
> was still missing something. At the same time I didn't want to compile
> the whole clisp just to get one module working. Anyway I'll try one
> more thing.
>
> I really appreciate your support.
>
>
>
> > Sooo... if you still want it, gimme a yell, and I'll go dig up the
> > code.
>
> Would you dig it up please? :)
>
> regards
> --
> M

Depending on what you need from matlab, gsll's linkage to GSL may give
you the required numerical functionality.

Mirko
From: szergling
Subject: Re: common lisp external modules
Date: 
Message-ID: <30c55a2e-3ec5-4f61-9867-463468679d40@j33g2000pri.googlegroups.com>
On Jun 6, 5:28 am, ·············@gmail.com wrote:
> On 5 Cze, 07:48, szergling

[[...]]

> > Sooo... if you still want it, gimme a yell, and I'll go dig up the
> > code.
>
> Would you dig it up please? :)
>

It should be in your email. Have fun.
From: ·············@gmail.com
Subject: Re: common lisp external modules
Date: 
Message-ID: <aeeb8ca2-e425-49ff-81c5-fbcffebfdb49@e39g2000hsf.googlegroups.com>
On Jun 1, 10:20 am, ·············@gmail.com wrote:
> Is there somebody who can explain me 'the process of gettingclisp
> module (matlab in this case) to work' or at least point me to some
> 'good' source of information? Apart fromclispdocumentation and it's
> few words about 'clisp-link' I've found no *good* expaination by now.

build clisp with matlab module:
./configure --cbc build --with-module=matlab

if you alredy have clisp built,
go to the build directory
edit Makefile, adding matlab to MODULES
then "make full"
./clisp -K full

note that you might get a better response time
with your clisp-specific problems by asking a
clisp-specific forum (or by giving me a free usenet feed ;-)

when you invoke clisp, you are given the url of the clisp homepage,
which links to the "How do I ask for help?" FAQ item. you might
benefit from reading it.