1. Re: Variable naming in Euphoria

>
> I've asked for this several times, i do this a lot in mirc,
> it's really handy at times. You'd
> think an interpreted  LISPy language could do this inately.
> But what you can do to get
> around this lack in Eu by using two sequences, one to hold
> the new name you have
> made, and one to hold it's value. It works, but it does get
> slow with lots of lookups.
>
> pseudocode:
> nameseq = {"myVar1","nickaddy","phonenum.12"}
> dataseq = {"45.6789","ChanServ!wizard at sorcery.net","305-234-0987"}
>
> The location of the name in nameseq = the location in dataseq
> of the value of that var.
>
> function GetVarVal(sequence WhatiLookFor)
> for loop = 1 to length(nameseq) do
>  if ( nameseq[loop] = WhatiLookFor ) then
>   return dataseq[loop]
>  end if
> end for
>

D'oh!  I even use this method in my matheval code (which I've even been
working on some lately)!  I use it to store user variables (it's a math lib,
of course), but they can represent all kinds of neat stuff.  I think Jiri
posted an associative lists lib somewhere...

Matt

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu