Check number in a list (singul
Hello .How could I check the return number in a list ( singular or plural)?
(setq Nums '(1 2 3 4 5 6))(setq List1 (nth 0 Nums))
Thanks
has this been asked before ?
use REM
http://www.cadtutor.net/forum/showthread.php?58679-how-CAD-knows-a-number-is-singular-or-plural
You can though parse the list to remove Odd/Even
(defun OddEven (OE lst)(setq New_list (vl-remove-if-not '(lambda (i) (= (rem i 2) oe)) lst)) )
1 for odd
0 for even
(oddeven 1 nums)
(1 3 5)
(oddeven 0 nums)
(2 4 6) Thank you pBe .
But that's not what I meant buddy .
I mean how to know if the return number is singular or plural ?
1 is singular . but how to check by lisp ?
4 is plural . how to get sure of that ?
Many thanks . so i see...
(post updated).. you are pertaining to ODD/EVEN? The return of your sub-routine would give numbers in a list which is not what I looking for .
I would like to get sure if a number is singular which is hold by argument .
Thanks This is an issue that was discussed few hours ago - did you checked the link that pBe suggested?
Regards,
Mircea
I have seen that link before, and it does not meet my needs .
Many thanks . of course it does..
like this
(defun c:Test ()(setq Nums '(1 2 3 4 5 6))(foreach n nums (if (= (rem n 2) 1) (print (strcat (itoa n )" is Odd")); Am I still not clear .
(setq num (getint "\n Number :")) ;;; Enter 3
so now the argument (num) is equal to 3 . so how to know the number which is held
by the argument is singular or plural ? If you don't mean odd by "singular", respectively even by "plural", you should provide more information regarding your request. Thank you.
Regards,
Mircea
页:
[1]
2