Is it possible to declare an enumeration of a given size, whose enumerators are not necessarily sequential from 0 to the top? For example, can I declare an enumeration Foo the size of an int, whose only valid values are Bar, Baz, and Qux, where Bar is represented by 1, Baz by 30, and Qux by 16?
Ah, and how does the preprocessor know not to substitute in Bar in the LHS of the macdef?> On Nov 15, 2014, at 6:59 PM, gmhwxi gmh...@gmail.com wrote:
How about:
#define Bar 1 #define Baz 30 #define Quz 16
abst@ype Foo(i:int) = int
macdef Bar = $extval (Foo(Bar), “1”)
fun
foo{i:int | i != Bar} (x: Foo(i)): void = …
On Saturday, November 15, 2014 6:50:03 PM UTC-5, Shea Levy wrote:
Ah, yes that will do. Followup question: is it possible to use Foo in existentials/constraints? Can I for example write a function that takes any Foo except Baz?
On Nov 15, 2014, at 6:43 PM, gmhwxi <gmh...@gmail.com <javascript:>> wrote:
On Saturday, November 15, 2014 6:16:58 PM UTC-5, Shea Levy wrote:
Hello,
Is it possible to declare an enumeration of a given size, whose enumerators are not necessarily sequential from 0 to the top? For example, can I declare an enumeration Foo the size of an int, whose only valid values are Bar, Baz, and Qux, where Bar is represented by 1, Baz by 30, and Qux by 16?
Ah, I should probably read up on stadef Thank you!> On Nov 15, 2014, at 7:04 PM, gmhwxi gmh...@gmail.com wrote:
Actually, I was not sure myself. I had to try it
The following style is probably better:
stadef Bar = 1 // Bar is static
abst@ype Foo(i:int) = int
macdef Bar = $extval (Foo(Bar), “1”) // Bar is dynamic
fun
foo{i:int | i != Bar} (x: Foo(i)): void = …
On Saturday, November 15, 2014 7:01:10 PM UTC-5, Shea Levy wrote:
Ah, and how does the preprocessor know not to substitute in Bar in the LHS of the macdef?
On Nov 15, 2014, at 6:59 PM, gmhwxi <gmh...@gmail.com <javascript:>> wrote:
How about:
#define Bar 1 #define Baz 30 #define Quz 16
abst@ype Foo(i:int) = int
macdef Bar = $extval (Foo(Bar), “1”)
fun
foo{i:int | i != Bar} (x: Foo(i)): void = …
On Saturday, November 15, 2014 6:50:03 PM UTC-5, Shea Levy wrote:
Ah, yes that will do. Followup question: is it possible to use Foo in existentials/constraints? Can I for example write a function that takes any Foo except Baz?
On Nov 15, 2014, at 6:43 PM, gmhwxi <gmh...@gmail.com <>> wrote:
On Saturday, November 15, 2014 6:16:58 PM UTC-5, Shea Levy wrote:
Hello,
Is it possible to declare an enumeration of a given size, whose enumerators are not necessarily sequential from 0 to the top? For example, can I declare an enumeration Foo the size of an int, whose only valid values are Bar, Baz, and Qux, where Bar is represented by 1, Baz by 30, and Qux by 16?
Ah, yes that will do. Followup question: is it possible to use Foo in existentials/constraints? Can I for example write a function that takes any Foo except Baz?> On Nov 15, 2014, at 6:43 PM, gmhwxi gmh...@gmail.com wrote:
On Saturday, November 15, 2014 6:16:58 PM UTC-5, Shea Levy wrote:
Hello,
Is it possible to declare an enumeration of a given size, whose enumerators are not necessarily sequential from 0 to the top? For example, can I declare an enumeration Foo the size of an int, whose only valid values are Bar, Baz, and Qux, where Bar is represented by 1, Baz by 30, and Qux by 16?
macdef Bar = $extval (Foo(Bar), “1”) // Bar is dynamic
fun
foo{i:int | i != Bar} (x: Foo(i)): void = …On Saturday, November 15, 2014 7:01:10 PM UTC-5, Shea Levy wrote:
Ah, and how does the preprocessor know not to substitute in Bar in the LHS
of the macdef?
On Nov 15, 2014, at 6:59 PM, gmhwxi <gmh...@gmail.com <javascript:>> wrote:
How about:
#define Bar 1 #define Baz 30 #define Quz 16
abst@ype Foo(i:int) = int
macdef Bar = $extval (Foo(Bar), “1”)
fun
foo{i:int | i != Bar} (x: Foo(i)): void = …
On Saturday, November 15, 2014 6:50:03 PM UTC-5, Shea Levy wrote:
Ah, yes that will do. Followup question: is it possible to use Foo in
existentials/constraints? Can I for example write a function that takes any
Foo except Baz?
On Saturday, November 15, 2014 6:16:58 PM UTC-5, Shea Levy wrote:
Hello,
Is it possible to declare an enumeration of a given size, whose
enumerators are not necessarily sequential from 0 to the top? For example,
can I declare an enumeration Foo the size of an int, whose only valid
values are Bar, Baz, and Qux, where Bar is represented by 1, Baz by 30, and
Qux by 16?
abst@ype Foo = int
macdef Bar = $extval (Foo, “1”)
macdef Baz = $extval (Foo, “30”)
macdef Quz = $extval (Foo, “16”)On Saturday, November 15, 2014 6:16:58 PM UTC-5, Shea Levy wrote:
Hello,
Is it possible to declare an enumeration of a given size, whose
enumerators are not necessarily sequential from 0 to the top? For example,
can I declare an enumeration Foo the size of an int, whose only valid
values are Bar, Baz, and Qux, where Bar is represented by 1, Baz by 30, and
Qux by 16?
fun
foo{i:int | i != Bar} (x: Foo(i)): void = …On Saturday, November 15, 2014 6:50:03 PM UTC-5, Shea Levy wrote:
Ah, yes that will do. Followup question: is it possible to use Foo in
existentials/constraints? Can I for example write a function that takes any
Foo except Baz?
On Nov 15, 2014, at 6:43 PM, gmhwxi <gmh...@gmail.com <javascript:>> wrote:
On Saturday, November 15, 2014 6:16:58 PM UTC-5, Shea Levy wrote:
Hello,
Is it possible to declare an enumeration of a given size, whose
enumerators are not necessarily sequential from 0 to the top? For example,
can I declare an enumeration Foo the size of an int, whose only valid
values are Bar, Baz, and Qux, where Bar is represented by 1, Baz by 30, and
Qux by 16?