乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 13|回复: 13

[编程交流] Not AutoCAD related, but LISP

[复制链接]

1

主题

2

帖子

1

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 08:59:06 | 显示全部楼层 |阅读模式
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.
 
[EDIT: I have AutoCAD LT2007, but am using AutoCAD clone for this.]
 
  1. (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))
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 09:07:12 | 显示全部楼层
Perhaps:
 
  1. (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:
 
  1. (while (setq urscr (car urscr))  ==>  urscr = [font=monospace]([/font]"Bill91" 10 31 20 21) (setq urscr (cdr urscr))  ==>  urscr = (10 31 20 21))
回复

使用道具 举报

3

主题

18

帖子

15

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-6 09:09:35 | 显示全部楼层
Thanks for the quick reply, Lee. I'll check it out when I get back in a few hours.
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
358
发表于 2022-7-6 09:16:20 | 显示全部楼层
 
Are you the the same OP ?
回复

使用道具 举报

44

主题

3166

帖子

2803

银币

中流砥柱

Rank: 25

铜币
557
发表于 2022-7-6 09:19:37 | 显示全部楼层
 
 
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?
回复

使用道具 举报

0

主题

101

帖子

103

银币

限制会员

铜币
-2
发表于 2022-7-6 09:24:06 | 显示全部楼层
Ohhhhhhh woooooooooo woooooooooo.
 
Just use Common Lisp or something else.
回复

使用道具 举报

44

主题

3166

帖子

2803

银币

中流砥柱

Rank: 25

铜币
557
发表于 2022-7-6 09:27:03 | 显示全部楼层
 
BTW - Jeff, I thought your last avatar pic was awesome, but this new one is hilarious.
回复

使用道具 举报

0

主题

101

帖子

103

银币

限制会员

铜币
-2
发表于 2022-7-6 09:33:01 | 显示全部楼层
Off Topic
 
It reminds everyday to strive to be the best pimp I can be
回复

使用道具 举报

3

主题

18

帖子

15

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-6 09:36:34 | 显示全部楼层
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.
回复

使用道具 举报

3

主题

18

帖子

15

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-6 09:41:00 | 显示全部楼层
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.
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-7 06:05 , Processed in 1.156472 second(s), 72 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表