Thank you Bronza...this is exactly what I meant! when using reducers 'into' is the norm isn't it? Couldn't kibit parse the ns declaration before it starts suggesting things? It seems that at least for namespaces that use core.logic or reducers kibit's suggestions will break your code! For example it keeps suggesting (zero? x) instead of (= x 0) even though in a logic program '=' & '==' do not mean the same thing as in other namespaces...

the same with 'into'. You cannot use vec with reducers as Bronza demonstrated! In general, I think kibit should check the ns declaration for symbols that have been redefined like =, == <, > etc etc..This way it can resist making suggestions about these redefined symbols...Would that be too hard to implement?

Jim

On 12/11/12 13:28, Bronsa wrote:
it is not always true that using vec is equal to using "into []"

user=> (require '[clojure.core.reducers :as r])
nil
user=> (r/map inc (range 2))
#<reducers$folder$reify__407 clojure.core.reducers$folder$reify__407@1358d955>
user=> (into [] *1)
[1 2]
user=> (vec *2)
RuntimeException Unable to convert: class clojure.core.reducers$folder$reify__407 to Object[] clojure.lang.Util.runtimeException (Util.java:170)


2012/11/12 Andreas Liljeqvist <bon...@gmail.com <mailto:bon...@gmail.com>>

    I would prefer the use of vec.

    If I am using an empty 'to' then I would always replace it with
    the type constructor.
    Feels more clean to me.
    You aren't logically taking an empty vector and filling it with
    stuff, you are converting your original coll.

    On Sun, Nov 11, 2012 at 5:04 PM, Jim - FooBar();
    <jimpil1...@gmail.com <mailto:jimpil1...@gmail.com>> wrote:

        Kibit is probably looking for syntactic patterns not for types
        or anything like that... but still, why is it suggesting this?

        Jim



        On 11/11/12 15:58, Jim - FooBar(); wrote:

            Kibit says:

            Consider using:
              (vec (:children (game-tree dir b next-level)))
            instead of:
              (into [] (:children (game-tree dir b next-level)))

            why is that?
            Does it make a difference if '(:children (game-tree dir b
            next-level))' returns a reducer?

            Jim



            On 11/11/12 15:08, Jonas wrote:

                Hi

                Today I released version 0.0.6 of Kibit[1].

                Kibit is a simple code analysis tool. The purpose of
                the tool is to tell its users that "Hey, There's
                already a function for that!". Kibit uses
                core.logic[2]  to search for patterns of code
                which can be simplified. For example, if the analyzer
                finds `(apply concat (apply map ...)` It will notify
                its user about the availability of `mapcat`.

                For this release I have split the leiningen plugin
                part of kibit of into it’s own project
                (lein-kibit[3]). This was done in order for kibit to
                be able to read tagged literals (using the Clojure 1.5
                `*default-data-reader-fn*` var).

                This release also includes several new rules
                contributed by the community -- Many thanks!

                I hope you enjoy Kibit

                Jonas

                [1] https://github.com/jonase/kibit
                [2] https://github.com/clojure/core.logic
                [3] https://github.com/jonase/lein-kibit
-- 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 <mailto:clojure@googlegroups.com>
                Note that posts from new members are moderated -
                please be patient with your first post.
                To unsubscribe from this group, send email to
                clojure+unsubscr...@googlegroups.com
                <mailto:clojure%2bunsubscr...@googlegroups.com>
                For more options, visit this group at
                http://groups.google.com/group/clojure?hl=en



-- 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
        <mailto:clojure@googlegroups.com>
        Note that posts from new members are moderated - please be
        patient with your first post.
        To unsubscribe from this group, send email to
        clojure+unsubscr...@googlegroups.com
        <mailto:clojure%2bunsubscr...@googlegroups.com>
        For more options, visit this group at
        http://groups.google.com/group/clojure?hl=en


-- 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
    <mailto:clojure@googlegroups.com>
    Note that posts from new members are moderated - please be patient
    with your first post.
    To unsubscribe from this group, send email to
    clojure+unsubscr...@googlegroups.com
    <mailto:clojure%2bunsubscr...@googlegroups.com>
    For more options, visit this group at
    http://groups.google.com/group/clojure?hl=en


--
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
Note that posts from new members are moderated - please be patient with your first post.
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

--
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
Note that posts from new members are moderated - please be patient with your 
first post.
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