Re: [?] Adding my own function to clojure.core namespace

2018-02-24 Thread Andy Fingerhut
I would echo the question "is it truly a good idea?" You can do it, but typing a single :require clause in an ns form once, and then copying and pasting to other places that you use functions defined in that namespace, is likely to be less time-consuming in the long run. Andy On Sat, Feb 24,

Re: [?] Adding my own function to clojure.core namespace

2018-02-24 Thread Mikhail Gusarov
Hello Philos, It's no different to adding a function to any other namespace: % clj Clojure 1.9.0 user=> (ns clojure.core) nil clojure.core=> (defn foobar [x] (str "foobar " x)) #'clojure.core/foobar clojure.core=> (ns user) nil user=> (foobar "12") "foobar 12" user=> foobar

[?] Adding my own function to clojure.core namespace

2018-02-24 Thread Philos Kim
Is there any way to add my own function to clojure.core namespace? Because I want to use that function globally without 'require' or 'use'. Thanks in advance. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to

[?] Adding my own function to clojure.core nanespace

2018-02-24 Thread Philos Kim
Is there any way to add my own function to clojutr.core namespace? Because I want to use that function without 'require' or 'use'. -- 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

Re: transients problem

2018-02-24 Thread Didier
> > Most of the time when people call seq on a set or map they want to iterate > over it, and that's fine. Right, I guess I meant insertion order. Though, is it not true that conceptually, two implementations of IPersistentSet would not need to return elements in the same order? Even to the

Re: transients problem

2018-02-24 Thread Timothy Baldridge
>> If it happens to work, it is accidental, and should not be relied on. Yes, and no. The actual order may change between Clojure releases (last time it changed was with 1.6), or between two equal collections, but the ordering will not change between two calls to `seq` on the same instance of a

Re: transients problem

2018-02-24 Thread Christophe Grand
This makes me think that transients could (should?) be made reducible. On Sat, Feb 24, 2018 at 4:19 PM, Timothy Baldridge wrote: > Yes, transients mutate when updated. Seqs over sets are a immutable view > over a collection. So if someone did get this to work, the

Re: transients problem

2018-02-24 Thread Didier
> > is there a way round it? > Something else I need to point out is that you really should not use a Set for order. Sets are specifically unordered, and provide no guarantees of order. Try calling first, second and last on #{1 2 3} for example, you'll probably get things back in a different

Re: transients problem

2018-02-24 Thread Didier
Clojure tends to blur the lines between its different types of collections and sequences, because of how most functions often know how to work with all of them and others will coerce them automatically from one type to another. This makes it that 99% of the time, everything just works like

Re: [ANN] shopify-clj

2018-02-24 Thread Peter Wen
Hi James, do you still work at Shopify? Looking at this clj-library. On Wednesday, March 13, 2013 at 10:09:25 PM UTC-4, James MacAulay wrote: > > I work at Shopify and this has been my weekend > project for a little while now: > >

Re: transients problem

2018-02-24 Thread Timothy Baldridge
Yes, transients mutate when updated. Seqs over sets are a immutable view over a collection. So if someone did get this to work, the implementation could be incorrect. And you could get something really strange like this: (def s (transient #{1 2})) (def sq (seq s)) (first sq) => 1 (disj s 1)

transients problem

2018-02-24 Thread 'Alan Forrester' via Clojure
Calling (first #{1}) gives the result 1. Calling (first (transient #{1})) gives an error: “IllegalArgumentException Don't know how to create ISeq from: clojure.lang.PersistentHashSet$TransientHashSet clojure.lang.RT.seqFrom (RT.java:550)” Is this behaviour intended? And whether or not this