+1 for supporting getindex for set, although maybe with a function name... get(set, x)?
On Friday, April 22, 2016 at 11:01:08 AM UTC-4, Erik Schnetter wrote: > > On Fri, Apr 22, 2016 at 8:46 AM, Tamas Papp <[email protected] > <javascript:>> wrote: > > find_string(table::Dict, string) = get!(table, string, string) > > > > table = Dict() > > > > a1 = find_string(table, "a") > > a2 = find_string(table, "a") # called w/ different string, will > return first one > > a1 === a2 # true, same string > > > > Maybe you could also use a Set, but I don't know how to get the elements > > that matches, not just test for it with `in`. > > Maybe `Set` should have a `getindex` function? > > -erik > > > Best, > > > > Tamas > > > > On Fri, Apr 22 2016, Lyndon White wrote: > > > >> @Tamas thanks > >> Can you clarify a Dict of strings to what? Ints? > >> Loose a lot of interpretablity that way. > >> > >> > >> On Friday, 22 April 2016 19:08:11 UTC+8, Tamas Papp wrote: > >>> > >>> I would be more concerned about style than speed -- symbols as strings > >>> is an ancient Lisp technique in NLP, but IMO a Dict of strings would > be > >>> better style. > >>> > >>> > >>> > > > > > > -- > Erik Schnetter <[email protected] <javascript:>> > http://www.perimeterinstitute.ca/personal/eschnetter/ >
