On Tue, Jun 22, 2010 at 4:42 PM, rob levy wrote:
> user=> (ns utils)
> utils=> (ns-unmap 'utils 'cond)
> utils=> (defmacro cond [& body] `(clojure.core/cond ~@(apply concat body)))
> #'utils/cond
> utils=> (macroexpand-1 '(cond (false "false") (true "true")))
> (clojure.core/cond false "false" tru
user=> (ns utils)
utils=> (ns-unmap 'utils 'cond)
utils=> (defmacro cond [& body] `(clojure.core/cond ~@(apply concat body)))
#'utils/cond
utils=> (macroexpand-1 '(cond (false "false") (true "true")))
(clojure.core/cond false "false" true "true")
utils=> (cond
(false "false")
I think I'm going to take this route. The style seems pretty common in
clojure contrib and it's readable, if a bit odd at first.
On Jun 22, 2:20 pm, David Powell wrote:
> I tend to write the condition and action on separate lines, and put a
> blank comment in between each, like this:
--
You rec
2010/6/22 Stefan Kamphausen :
> The indentation Emacs chooses when hitting M-q on an opening paren (or
> when indenting a region using some other magic) is law in my opinion.
emacs bending your mind as nauseum :-)
--
You received this message because you are subscribed to the Google
Groups "Cloj
Hi,
On 22 Jun., 22:27, cageface wrote:
> Picky syntax question:
>[...]
I don't consider this picky. Many of Clojures differences to older
lisps are well-grounded. To me the removal of extra parens in cond is
not. During my time with Clojure I experienced this as a little
nuisance. Little bec
> (cond
>(even? a) a ;if a is even return a
>(> a 7) (/ a 2) ;else if a is bigger than 7 return a/2
>(< a 5) (- a 1) ;else if a is smaller than 5 return a-1
>t 17)
I tend to write the condition and action on separate lines, and put a
blank comment in between each, like
On Jun 22, 2010, at 3:55 PM, cageface wrote:
> This looks nice but requires more hand-indenting, right? I really like
> being able to select a block in emacs and hit indent-region and get
> predictably tidy code. (The failure of emacs to do this 100% with
> scala code is a pet peeve).
Can't help
This looks nice but requires more hand-indenting, right? I really like
being able to select a block in emacs and hit indent-region and get
predictably tidy code. (The failure of emacs to do this 100% with
scala code is a pet peeve).
On Jun 22, 1:50 pm, Michael Gardner wrote:
> Try this:
>
> (defn
This is fine when you just have simple clauses like this, but what if
the clauses are more complex, even containing subclauses?
A quick scan through clojure contrib suggest that people are inserting
blank lines between clauses when they get more complex. I guess this
is idiomatic for clojure?
On
On Jun 22, 2010, at 3:27 PM, cageface wrote:
> In this case it takes some visual parsing to see what the predicates
> and results are and if you break them up onto individual lines you
> have to count evens to figure out what the results are. The extra
> level of indentation in the CL case makes i
On Tue, Jun 22, 2010 at 4:27 PM, cageface wrote:
>
> Any thoughts on this or other approaches?
(defn compare-row [a b]
;; compare null rows as > to advance
cursor
(cond
(and (nil? a) (nil? b)) [0,0]
(and (nil? a) (not= b nil)) [1, 0]
(and (not= a nil) (nil? b)) [-1, 0]
tru
Actually, being a common-lisper I end up re-keying my clojure
cond expressions every time. Either I end up putting the extra
levels of parens or I forget to properly "even-count".
Emacs paren-bouncing makes it easy to syntax check a common
lisp cond but fails badly with clojure cond. Emacs doesn'
Picky syntax question:
In common lisp cond requires more parenthesization than clojure:
(cond
((evenp a) a);if a is even return a
((> a 7) (/ a 2));else if a is bigger than 7 return a/2
((< a 5) (- a 1));else if a is smaller than 5 return a-1
(t 17))
vs clojure:
(con
13 matches
Mail list logo