Hello,

2009/3/6 Ilya Sergey <ilyas...@gmail.com>

>
> Hello.
>
> Look at last plugin version. I've changed rules for indentation and
> alignment in Clojure files. Now all forms inside function call are
> aligned by its _second_ elemnt, i. e. first argument as in the
> following example:
>
> (defn select-keys
>  "Returns a map containing only those entries in map whose key is in
> keys"
>  [map keyseq]
>  (loop [ret {} keys (seq keyseq)]
>        (if keys
>            (let [entry (. clojure.lang.RT (find map (first keys)))]
>                 (recur
>                   (if entry
>                       (conj ret entry)
>                       ret)
>                   (rest keys)))
>            ret)))


In conventional clojure formatting (if such a statement can be made for
clojure), shouldn't the if following the loop be indented just 2 spaces
deeper than loop ? (same question for the let after the if, and the recur
after the let ?

?

Regards,

-- 
Laurent

>
>
> So, all argument forms in function call are aligned. If first element
> of a list is not symbol, then alignment is performed by its offset:
>
> (defn str
>  "With no args, returns the empty string. With one arg x, returns
>  x.toString().  (str nil) returns the empty string. With more than
>  one arg, returns the concatenation of the str values of the args."
>  {:tag String}
>  ([] "")
>  ([#^Object x]
>   (if (nil? x) "" (. x (toString))))
>  ([x & ys]
>   ((fn [#^StringBuilder sb more]
>        (if more
>            (recur (. sb (append (str (first more)))) (rest more))
>            (str sb)))
>    (new StringBuilder #^String (str x)) ys)))
>
>
> With best regards,
> Ilya
> - Afficher le texte des messages précédents -
>
> On Mar 2, 2:05 am, Asbjørn  Bjørnstad <asbj...@gmail.com> wrote:
> > I'm not an Intellij user, but:
> >
> > On Mar 2, 2:22 am, CuppoJava <patrickli_2...@hotmail.com> wrote:
> >
> > > After using La Clojure a bit more, I noticed a few minor issues with
> > > the indentation system.
> >
> > > Inside a let form binding, the next line should be indented to one
> > > character past the opening bracket.
> >
> > > eg. should be like:
> > > (let [i "hi"
> > >       j "hi"])
> > > where j lines up with i.
> >
> > Agree on this.
> >
> > > Also
> > > Nested forms, IMO, should be indented to be two spaces past the last
> > > opening parenthesis.
> >
> > > eg. should be like:
> > > (let [i (fn [a]
> > >             (println a))]
> >
> > That's three spaces...
> >
> > I'd say use the common indentation rules, which I thought was on space
> > past the last opening parenthesis. But I just looked at one of the
> > source files, and it's not consistent.
> >
> > When a pretty-printer is in place, I guess that could become the
> > definition of the indentation rules.
> > --
> >   -asbjxrn
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to