Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lisp Routine 1

Status
Not open for further replies.

tendai1

Structural
Mar 29, 2003
24
Given a variable defined as (setq a '(-10 -20 10 20))
Can you help me to find the Max or Min of a (i.e. using the variable a). I would appreaciate anything other than (max -10 -20 10 20).
 
Replies continue below

Recommended for you

(apply 'max a) where is set to your list
'(-10 -20 10 20). Cheers.
 
This should be the post......

(apply 'max a) where 'a' is set to your list
'(-10 -20 10 20). Cheers.....
 
Thanks it worked well, is there a command which can sort numbers i.e. (min - - - - - max) just like we can sort letters alphabetically.
 
For sorting numbers in Acad2000 and above, you can use
the following: (vl-sort x '<) where 'x' is the list of
numbers you want sorted from min to max.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor