Jump to content

how CAD knows a number is singular or plural


Recommended Posts

Posted
There's probably many more ways to do it...

 

(defun oddp ( n ) (and (member (rem n 10) '(1 3 5 7 9))))

 

But that won't work for a negative integer...

 

Besides, I'm more into keeping it short and simple. And the bitwise calculation you did was impressive!

  • Replies 21
  • Created
  • Last Reply

Top Posters In This Topic

  • LauKwokFai

    4

  • pBe

    4

  • Lee Mac

    3

  • LibertyOne

    3

Popular Days

Top Posters In This Topic

Posted

Ah yes, needs an abs in there (rem (abs n) 10) - just trying to think a little outside the box :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...