Jump to content

Text Math


Lee Mac

Recommended Posts

Maybe that was a bad example for the demonstration, as this old program is really only intended to modify the numerical content in the text and does not attempt to interpret the surrounding non-numerical content.

 

But where ordinals are concerned, perhaps the following function could be of use:

(defun ordinal ( n )
   (cond ((nth (rem n 10) '(nil "st" "nd" "rd"))) ("th"))
)

_$ (ordinal 1)
"st"
_$ (ordinal 2)
"nd"
_$ (ordinal 3)
"rd"
_$ (ordinal 4)
"th"

 

I was just teasing you with your example...and I know it's hard to compensate for every possibility that arises. Interestingly enough a function to test for that is a good approach. Great idea!

Link to comment
Share on other sites

Lee,

 

love it!!!. Is there a way to select the operand?

 

Thanks

Brian

 

Thanks Brian -

 

Given how old this program is, it is unlikely that I will find time to work on it, as I would wish to rewrite the entire program... however, to suggest an alternative solution for the time being, you may find my Text Calculator program useful as this allows selection of all operands.

 

Lee

Link to comment
Share on other sites

  • 2 years later...

@hossam: What is "sours of value"? Do you mean "source"?

 

Did you read the post from 2014 immediately above yours? The author indicates he will not be making changes to the program and suggests an alternative. Please follow his advice.

Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...

hello from the future. you just saved me two weeks of work. I would like to buy you a virtual beer.

you are an amazing wizard 

🍺

Link to comment
Share on other sites

  • 6 months later...

Thanks Lee Mac, this is a great lisp. If the number is 1.25 and you add say 1.25 to it, the number becomes 2.5 rather than 2.50. Is there an easy way to keep a trailing 0?

Link to comment
Share on other sites

  • 7 months later...

This is an amazing lisp.. I uses this a lot... Thank you Lee Mac... I'm thinking if add 2 and only 1st changes to 3rd and others remains same... ie specify the number which will be operated... Is it possible?

Link to comment
Share on other sites

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...