bug-libmatheval
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-libmatheval] "reverse alphanumerical" variables optional featur


From: Joey
Subject: Re: [bug-libmatheval] "reverse alphanumerical" variables optional feature possible?
Date: Thu, 09 Jan 2014 06:44:20 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 01/09/2014 12:25 AM, Marin Barateh wrote:
Hi, Joey,

I'm looking for a way to regard the reverse of alphanumericals as
variables, e.g 3A.
I have a possible solution, wherein i precede string literals starting
with a digit with an underscore character, but is there a more easy
option here?

If not, this may be an optional feature?  
I'm afraid there is nothing easier, even so, I'd put at least a letter
before the underscore (variables beginning with _ use to be reserved).

I'll consider to let hexadecimals as variable names, though it's very
irregular: what if at some point in the future libmatheval evolved to
use hex values?

Thanks for your feedback,

Marin

Hi Marin,

That's a good point, but unfortunately, although not common, there are header files that reserve letters followed by an underscores as well.

void evaluator_get_variables (void *evaluator, char ***names, int *count)
can not process values like 00FF00 or 0x00FF00.
In the program I'm currently working on, https://github.com/ozette/roloc, I want to be able to do this for example:
RED+00FF00
Even though 00FF00 is a value, If it were to become a variable in my case i.e _00FF00 it'd be possible to be reference it with name[n].
A find_color function in the program will then restore eventual values starting with a _ character.

I agree with hexadecimal values as var names being irregular, so maybe it's a bad idea after all..

Actually the way the program is written now, the only functions used are evaluator_create and evaluator_get_variables.
I added libmatheval for eventual future functionality, and because it's an amazing lib.
Maybe I am better off writing my own "get_variables" function because i regard to 00FF00 as a string literal instead of a actual number.

Anyhow, if libmatheval were to evolve to support hex someday it'd be fantastic.

Joey

reply via email to

[Prev in Thread] Current Thread [Next in Thread]