Command: (load "phi")
; error: LOAD failed: "phi"
Command: phi
1.61803
Command:
Command: '_.help
Command: (* phi 2)
; error: bad argument type: numberp: nil
Command: (* (phi) 2)
; error: no function definition: PHI
Command: phi
1.61803
Command:
Command: PHI 1.61803
Command:
my acaddoc.lsp has this in it..... (defun c:phi () (/ (+ 1 (sqrt 5)) 2))
am scratching head as to why i cant times it by two.. or three, or ....
which part of code did i write wrong? did it on fly. seems to me, that i
should simply be able to
:: (* phi 2) (times phi by two)
oh well.
I think the problem is that you haven't set a variable to hold the real
number. The function returns the value, but only when you run it, and I
don't think you can run it when it's a term in another function. Try running
this:
(defun c:phunction ( / ) (setq phi (/ (+ 1 (sqrt 5)) 2)))
Now you can summon the vaule stored in phi from other functions during the
drawing session. I also think it's a problem to have the function and the
variable have the same name. If you want to use the value of phi in other
functions, name this function something else.
(defun c:phi () (setq phi (/ (+ 1 (sqrt 5)) 2)))
The function name won't interfere with the variable name, so if
sunnysidedown wants to have a "phi" function and variable, it'll be
OK.
Not being critical, just factual. You would be correct in assuming
there would be interference IF the function name did not have "c:" in
front of it.
Bill DeShawn
Have you tried it named the same?\
Not being critical, just factual. You would be correct in assuming
there would be interference IF the function name did not have "c:" in
front of it.
Bill DeShawn
PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.