Re: what does (seq) in zipmap do?

2016-11-30 Thread Alex Miller
keys and vals could be any kind of collection. Calling seq will return either nil or a seq with at least one value. By forcing empty collections to nil allows the (and ks vs) to work. That is if keys is [] and vals is [1], then: (and keys vals) is [1] (a truthy value) But (seq []) is nil and (

Re: what does (seq) in zipmap do?

2016-11-29 Thread Andy Fingerhut
I can't answer for the author, but the answer you gave would be a good sufficient reason to call seq in those places, yes? If you create a function zipmap2 that is identical to zipmap, except it does not have any calls to seq, you get these results: user=> (zipmap [] [1]) {} user=> (zipmap2 []

what does (seq) in zipmap do?

2016-11-29 Thread larry google groups
I apologize for this question, because I think it has been asked before, and yet I can not find the answer. In the definition of zipmap, what do these 2 lines do? ks (seq keys) vs (seq vals) In particular, what is (seq) doing? Is this to ensure that ks is false if "keys" is empty? And vs is f