Help translate c+ => lisp!?
Help translate c+ => lisp!?
Hi,
I am a newcomer can anywhere translate this to lisp?
cin<<x;
for( i = 0; i < x; i++) {
…
}
Thx..
Georg#
I am a newcomer can anywhere translate this to lisp?
cin<<x;
for( i = 0; i < x; i++) {
…
}
Thx..
Georg#
Re: Help translate c+ => lisp!?
Adding in types, the C++ is probably
Here's roughly equivalent CL.
There a few options for checking that x is an integer (such as an IF instead of the assert), there are times to prefer DO or LOOP over DOTIMES, and *STANDARD-INPUT* is a default and doesn't need to be specified to READ.
Please check out some of the books in the FAQ for this forum.
Code: Select all
int x;
cin >> x;
for(int i=0; i<x; i++) { ... }
Code: Select all
(let ((x (read *standard-input*)))
(assert (integerp x))
(dotimes (i x) ...))
Please check out some of the books in the FAQ for this forum.
Re: Help translate c+ => lisp!?
Thx for you reply!
still I have a problem whit the ACAD lisp
me lisp doesn't not work...
(print)
(defun C:PL ()
(setvar "OSMODE" 1)
(INITGET 1)
(setq P1 (getpoint "\n Lower Left Endpoint: "))
(INITGET 1)
(setq P2 (getpoint "\n Upper Right Endpoint: "))
(setvar "OSMODE" 0)
;;***********************************************
(print "How many copies?")
(let ((x (read *standard-input*)))
(assert (integerp x))
(dotimes (i x)
;************************************************* **************************************************
(setvar "cmdecho" 0)
(command "-PLOT" "j" "" "Canon MP270 series Printer" "A4" "" "" "" "fe" P1 P2 "" "" "" "acad.ctb" "" "" "" "" "" "" "")
))
;************************************************* **************************************************
)
still I have a problem whit the ACAD lisp
me lisp doesn't not work...
(print)
(defun C:PL ()
(setvar "OSMODE" 1)
(INITGET 1)
(setq P1 (getpoint "\n Lower Left Endpoint: "))
(INITGET 1)
(setq P2 (getpoint "\n Upper Right Endpoint: "))
(setvar "OSMODE" 0)
;;***********************************************
(print "How many copies?")
(let ((x (read *standard-input*)))
(assert (integerp x))
(dotimes (i x)
;************************************************* **************************************************
(setvar "cmdecho" 0)
(command "-PLOT" "j" "" "Canon MP270 series Printer" "A4" "" "" "" "fe" P1 P2 "" "" "" "acad.ctb" "" "" "" "" "" "" "")
))
;************************************************* **************************************************
)
Re: Help translate c+ => lisp!?
Are we talking Common Lisp or Autolisp (used by AutoCad) or something else?
What program reads the files?
What program reads the files?
Re: Help translate c+ => lisp!?
The prog. is for Acad! Is there a difference?
-
- Posts: 47
- Joined: Fri Jun 03, 2011 5:30 am
- Location: Behind you.
- Contact:
Re: Help translate c+ => lisp!?
Well, it is another Lisp dialect, so I presume there is.georg wrote:The prog. is for Acad! Is there a difference?
Don't take the FUN out of DEFUN !