Not AutoCAD related, but LISP
This was something I worked on last year, but shelved it until now. With college football quickly approaching I'd decided to give it another try. Because LISP works well with lists, it seems natural to apply it to football pools. It represents one person's predicted scores and compares it with the actual scores, then prints the person's name and point differential compared to actual scores for two games. (eg. Bill91 34pts).I'm getting a bad argument error for some reason.
(defun ptdiff ()(setq actscr '(24 21 24 27))(setq urscr '(("Bill91" 10 31 20 21) ("dante" 21 30 24 20) ("91dwg" 10 31 21 28) ))(while(setq urscr (car urscr))(princ (car urscr))(setq gm1 (+ (abs (- (nth 1 urscr)(nth 0 actscr)))(abs (- (nth 2 urscr)(nth 1 actscr)))) gm2 (+ (abs (- (nth 3 urscr)(nth 2 actscr)))(abs (- (nth 4 urscr)(nth 3 actscr)))))(setq sum (+ gm1 gm2))(princ " ")(princ sum) (princ "pts")(setq urscr (cdr urscr))) (princ)) Perhaps:
(defun ptdiff ( / actscr item urscr ) (setq actscr '(24 21 24 27)) (setq urscr '( ("Bill91" 10 31 20 21) ("dante" 21 30 24 20) ("91dwg" 10 31 21 28) ) ) (while (setq item (car urscr)) (princ (strcat "\n" (car item) " " (itoa (apply '+ (mapcar 'abs (mapcar '- (cdr item) actscr)))) "pts" ) ) (setq urscr (cdr urscr)) ) (princ))
Your error was caused by:
(while (setq urscr (car urscr))==>urscr = ("Bill91" 10 31 20 21) (setq urscr (cdr urscr))==>urscr = (10 31 20 21)) Thanks for the quick reply, Lee. I'll check it out when I get back in a few hours.
Are you the the same OP ?
Please clarify... Am I correct in understanding that you have two CADTutor accounts (serick83, and Steven Erickson), and that you are using 'clone' (i.e., non-authorized) software to make AutoCAD 2007 LT *think*, or *act* like a full version of AutoCAD? Ohhhhhhh woooooooooo woooooooooo.
Just use Common Lisp or something else.
BTW - Jeff, I thought your last avatar pic was awesome, but this new one is hilarious. Off Topic
It reminds everyday to strive to be the best pimp I can be Tharwat:
Yes. I don't know what happened. I was signed in with the first username, but when I went to quickly send out a response to Lee Mac it somehow changed to my previous username. Sorry for the confusion. Renderman:
As I mentioned to Tharwat I was signed in with the first username, but when I responded to Lee Mac it somehow converted to my previous username.
No, I'm not using something non-authorized. Because my LT doesn't have the ability to use AutoLISP I'm using a AutoCAD competitor on a 30-day trial. Sorry about not making myself clear.
页:
[1]
2