How do I change Basis to lisp?

How do I change Basis to lisp?

jinkinglee
Enthusiast Enthusiast
762 Views
2 Replies
Message 1 of 3

How do I change Basis to lisp?

jinkinglee
Enthusiast
Enthusiast

if lady_chest > 0.0 and lady_height > 0.0 then
    IF lady_chest < CM_INCH(90.0) THEN
      lady_back_i = lady_height / 4 - cm_inch(1.0)
      lady_front_i = lady_back_i + CM_INCH(4.0)
   ELSE IF lady_chest <= CM_INCH(100.0) THEN
     lady_back_i = lady_height / 4 - cm_inch(1.0)
    lady_front_i = lady_back_i + CM_INCH(4.5) '+ (lady_chest*0.2+cm_inch(3.0))
   END IF
end if

0 Likes
Accepted solutions (1)
763 Views
2 Replies
Replies (2)
Message 2 of 3

Shneuph
Collaborator
Collaborator
Accepted solution

Your program would look something like this:

 

(if (and (> lady_chest 0.0) (> lady_height 0.0))
  (iF (< lady_chest (* CM_INCH 90.0))
    (setq lady_back_i (* (- (/ lady_height 4) cm_inch) 1.0)
	  lady_front_i (+ lady_back_i (* CM_INCH 4.0)))
    (if (<= lady_chest (* CM_INCH 100.0))
      (setq lady_back_i (- (/ lady_height 4) (* cm_inch 1.0))
	    lady_front_i (+ lady_back_i (* CM_INCH 4.5)))
      );if
    );if
  );if

I'm not sure if I read the original correctly though.  Not familiar with I assume you meant basic?

 

Generally you need to enclose each statement in parenthesis and start with the operator.  2+2  ~~>  (+ 2.0 2.0) etc.

If function assumes then and else.  1st statement is then 2nd statement is else.  If you need more than one statement for each then enclose them in the progn function like: (progn (first statement) (2nd Statement) )  In this case I think you can assign the values to your variable sin 1 (setq statement) so it shouldn't be required.

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 3 of 3

pbejse
Mentor
Mentor

 

If you will be adding more conditions in the future, I would suggest the cond  function


@jinkinglee wrote:

...      lady_back_i = lady_height / 4 - cm_inch(1.0)
...


Not sure about the math but why multiply by 1.0?  (assuming its multiplication based on Shneuph post.) are you converting an integer to real number?

perhaps use the function float