Re: Noobie needs help

2011-07-14 Thread Alan Malloy
For what it's worth, Giancarlo makes a good (though vague) point when recommending maps. You rarely (but not never!) want to def something programmatically: defs are for things you as the programmer want to give names to and have access to directly in source code. Often, this sort of "define a bunc

Re: Noobie needs help

2011-07-14 Thread Resty Cena
That works! Awesome! On Thu, Jul 14, 2011 at 5:17 AM, Jonathan Fischer Friberg < odysso...@gmail.com> wrote: > I see I misunderstood the question, sorry about that. > > What you want is a macro: > > (defmacro string-maker [string-name the-string] > `(def ~(symbol string-name) ~the-string)) > >

Re: Noobie needs help

2011-07-14 Thread Jonathan Fischer Friberg
I see I misunderstood the question, sorry about that. What you want is a macro: (defmacro string-maker [string-name the-string] `(def ~(symbol string-name) ~the-string)) Jonathan On Thu, Jul 14, 2011 at 1:13 PM, Giancarlo Angulo wrote: > Please look at this: > http://clojure.org/data_structu

Re: Noobie needs help

2011-07-14 Thread Jonathan Fischer Friberg
def defines a global binding (i.e. you can reach the symbol from everywhere). defn does the same thing, but always binds the symbol to a function. Therefore, you only need either def OR defn. (defn string-maker [the-string] (str the-string)) OR (def string-maker (fn [the-string] (str the-stri

Re: Noobie needs help

2011-07-14 Thread Giancarlo Angulo
Please look at this: http://clojure.org/data_structures see maps. Giancarlo Angulo -|-^_^X@^_^,=|+^_^X~_~@- On Thu, Jul 14, 2011 at 2:41 PM, Tuba Lambanog wrote: > H

Noobie needs help

2011-07-14 Thread Tuba Lambanog
Hello, Total noobie here. I'm trying to create a sort of a string maker function. Something like: (defn string-maker [string-name the-string] (def string-name (str the-string))) so that I can call the function like so: (string-maker "friend" "Peter") which I expect to give me the variable: