Interlisp / medley

The main repo for the Medley Interlisp project. Wiki, Issues are here. Other repositories include maiko (the VM implementation) and Interlisp.github.io (web site sources)
https://Interlisp.org
MIT License
369 stars 23 forks source link

Attempting to run Common Lisp functions from EXEC (XCL) window #1397

Open skaisler1 opened 8 months ago

skaisler1 commented 8 months ago

Attempting a CL function from XCL Exec: Using a math library written in CL.

Two files: Gamma.l which loads Horner.l Gamma&Horner-CLTest.pdf

This has the image of loading the two files.

Here is what gamma-function-nbs definition is: (defun gamma-function-nbs (a) (let ((x (- a 1.0))) (declare (float x)) (cond ((< x 0.0) (/ (gamma-function-nbs (1+ a)) a)) ((> x 1.0) (* x (gamma-function-nbs x))) (t (poly x 1.000000000 -.577191652 0.988205891 -.897056937 0.918206857 -.756704078 0.482199394 -.193527818 0.035868343) ;eps < 3e-7 ) ) ) )

Here is the function call: Function call.pdf

Note that selecting the XCL Exec sets the Pkg: and Rdtbl: properly.

If I define an XCL function as seen in the image below and run it, it works fine. Add1-Function.pdf

Here is the definition of Poly from Horner.l which was loaded by Gamma.L

(defun poly-expand (var coefs) (cond ((null coefs) 0.0) ((null (cdr coefs)) (car coefs)) (t `(+ ,(car coefs) (* ,var ,(poly-expand var (cdr coefs)))) ) ) )

(defmacro poly (var . coefs) (poly-expand var coefs) )

So, is it a defmacro problem? The XCL Implementation Notes do not address this problem.

nbriggs commented 8 months ago

Here are the three definitions, cut and pasted from your text above and then displayed in SEdit -- image and here's the result of doing (gamma-function-nbs 2.5) -- image

So I'm not sure where the problem that you're seeing is coming from - something about what you've got in the files other than the definitions that are in the bug report?

nbriggs commented 8 months ago

Perhaps you could attach (or provide a link to) the files that you loaded?

nbriggs commented 8 months ago

Looks as though this might have come from the CLMath package, a number of copies of which are available in github. Which one did you start with?

skaisler1 commented 8 months ago

Nick:

I had downloaded this package years ago, so not sure where it cam from.

Steve K.

On 11/05/2023 1:05 PM EST Nick Briggs @.***> wrote:

Looks as though this might have come from the CLMath package, a number of copies of which are available in github. Which one did you start with?

— Reply to this email directly, view it on GitHub https://github.com/Interlisp/medley/issues/1397#issuecomment-1793806104, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJMVT27OYHIE4R5BUM4DTNLYC7BPFAVCNFSM6AAAAAA66C7ZYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJTHAYDMMJQGQ. You are receiving this because you authored the thread.Message ID: @.***>