Greetings to all!
Code:
(setq mylist '(1 2 3 4 5 6 7 8 9))
(setq key#1 (getint "\nEnter first key number >>>>>: "))
;(setq key#2 (getint "\nEnter second key number >>>>>: "))
(setq no 0)
(repeat (length mylist)
(setq keyno (list key#1))
(setq combo (reverse (cons (nth no mylist) keyno)))
(princ combo)
(princ "\n")
(setq no (1+ no))
)
(princ)
Please improve the above code with the following conditions:
a) re-enter number if the keynumber is not in the list.
b) if the list is not in order the result should be in order. If necessary add code to re-arange the list first.
c) remove duplicate in the result.
d) ask another keynumber for the second elements. If no second keynumber entered just perform one keynumber.
Again no duplicate result.
The result of the code should be the following:
Two elements with one keynumber
Code:
(8 1)
(8 2)
(8 3)
(8 4)
(8 5)
(8 6)
(8 7)
(8 8) No duplicate
(8 9)
Number of combination:>>>> ?
Three elements with two keynumber
Code:
(8 2 1)
(8 2 2) No duplicate
(8 2 3)
(8 2 4)
(8 2 5)
(8 2 6)
(8 2 7)
(8 2 8) No duplicate
(8 2 9)
Number of combination:>>>> ?
Thank you in advance to all would contributor.
If you have any thoughts about the matter, please feel free to share it, or if you have any sample code to share about LIST .
Again thank you.
Bookmarks