Quick question on spec alpha 2

2019-04-02 Thread Alex Miller
It’s equivalent. Schemas have no “structure”. -- 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 un

Quick question on spec alpha 2

2019-04-02 Thread peterhull90
Taking the examples from the wiki , (s/def ::addr (s/schema [::street ::city ::state ::zip])) (s/def ::company-addr (s/union ::addr [::company ::suite])) Is the second line equivalent to: (s/def ::company-addr (s/sc

Re: Quick question on protocols

2013-05-10 Thread Alan Malloy
Object is a little special, yes, so it was a bad example for me to use. But the code used for deciding which protocol implementation to use is pretty straightforward .

Re: Quick question on protocols

2013-05-10 Thread David Nolen
It was my impression that extending to Object is handled as a special case - much like extend-type default in ClojureScript. On Fri, May 10, 2013 at 6:06 PM, Alan Malloy wrote: > Even when the interface and class you've extended them to are related by > inheritance? I thought the most-derived i

Re: Quick question on protocols

2013-05-10 Thread Alan Malloy
Even when the interface and class you've extended them to are related by inheritance? I thought the most-derived implementation was chosen, and only when there's a "tie" like a class that implements two unrelated interfaces, both of which have had the protocol extended to them. If it were comple

Re: Quick question on protocols

2013-05-10 Thread Stuart Sierra
When you extend a protocol to multiple Java interfaces / abstract classes, then call the methods on an instance which implements/extends more than one of those, the result is *undefined*. The problem is that this permits multiple inheritance of concrete behavior, the reason Java doesn't allow m

Re: Quick question on protocols

2013-05-09 Thread Jeroen van Dijk
Hi David, I've used protocols for the exact same purpose (Thrift unpacking, and like you (?), for convenience in Cascalog). I think it works very well and is speedier than other methods. It is also convenient when you have nested data structures and you don't want to care how to go through this ne

Quick question on protocols

2013-05-09 Thread Dave Kincaid
I've not worked with protocols much, but saw a good fit recently. However, I'm a little bit unsure about this situation. I have some Thrift objects that I'd like to be able to easily unpack into maps, so I created a protocol (defprotocol Unpackable (unpack [x])) Thrift has two main data types

Re: quick question about #'

2012-09-02 Thread Moritz Ulrich
I usually store vars to functions when developing in the REPL. The practical difference is that when you redefine `foo' in the above example, calls via the `actions' map will use the "old" function as the function itself ist stored, while after redefining `bar' calls through `actions' will use the

Re: quick question about #'

2012-09-02 Thread nicolas.o...@gmail.com
I tend to like 1 better. I do not like working with vars without a good reason. -- 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 pa

quick question about #'

2012-09-02 Thread Jim - FooBar();
Hi all, I was just wondering whether there is any particular preference between storing fns in maps via #' or simply the name of the var? example: (defn foo [a b] ...) (defn bar [c d] ...) (def actions {:act-foo foo ;;1st :act-bar #'bar}) ;;2nd I understand that the firs

Re: Quick question about str/join....

2011-01-04 Thread John Szakmeister
On Tue, Jan 4, 2011 at 8:29 PM, MiltondSilva wrote: > Again from inspection it seems the way it's implemented in contrib, > the code makes one pass. With (apply str (interpose sep coll)) you > make two, one to interpose the other to convert (seq->str). Well, interpose does return a lazy sequence,

Re: Quick question about str/join....

2011-01-04 Thread MiltondSilva
Again from inspection it seems the way it's implemented in contrib, the code makes one pass. With (apply str (interpose sep coll)) you make two, one to interpose the other to convert (seq->str). On Jan 5, 1:08 am, John Szakmeister wrote: > On Tue, Jan 4, 2011 at 8:01 PM, MiltondSilva wrote: > >

Re: Quick question about str/join....

2011-01-04 Thread John Szakmeister
On Tue, Jan 4, 2011 at 8:22 PM, Stuart Halloway wrote: > Several people had hands in that code, and the final result is all about > perf. Do not treat string.clj as a reference for idiomatic code. :-) That's what I suspected. :-) Thanks Stuart! -John -- You received this message because you

Re: Quick question about str/join....

2011-01-04 Thread Stuart Halloway
Several people had hands in that code, and the final result is all about perf. Do not treat string.clj as a reference for idiomatic code. :-) Stu > On Tue, Jan 4, 2011 at 8:01 PM, MiltondSilva wrote: >> I believe it's for performance reasons. Strings in java are immutable, >> so they use the St

Re: Quick question about str/join....

2011-01-04 Thread John Szakmeister
On Tue, Jan 4, 2011 at 8:01 PM, MiltondSilva wrote: > I believe it's for performance reasons. Strings in java are immutable, > so they use the StringBuilder(mutable) to achieve better performance. But str use StringBuilder too. Maybe it was better to avoid the extra call overhead? -John > On

Re: Quick question about str/join....

2011-01-04 Thread MiltondSilva
I believe it's for performance reasons. Strings in java are immutable, so they use the StringBuilder(mutable) to achieve better performance. On Jan 5, 12:18 am, John Szakmeister wrote: > I was looking at a commit that updated a docstring for str/join, which > enticed me to take a look at the impl

Quick question about str/join....

2011-01-04 Thread John Szakmeister
I was looking at a commit that updated a docstring for str/join, which enticed me to take a look at the implementation. I was kind of surprised to see that it wasn't: (apply str (interpose sep coll)) I'm just curious about the developer was thinking. Here's a link to the code:

Re: Quick question

2010-06-08 Thread Peter Schuller
> Yes, that answers my question. Cool :) > Sorry still a newbie to clojure and > lisps in general here. No problem. I didn't mean to imply there was anything wrong with the question as such. It's just that you mentioned specifically overflowing the stack so I thought I might be missing something

Re: Quick question

2010-06-08 Thread Allan Moore
Yes, that answers my question. Sorry still a newbie to clojure and lisps in general here. -- 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 - p

Re: Quick question

2010-06-08 Thread Peter Schuller
> Does anybody know how I can produce a sorted-set from a list without > overflowing the stack on a list of up to 20 items? I'm thinking I must be misunderstanding the question, but (apply sorted-set lst)? -- / Peter Schuller -- You received this message because you are subscribed to the Googl

Quick question

2010-06-08 Thread Allan Moore
Does anybody know how I can produce a sorted-set from a list without overflowing the stack on a list of up to 20 items? -- 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

Re: quick question about "ANN:"

2009-06-25 Thread kkw
Great - thankyou! On Jun 26, 1:59 pm, Richard Newman wrote: > > What does "ANN:" mean? > > "Announcement", I believe. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email

Re: quick question about "ANN:"

2009-06-25 Thread Richard Newman
> What does "ANN:" mean? "Announcement", I believe. --~--~-~--~~~---~--~~ 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

quick question about "ANN:"

2009-06-25 Thread kkw
Hi folks, Occasionally, I see "ANN:" in subject headers to posts here. I've tried to figure out what it means, but have failed. Searches on google haven't been too good either. What does "ANN:" mean? Kev --~--~-~--~~~---~--~~ You received this message because