Re: passing value to functions

2011-07-28 Thread Tuba Lambanog
Alan, The macro is great (output could use a bit of formatting for readability, but, hey, I'm not complaining). Thank you very much. Tuba On Thu, Jul 28, 2011 at 10:34 PM, Alan Malloy wrote: > On Jul 28, 8:11 pm, Resty Cena wrote: > > Hi, Masanori, > > Yes, I noticed the similarity. I'm using L

Re: passing value to functions

2011-07-28 Thread Alan Malloy
On Jul 28, 8:11 pm, Resty Cena wrote: > Hi, Masanori, > Yes, I noticed the similarity. I'm using Laurent's 'manual way' for now. > I'll look at Alan's and Laurent's more concise solution in a few days. The > "manual way" is easy to debug as all I have to do is println the > intermediate results.

Re: passing value to functions

2011-07-28 Thread Resty Cena
Hi, Masanori, Yes, I noticed the similarity. I'm using Laurent's 'manual way' for now. I'll look at Alan's and Laurent's more concise solution in a few days. The "manual way" is easy to debug as all I have to do is println the intermediate results. Thanks. Tuba 2011/7/28 OGINO Masanori > Lauren

Re: passing value to functions

2011-07-28 Thread OGINO Masanori
Laurent's way and Alan's way have different surfaces, but same mean. (-> word fix-ou fix-ize) (fix-ize (fix-ou word)) You can check it using clojure.walk/macroexpand-all. user=> (macroexpand-all '(-> "labour" fix-ou fix-ize)) (fix-ize (fix-ou "labour")) Indeed you can choose only one way, I sug

Re: passing value to functions

2011-07-28 Thread Tuba Lambanog
Hi, Laurent, Your suggestion of manually piping intermediate results works. Thank you very much! Tuba On Thu, Jul 28, 2011 at 3:44 AM, Laurent PETIT wrote: > Hi, > > 2011/7/28 Tuba Lambanog > >> Hello, >> >> I'm trying to pass a variable through a series of functions, which may >> change the v

Re: passing value to functions

2011-07-28 Thread Resty Cena
Hi, Alan, I can see that your suggestion will work. The key, as I understand it, is the embedding of functions, thus: (fix-ize (fix-ou word))) which is indeed a Lisp-y way of doing things. It seems imperatively I miss elegant one-liners such as this. I'm right now close to getting Laurent's ap

Re: passing value to functions

2011-07-28 Thread Resty Cena
Hi, Thorsten, Yes, you're right, once inside a function, the function is already being applied. I mean that within the function, there's a test for whether the input variable needs to be changed or not. Sort of vacuous application if conditions are not met. Yes, an enriched facility for pattern m

Re: passing value to functions

2011-07-28 Thread Alan Malloy
On Jul 28, 12:22 pm, Thorsten Wilms wrote: > On 07/28/2011 06:34 PM, Tuba Lambanog wrote: > > > The determination of whether a called function will apply is left as a > > responsibility of the function itself, rather than the calling > > function. The motivation is that a function may be called fr

Re: passing value to functions

2011-07-28 Thread Thorsten Wilms
On 07/28/2011 06:34 PM, Tuba Lambanog wrote: The determination of whether a called function will apply is left as a responsibility of the function itself, rather than the calling function. The motivation is that a function may be called from a number of places. Perhaps there's a better way? Th

Re: passing value to functions

2011-07-28 Thread Tuba Lambanog
Hi, Thorsten, << Why, if that is the case at > all, do you want to pass an argument through functions that do not work > with it? >> The determination of whether a called function will apply is left as a responsibility of the function itself, rather than the calling function. The motivation is tha

Re: passing value to functions

2011-07-28 Thread Tuba Lambanog
I'm trying to write a spelling 'standardizer' for a language that has no standardized spelling. There are about 25 spelling rules, and a few more may be added. . The input words, streamed one at a time from a text file, go through these rules, and may change if conditions are met. To take English e

Re: passing value to functions

2011-07-28 Thread Thorsten Wilms
On 07/28/2011 11:29 AM, Tuba Lambanog wrote: I'm trying to pass a variable through a series of functions, which may change the value of the variable. However, the next function in line uses the original value, rather than the changed value. Here's a pseudo-code of what I'm doing. I think you s

Re: passing value to functions

2011-07-28 Thread Laurent PETIT
Hi, 2011/7/28 Tuba Lambanog > Hello, > > I'm trying to pass a variable through a series of functions, which may > change the value of the variable. However, the next function in line > uses the original value, rather than the changed value. Here's a > pseudo-code of what I'm doing. > > (defn pro

Re: passing value to functions

2011-07-28 Thread OGINO Masanori
http://clojure.org/state may help you to know Clojure's "value". ; AFAIK Java's string is also immutable...isn't it? -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@gmail.com -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this gr

Re: passing value to functions

2011-07-28 Thread Baishampayan Ghose
> I'm trying to pass a variable through a series of functions, which may > change the value of the variable. However, the next function in line > uses the original value, rather than the changed value. Here's a > pseudo-code of what I'm doing. > > (defn process-1 [s] > ; change value of s then retu