Re: Why isn't there a fold-right?

2010-11-07 Thread Yang Dong
If that's the case, I can accept it. Thank you guys :) On Nov 8, 2:18 am, "nicolas.o...@gmail.com" wrote: > On Sun, Nov 7, 2010 at 3:28 PM, iko...@gmail.com wrote: > > 2010/11/7 David Sletten > > >> Or for those of you who prefer that other people won't be able to read > >> your code: > >> (def

Why isn't there a fold-right?

2010-11-05 Thread Yang Dong
Maybe because Clojure has a vector, and conj conjoins new elements to the end of the vector, so there's mere little use of fold-right. But, fold-right is an abstraction tool, missing it in the core is kind of pity. -- You received this message because you are subscribed to the Google Groups "Cloj

Re: Question about `binding'

2010-09-05 Thread Yang Dong
substitute the functions in other namespaces. On Sep 4, 9:22 pm, CuppoJava wrote: > Your original understanding is correct. Your first example is not > working the way you expect it because Clojure is inlining "inc" for > speed purposes. > > Hope that helps >  -Patri

Question about `binding'

2010-09-04 Thread Yang Dong
(binding [inc dec] (println (inc 1))) ;=> 2 If I put a declare on top of it, (declare inc) (binding [inc dec] (println (inc 1))) ;=> 0 Originally I thought binding is equal to thread local dynamic binding. Seems I was wrong. It seems like it has something to do with namespaces. Right? --

Re: What is #_

2010-08-04 Thread Yang Dong
Thank you, that really helps! On Aug 4, 1:38 pm, Meikel Brandmeyer wrote: > Hi, > > On Aug 4, 2:32 am, Yang Dong wrote: > > > Thank you! I have just another question not related about this topic: > > > ;during bootstrap we don't have destructuring let, loo

Re: What is #_

2010-08-03 Thread Yang Dong
the preceding definition of let taks the strange argument of `&form' and `&env'. What are they? On Aug 4, 3:35 am, Meikel Brandmeyer wrote: > Hi, > > Am 03.08.2010 um 16:45 schrieb Yang Dong: > > > I've read the src of core.clj of Clojure 1.1.0. Original

What is #_

2010-08-03 Thread Yang Dong
Hi, I've read the src of core.clj of Clojure 1.1.0. Originally I thought the meaning of #_ is to comment the thing after it, sort of like `;'. But the in the src of core.clj in 1.2.0-RC1. The definition of reduce is overrided to use the internal-reduce function. The defn line, is preceded by `#_'.

Re: setting classpath and using namespace: how to enable example scripts in library?

2010-08-02 Thread Yang Dong
Sorry don't know the liebke's cljr repl. But I'd like to show the clojure 1.2 script I used to generate a `run.bat'. (I'm using windows) == (ns genrun (:use [clojure.java.io :only (file)]) (:use [clojure.contrib.str-utils :only (str-join)])) (def target-file

Re: Evaluated or not -- unquote in syntax-quote/backquote

2010-07-15 Thread Yang Dong
Thank you very much! On Jul 14, 8:06 pm, Meikel Brandmeyer wrote: > Hi, > > On Jul 14, 4:30 am, Yang Dong wrote: > > > `body' on the 5th line is not evaluted when the macro got expanded, > > but the `mapcar' on the 2nd line is evaluated. > > No. Both

Evaluated or not -- unquote in syntax-quote/backquote

2010-07-14 Thread Yang Dong
Hi, all It seems Lisp macro expander will not evalute the argument prefixed by unquote. The following code, written in Common Lisp, is an excerpt from `On Lisp'. This macro implemented `let'. 1. (defmacro our-let (binds &body body) 2. ‘((lambda ,(mapcar #’(lambda (x) 3.