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>

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