LibertyOne Posted October 15, 2014 Posted October 15, 2014 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! Quote
BrianTFC Posted October 17, 2014 Posted October 17, 2014 Lee, love it!!!. Is there a way to select the operand? Thanks Brian Quote
Lee Mac Posted October 17, 2014 Author Posted October 17, 2014 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 Quote
hossambasuney Posted November 29, 2016 Posted November 29, 2016 why dont delete sours of value and write new value only:):) Quote
ReMark Posted November 29, 2016 Posted November 29, 2016 @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. Quote
Ste1978 Posted December 29, 2017 Posted December 29, 2017 EDIT - NEVER MIND it works. Thanks for this. Quote
yannicktysl Posted March 14, 2019 Posted March 14, 2019 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 Quote
Organic Posted October 3, 2019 Posted October 3, 2019 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? Quote
Speedster2 Posted May 27, 2020 Posted May 27, 2020 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? Quote
Recommended Posts
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.