On Thu, Mar 10, 2011 at 5:43 PM, Robby Findler <[email protected]> wrote: > Symbols are values (just like strings, numbers, etc). Identifiers are > not values, but thigns that can be bound to values. The request below > combines the two, as if they were the same thing. > > While it is possible to do things that approximate what you want, most
Oops-- "you want" should really have been "you ask"! > programming problems can be solved without them (and they often bring > in complexity that you don't really want to deal with). > > How about using a hash table instead? You can say: > > (define my-hash (make-hash)) > > and then when you would have written > > (set! number3 3) > > you isntead write > > (hash-set! 'number3 3) > > and this will also work: > > (hash-set! (string->symbol (format "number~a" 3)) 3) > > And when you would have said > > number3 > > to get the current value bound to that identifier, you instead say: > > (hash-ref my-hash 'number3) > > hth, > Robby > > On Thu, Mar 10, 2011 at 5:28 PM, Brian Moriarty <[email protected]> wrote: >> Hello! I'm new to Scheme/Racket, and have a quick question. >> >> Is there any way to assign an arbitrary value to a symbol created with >> string->symbol? >> >> I want to do the equivalent of (set! (string-symbol "number3") 3). >> >> That is, I want the symbol number3 to evaluate to 3. >> >> Thanks in advance for advice! >> >> - prof >> >> >> >> _________________________________________________ >> For list-related administrative tasks: >> http://lists.racket-lang.org/listinfo/users >> > _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

