Re: How to forward-declare deftypes

2016-04-21 Thread JvJ
What I ended up doing was forward-declaring a wrapper to the constructor of the later class. I actually am implementing a protocol, but the concrete types representing the persistent and transient versions need to reference each other. Also, I'm using deftype over defrecord because I want the

Re: Incanter 1.9 and Clojure 1.7

2016-04-21 Thread myriam abramson
I am running exactly the code in the example given in (doc principal-components). On Wed, Apr 20, 2016 at 11:46 AM, Bruce Durling wrote: > Myriam, > > Would you check with the latest commit on the develop branch please? > We're trying to get a new SNAPSHOT release out that

Re: How to forward-declare deftypes

2016-04-21 Thread Timothy Baldridge
Few things to consider: code against protocols where possible (removes the need to forward declare methods). Forward declare the constructor functions: (declare ->Foo) ... (defn some-code [] (->Foo 1 2)) (defrecord Foo [x y]) If you need to do type checks check for a protocol instead.

Re: How to forward-declare deftypes

2016-04-21 Thread Sean Corfield
Pretty sure Michal Marczyk mentioned this in his Clojure/West talk last week: https://www.youtube.com/watch?v=vZtkqDIicqI=14=PLZdCLR02grLq4e8-1P2JNHBKUOLFTX3kb (I don’t remember exactly what he said was the workaround) Sean Corfield -- (904) 302-SEAN An Architect's View --

How to forward-declare deftypes

2016-04-21 Thread JvJ
I'm working with two deftypes that I want to be able to references each other. (They're persistent and transient implementations of the same collection.) So far, it seems that the normal clojure.core/declare doesn't work in this case. Is there another way to do it? Thanks -- You received

Re: Are strings vectors? Should 'get' docstring be changed?

2016-04-21 Thread Mars0i
On Thursday, April 21, 2016 at 2:20:11 PM UTC-5, Mars0i wrote: > The behavior with strings is simply undocumented anywhere, afaik, though. > Sorry, that was wrong even before I added an example to clojure.docs. The conj.io documentation is quite explicit and detailed. -- You received this

Re: Are strings vectors? Should 'get' docstring be changed?

2016-04-21 Thread Alex Miller
Strings are indexed. They are a special case because String is a Java final class that cannot be "extended" to support the core interfaces inside Clojure's Java implementation. If Clojure were itself protocol-based (like ClojureScript is), the protocol could cover this without the special case.

Re: Are strings vectors? Should 'get' docstring be changed?

2016-04-21 Thread Mars0i
On Thursday, April 21, 2016 at 11:49:16 AM UTC-5, Andy Fingerhut wrote: > > Most doc strings are considered terse by many people. This appears to be > considered a feature by those who maintain Clojure, not a bug, with one > reason given by Stuart Halloway in his recent talk on using the

Re: Are strings vectors? Should 'get' docstring be changed?

2016-04-21 Thread adrian . medina
That's a good point, but it should be noted that all collections for which clojure.core/counted? returns true (they implement clojure.lang.Counted) should implement count in constant time. So the design of the Counted interface was clearly intended to provide consumers a soft guarantee of

Re: Are strings vectors? Should 'get' docstring be changed?

2016-04-21 Thread adrian . medina
That's a good point, but it should be noted that all collections for which clojure.core/counted? returns true (they implement clojure.lang.Counted) should implement count in constant time. So the design of the Counted interface was clearly intended to provide consumers a soft guarantee of

Re: Are strings vectors? Should 'get' docstring be changed?

2016-04-21 Thread Michael Gardner
On Apr 21, 2016, at 10:04, James Reeves wrote: > > Clojure seems to avoid having functions that have variable performance > depending on the data structure they're applied to. But not always! (e.g. count) -- You received this message because you are subscribed to the

Re: Are strings vectors? Should 'get' docstring be changed?

2016-04-21 Thread James Reeves
It doesn't necessarily follow that something that works with clojure.core/get needs to work with clojure.core/assoc. You can have an object that implements ILookup but not Associative, for instance. The problem with using assoc with native JVM data structures like strings and arrays is that there

Re: Are strings vectors? Should 'get' docstring be changed?

2016-04-21 Thread Andy Fingerhut
This is a special case behavior of clojure.core/get, as you can see in the RT.java source file at these lines: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L750-L755 I have no idea if a JIRA would be accepted for any change on this or not, but if one was, I suspect

Are strings vectors? Should 'get' docstring be changed?

2016-04-21 Thread Mars0i
The docstring for 'get' says nothing explicit about vectors ("Returns the value mapped to key, not-found or nil if key not present.") but most of us know that vectors can be viewed as associative data structures where indexes are like keys: (get [\a \b \c] 1) \b 'get' also works on strings:

Re: Memory Locality - Maps vs. Vectors vs. Transient Maps & Vectors

2016-04-21 Thread Plínio Balduino
So, as Andy pointed, transients would do the trick for you. And maybe type hints could also help but, as Stuart said, benchmark it all the way down. Regards Plinio On Wednesday, April 20, 2016, JvJ wrote: > I don't think I'll go with primitive arrays. A big part of the

Contract - 3 Months - Clojure/Clojurescript/Reagent - London

2016-04-21 Thread alex
Morning, I have just had a 3 month contract come up for a Clojure/Clojurescript/Reagent engineer here in London. Working for a top Clojure house! Drop me a line for more info or if you are interested! a...@functionalworks.com thanks, Alex -- You received this message because you are