乐筑天下

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

[编程交流] Lisp: Extract highest/lowest v

[复制链接]

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 15:56:36 | 显示全部楼层
 
I'm not sure if there is a straight-forward function to detect this... I would be inclined to make a comparison between every item in the list and make a list of items already "viewed".
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 16:00:45 | 显示全部楼层
Perhaps something like this:
 
  1. (defun getrep (alist) (foreach x alist   (if (member x nlist)     (setq dlist (cons x dlist))     (setq nlist (cons x nlist)))) dlist)(defun c:test () (alert (vl-princ-to-string (getrep '(a b c c d e f f g)))) (princ))
回复

使用道具 举报

14

主题

71

帖子

16

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
119
发表于 2022-7-6 16:03:59 | 显示全部楼层
another way:
(eval(cons 'max a))
(eval(cons 'min a))
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 16:12:12 | 显示全部楼层
If you sort the list then items the same will be next to each other so you can do things like count them up or delete duplicates.
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-4 19:40 , Processed in 0.516190 second(s), 58 queries .

© 2020-2025 乐筑天下

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