Re: Namespaces

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

Kat wrote:

> I missed the definition of "a-list" somehow.

It's my shorthand for associated list. I think they originated from LISP.
Jiri has posted an implementation to the Euphoria page. The list takes for
internal form:

   { key list, value list }

and Jiri's code offers the choice between using 'find' for small lists, and
binary searches for large lists. Languages that allow it natively typically
use a notation like this for creation:

   Kat = { job:"programmer", language:"euphoria", specialty:"bots" }

and this for accessing:

   ? Kat["job"] -- returns "programmer"

Languages like Python and JavaScript allow further syntactic sugar:

   ? Kat.job -- same as Kat["job"]

They offer a lot of OOP-sort of functionality. If you want to play with
them, take a look at Py. I think they'd make an interesting addition to
Euphoria.

-- David Cuny

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

Search



Quick Links

User menu

Not signed in.

Misc Menu