Re: Suggestions for ESL (was: Euphoria Standard Library on UBoard)

new topic     » goto parent     » topic index » view thread      » older message » newer message

D. Newhall wrote:
> 
> Pete Lomax wrote:
> > 
> > On Sun, 24 Jul 2005 08:45:05 -0700, Tommy Carlier
> > <guest at RapidEuphoria.com> wrote:
> > 
> > >> >   }}}
<eucode>
> > >> >   constant DAY_OF_WEEK = enum()
> > >> >   constant MONDAY = next(DAY_OF_WEEK),
> <font color="#330033">> <font color=</font><font
> color="#00A033">"#330033"</font><font color="#330033">>>>
> </eucode>
{{{
</font></font></font>
> > 
> > FWIW I'd prefer
> > }}}
<eucode>
> > constant DAY_OF_WEEK = create_enum()
> > constant MONDAY = enum(DAY_OF_WEEK)
> <font color="#330033">> <font color=</font><font
> color="#00A033">"#330033"</font><font color="#330033">></eucode>
{{{
</font></font>
> I prefer Pete's version over Tommy's however I think enum_begin(start_value,
> step_value)
> and enum() is better because you're not so much creating an enum but instead
> starting
> one.
> 


global atom enumerate
global function enum(atom a)
  if a then
    enumerate = a
    retun a
  else  
    return enumerate += 1
  end if
end function

-- set initial value
enumerate = 0

constant
  const1 = enum(0), -- increment by one
  const1 = enum(0),
  const1 = enum(0),
  const1 = enum(10), -- skip 4-9 set enumerate to 10
  const1 = enum(0)   -- now 11


Bernie

My files in archive:
w32engin.ew mixedlib.e eu_engin.e win32eru.exw

Can be downloaded here:
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu