1. enum suggestion
- Posted by petelomax Feb 20, 2011
- 1406 views
I wondered if anyone else thought this was a good idea:
enum xx_one, xx_two, xx_max=$ ?xx_one ?xx_two ?xx_max
should print 1 2 2
Pete
2. Re: enum suggestion
- Posted by DerekParnell (admin) Feb 20, 2011
- 1378 views
I wondered if anyone else thought this was a good idea:
enum xx_one, xx_two, xx_max=$ ?xx_one ?xx_two ?xx_max
should print 1 2 2
Pete
Something like this has been discussed. I think what we will eventually come up with are various 'properties' of an enum. Something along the lines of ...
enum as xx A = 5, B = 1, C = -1, D = 3 ? xx:A ? xx:B ? xx.max ? xx.min ? xx.range ? xx.last ? xx.first ? xx.count
And this should print as 5 1 5 -1 7 3 5 4
However, much more discussion is required before anything further like this will be implemented.
3. Re: enum suggestion
- Posted by irv Feb 24, 2011
- 1331 views
An interesting version in another language:
enum field as name, addr, city, state
Used as in Euphoria, as a substitute for structures, but also 'reversible', so that field[1] returns 'name'.
This has some uses.
4. Re: enum suggestion
- Posted by mattlewis (admin) Feb 24, 2011
- 1313 views
An interesting version in another language:
enum field as name, addr, city, state
Used as in Euphoria, as a substitute for structures, but also 'reversible', so that field[1] returns 'name'.
This has some uses.
Yes, I like that. It should be pretty easy to implement, too.
You'd basically end up with a constant named field, so that your code would be equivalent to:
constant field = {"name", "addr", "city", "state"} enum name, addr, city, state
Although that sort of implementation wouldn't work as well for sparse or non-integral enums.
Matt