Re: (= (list {'a 42}) '({'a 42})) => false ???

2015-09-26 Thread Lars Andersen
You can see it if you read: user=> (read-string "(= (list {'a 42}) '({'a 42}))") ;;=> (= (list {(quote a) 42}) (quote ({(quote a) 42}))) If you remove it: user=> (= (list {'a 42}) '({a 42})) ;;=> true On Saturday, September 26, 2015 at 3:12:44 PM UTC+2, Chris Cornelison wrote: > > Anyone know

Re: list all functions in namespace?

2014-04-04 Thread Mars0i
(doc dir) - clojure.repl/dir ([nsname]) Macro Prints a sorted directory of public vars in a namespace On Friday, April 4, 2014 6:53:54 PM UTC-5, Christopher Howard wrote: > > Is there some trick Clojure command to list all functions defined in a > namespace? > -- You

Re: list all functions in namespace?

2014-04-04 Thread guns
On Fri 4 Apr 2014 at 03:53:54PM -0800, Christopher Howard wrote: > Is there some trick Clojure command to list all functions defined in a > namespace? I use these functions to create cheatsheets on the fly: (defn fn-var? [v] (let [f @v] (or (contains? (meta v) :arglists) (fn? f)

Re: list all functions in namespace?

2014-04-04 Thread Stephen Gilardi
On Apr 4, 2014, at 7:53 PM, Christopher Howard wrote: > Is there some trick Clojure command to list all functions defined in a > namespace? http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/ns-publics is a good start. --Steve -- You received this message because you are su

Re: list* not returning a list

2013-01-04 Thread Michał Marczyk
Hey, I replied in the ticket with some comments. The main issue I see is that I'm used to the notion that IPersistentLists are things which are not lazy and which have next/rest parts which are themselves IPLs and this approach seems to cause that no longer to be the case. If it were not to be the

Re: list* not returning a list

2013-01-04 Thread Marek Šrank
I found CLJ-1060 [1] and added there a patch with Cons implementing IPersistentList and (apply list args) in one-argument case of list*. Marek [1] http://dev.clojure.org/jira/browse/CLJ-1060 On Wednesday, December 26, 2012 9:35:25 PM UTC+1, Marek Šrank wrote: > > function list* doesn't return

Re: list* not returning a list

2012-12-27 Thread Michał Marczyk
On 27 December 2012 18:52, Ben Wolfson wrote: > On Thu, Dec 27, 2012 at 9:08 AM, Michał Marczyk > wrote: >> On 27 December 2012 03:28, Tom Jack wrote: >>> It looks like the only thing missing to make Cons implement IPersistentList >>> is IPersistentStack. Why not implement it? >> >> IPersistentS

Re: list* not returning a list

2012-12-27 Thread Marek Šrank
Making Cons implement IPersistentList will solve all cases except when list* gets only one argument. This is problematic. The source looks like this: (defn list* "Creates a new list containing the items prepended to the rest, the last of which will be treated as a sequence." {:added "1.0"

Re: list* not returning a list

2012-12-27 Thread Ben Wolfson
On Thu, Dec 27, 2012 at 9:08 AM, Michał Marczyk wrote: > On 27 December 2012 03:28, Tom Jack wrote: >> It looks like the only thing missing to make Cons implement IPersistentList >> is IPersistentStack. Why not implement it? > > IPersistentStack extends IPersistentCollection, which includes > cou

Re: list* not returning a list

2012-12-27 Thread Michał Marczyk
On 27 December 2012 03:28, Tom Jack wrote: > It looks like the only thing missing to make Cons implement IPersistentList > is IPersistentStack. Why not implement it? IPersistentStack extends IPersistentCollection, which includes count(), so that's no go for Cons (the rest part might be a lazy seq

Re: list* not returning a list

2012-12-27 Thread Ben Wolfson
On Wed, Dec 26, 2012 at 6:28 PM, Tom Jack wrote: > A small bug in ClojureScript was related to this: > https://github.com/clojure/clojurescript/commit/88b36c177ebd1bb49dbd874a9d13652fd1de4027 > > It looks like the only thing missing to make Cons implement IPersistentList > is IPersistentStack. Why

Re: list* not returning a list

2012-12-26 Thread Tom Jack
A small bug in ClojureScript was related to this: https://github.com/clojure/clojurescript/commit/88b36c177ebd1bb49dbd874a9d13652fd1de4027 It looks like the only thing missing to make Cons implement IPersistentList is IPersistentStack. Why not implement it? On Wednesday, December 26, 2012 4:13:

Re: list* not returning a list

2012-12-26 Thread Ben Wolfson
On Wed, Dec 26, 2012 at 2:07 PM, Stephen Compall wrote: > On Wed, 2012-12-26 at 12:35 -0800, Marek Šrank wrote: >> ...however, its docstring says: "Creates a new list containing the items >> prepended to the rest, the last of which will be treated as a sequence." > > List is almost always colloqui

Re: list* not returning a list

2012-12-26 Thread Stephen Compall
On Wed, 2012-12-26 at 12:35 -0800, Marek Šrank wrote: > ...however, its docstring says: "Creates a new list containing the items > prepended to the rest, the last of which will be treated as a sequence." List is almost always colloquial, not literally IPersistentList. I would be in favor of elim

Re: list of lists to list of arguments

2012-12-06 Thread Amir Wasim
hey, thanks, it works. Did not know/think apply can be used in this situation. Regards, Amir On Thursday, December 6, 2012 12:19:28 PM UTC+1, Baishampayan Ghose wrote: > > How about using apply? > > For example - > > (sql/with-connection (db-connection) > (apply sql/insert-values "table

Re: list of lists to list of arguments

2012-12-06 Thread Amir Wasim
On Thursday, December 6, 2012 12:18:05 PM UTC+1, Amir Wasim wrote: > > I am trying to use insert-values with value-groups which works like the > following > > (sql/with-connection (db-connection) > (sql/insert-values "table-name" ["id" "val"] [2 "B"][3 "C"])) > > here [2 "B"][3 "C"] is wit

Re: list of lists to list of arguments

2012-12-06 Thread Baishampayan Ghose
How about using apply? For example - (sql/with-connection (db-connection) (apply sql/insert-values "table-name" ["id" "val"] [[2 "B"][3 "C"]])) Does that work? -BG On Thu, Dec 6, 2012 at 4:48 PM, Amir Wasim wrote: > > I am trying to use insert-values with value-groups which works like

Re: list of special forms that introduce bindings?

2012-11-08 Thread Herwig Hochleitner
I'm not aware of such a list, but there aren't that many special forms. Other than the mentioned fn*, let* and catch, you have loop* and def. def doesn't create a lexical binding like the others, but creates its var before evaluating its init-expr. -- You received this message because you are su

Re: List comprehension not running

2011-06-16 Thread Steve Miner
(dotimes [x 10] ...) should do the trick if you're just interested in side effects. On Jun 16, 2011, at 12:24 PM, Baishampayan Ghose wrote: > 'for' is not recommended for causing side-effects. Since you are not using > the return value of the for comprehension, the lazy sequence is not getting

Re: List comprehension not running

2011-06-16 Thread Baishampayan Ghose
'for' is not recommended for causing side-effects. Since you are not using the return value of the for comprehension, the lazy sequence is not getting realised. You can either use 'doall' around it or better still, use 'doseq'. Hope that helps. Regards, BG --- Sent from phone. Please excuse bre

Re: List comprehension and sets

2011-05-24 Thread Alan Malloy
On May 24, 10:36 am, Ambrose Bonnaire-Sergeant wrote: > On Wed, May 25, 2011 at 12:55 AM, Alex Robbins < > > alexander.j.robb...@gmail.com> wrote: > > What is the difference between > > (into #{} (for x..)) > > and > > (set (for x ..)) > > Is one preferred? > > I don't think one is preferr

Re: List comprehension and sets

2011-05-24 Thread Ambrose Bonnaire-Sergeant
On Wed, May 25, 2011 at 12:55 AM, Alex Robbins < alexander.j.robb...@gmail.com> wrote: > What is the difference between > (into #{} (for x..)) > and > (set (for x ..)) > Is one preferred? > > I don't think one is preferred over the other in general. Personally I prefer into, I find it gen

Re: List comprehension and sets

2011-05-24 Thread Ambrose Bonnaire-Sergeant
On Wed, May 25, 2011 at 12:20 AM, Mark Engelberg wrote: > Scala's approach to comprehensions is to automatically produce the > same type of collection that is used first in your comprehension. > Clojure's approach is to always produce a lazy sequence which can then > be "poured" into the collectio

Re: List comprehension and sets

2011-05-24 Thread Alex Robbins
What is the difference between (into #{} (for x..)) and (set (for x ..)) Is one preferred? Thanks! Alex On Tue, May 24, 2011 at 11:20 AM, Mark Engelberg wrote: > Scala's approach to comprehensions is to automatically produce the > same type of collection that is used first in your compre

Re: List comprehension and sets

2011-05-24 Thread Mark Engelberg
Scala's approach to comprehensions is to automatically produce the same type of collection that is used first in your comprehension. Clojure's approach is to always produce a lazy sequence which can then be "poured" into the collection of your choice using "into". Both approaches have their merits

Re: List comprehension and sets

2011-05-24 Thread MarisO
> (set (for [x (range 4)] (* 4 x))) > ;=> #{0 4 8 12} > > Does that help? yes, thank you. -- 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

Re: List comprehension and sets

2011-05-24 Thread MarisO
> Does this actually yield a set in Scala? yes, it does > What is p()? A set constructor? p(i) reads i-nth element from a vector def selectRow(p: Vector[Int], i: Int) = { for (i <- (i - i % 9 to i - i % 9 + 8).toSet[Int]) yield p(i) } -- You received this message because you are subscri

Re: List comprehension and sets

2011-05-24 Thread Andreas Kostler
Hi, try (set (for [x (range 4)] (* x 4))) Cheers Andreas On 24/05/2011, at 8:40 PM, MarisO wrote: > Is it possible to use list comprehension to generate a set ? > For example in scala I can do: > > for (i <- (2 to 8).toSet[Int]) yield p(i) > > In clojure this > > (for [ x (set (range 4))]

Re: List comprehension and sets

2011-05-24 Thread Ambrose Bonnaire-Sergeant
On Tue, May 24, 2011 at 6:40 PM, MarisO wrote: > Is it possible to use list comprehension to generate a set ? > For example in scala I can do: > > for (i <- (2 to 8).toSet[Int]) yield p(i) > > Does this actually yield a set in Scala? What is p()? A set constructor? Thanks, Ambrose -- You rece

Re: List comprehension and sets

2011-05-24 Thread Baishampayan Ghose
On Tue, May 24, 2011 at 4:10 PM, MarisO wrote: > Is it possible to use list comprehension to generate a set ? > For example in scala I can do: > > for (i <- (2 to 8).toSet[Int]) yield p(i) > > In clojure this > > (for [ x (set (range 4))] (* 4 x)) > >  generates a list. (set (for [x (range 4)] (*

Re: List comprehension and sets

2011-05-24 Thread Ambrose Bonnaire-Sergeant
Hi Maris, `into` is a useful function for this case. user>> (into #{} (for [ x (set (range 4))] (* 4 x))) #{0 4 8 12} You can use it for lists, maps, vectors. user>> (into {} '([:a "a"] [:b "b"])) {:a "a", :b "b"} user>> (into [] '([:a "a"] [:b "b"])) [[:a "a"] [:b "b"]] Thanks, Ambrose On Tu

Re: list* does not make a list?

2011-01-17 Thread Meikel Brandmeyer
Hi, On 17 Jan., 11:28, LordGeoffrey wrote: > The docs don't say that it is lazy. How (as a newbie) can i tell that it > is lazy? By the words "the last of which will be treated as a sequence". A sequence is (in general) lazy. Hence, what list* returns is actually a sequence and not a list. As m

Re: list* does not make a list?

2011-01-17 Thread LordGeoffrey
The docs don't say that it is lazy. How (as a newbie) can i tell that it is lazy? Docs: "Creates a new list containing the items prepended to the rest, the last of which will be treated as a sequence." On 17/01/11 06:27, Sean Allen wrote: the documentation on that could be improved. the doc

Re: list* does not make a list?

2011-01-16 Thread Sean Allen
the documentation on that could be improved. the doc string for that is basically the same as for list. but they return different types. rather surprising when you first see it. On Sun, Jan 16, 2011 at 1:55 PM, Alan wrote: > list* consumes its last argument lazily, which means it can't count it

Re: list* does not make a list?

2011-01-16 Thread Brian Marick
On Jan 16, 2011, at 12:55 PM, Alan wrote: > list* consumes its last argument lazily, which means it can't count it That is indeed what it does. seq* would have been a better name. Too late now, I guess. - Brian Marick, Artisanal Labrador Contract programming in Ruby and Clojure Author of /

Re: list* does not make a list?

2011-01-16 Thread Alan
list* consumes its last argument lazily, which means it can't count it (a requirement to be a real list). Both functions return objects that are seqs, though, so you can (seq?) them if you want. user=> (def x (list* (range))) #'user/x user=> (def x (apply list (range))) java.lang.OutOfMemoryError:

Re: List folders/ Files recursively

2010-10-06 Thread B Smith-Mannschott
On Wed, Oct 6, 2010 at 16:59, Justin Kramer wrote: > On Oct 6, 8:39 am, B Smith-Mannschott wrote: > > On Wed, Oct 6, 2010 at 08:49, Abraham wrote: > > > ; prints all files > > > (import 'java.io.File) > > > (defn walk [dirpath] > > > (doseq [file (-> dirpath File. file-seq)] > > > (println

Re: List folders/ Files recursively

2010-10-06 Thread Justin Kramer
I should mention that Ben's solution is still nice and is basically how tree-seq is implemented under the hood. It is more idiomatic than using loop/recur (for most use cases). Justin On Oct 6, 10:59 am, Justin Kramer wrote: > On Oct 6, 8:39 am, B Smith-Mannschott wrote: > > > On Wed, Oct 6, 20

Re: List folders/ Files recursively

2010-10-06 Thread Justin Kramer
On Oct 6, 8:39 am, B Smith-Mannschott wrote: > On Wed, Oct 6, 2010 at 08:49, Abraham wrote: > > ; prints all files > > (import 'java.io.File) > > (defn walk [dirpath] > >  (doseq [file (-> dirpath File. file-seq)] > >     (println (.getPath file)  ))) > > This doesn't do what you said you wanted

Re: List folders/ Files recursively

2010-10-06 Thread Abraham
Thanks a lot .. really good On Oct 6, 5:39 pm, B Smith-Mannschott wrote: > On Wed, Oct 6, 2010 at 08:49, Abraham wrote: > > Dear All , > > > I wanted to list  the files of a folder , if a folder within , then it > > should list the files of that folder and so on.. ie recursively list > > files o

Re: List folders/ Files recursively

2010-10-06 Thread B Smith-Mannschott
On Wed, Oct 6, 2010 at 08:49, Abraham wrote: > Dear All , > > I wanted to list the files of a folder , if a folder within , then it > should list the files of that folder and so on.. ie recursively list > files of folders > > I tried with recur & loop and could not do it . Then i searched the >

Re: List moderation

2010-07-09 Thread Greg
Thanks Stuart! Wow. It's like a breath of fresh air. My responses are actually arriving on time. Really, it felt weird previously, sort of like I was stuck in a timewarp. :-p - Greg On Jul 9, 2010, at 6:58 PM, Stuart Halloway wrote: > Hi Greg, > > I thought that the approval process was supp

Re: List moderation

2010-07-09 Thread Stuart Halloway
Hi Greg, I thought that the approval process was supposed to auto-approve people after a certain number of approved messages, but that doesn't seem to have happened (at least in your case). Your messages are no longer moderated. Sorry for the delays. Stu > Is there anything we can do to impro

Re: (list* ())

2010-01-29 Thread Rich Hickey
On Fri, Jan 22, 2010 at 4:55 PM, ataggart wrote: > > > On Jan 22, 1:30 pm, samppi wrote: >> This is not a big deal: it is a quibble with a weird and inconvenient >> behavior of list*: when given an empty sequence, it returns nil >> instead of the empty list. Why is this? According to list*'s >> d

Re: (list* ())

2010-01-23 Thread ataggart
Fair enough. Clearly list* isn't intended to do what you want. I'd suggest using (into '() ...). On Jan 23, 8:38 am, samppi wrote: > The Clojure parser I'm writing needs to differentiate between nil and > the empty list. It should parse "[1 2 3]" and read that as [1 2 3], > and the same for li

Re: (list* ())

2010-01-23 Thread samppi
The Clojure parser I'm writing needs to differentiate between nil and the empty list. It should parse "[1 2 3]" and read that as [1 2 3], and the same for lists, maps, and sets. If it parses "()" and reads that nil, then it's not working correctly. In addition, code in some other libraries I'm wri

Re: (list* ())

2010-01-23 Thread ataggart
I'm still confused by why you'd need a list version of vec. Just return the sequence. Whatever would consume the list should equivalently consume the seq. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@g

Re: (list* ())

2010-01-22 Thread samppi
Reading the source code of core.clj, I've just realized that list* isn't like vec at all: the point of list* is to help the apply function, and that it doesn't even ever return lists: it always returns Cons objects (if there are two+ arguments), or a sequence (if there is one argument). The only ti

Re: (list* ())

2010-01-22 Thread samppi
@DeSeno: list*'s doc does indeed say that the last element will be treated as a seq, but the beginning of the same doc definitely says that list* returns a list. The doc is: Creates a new list containing the items prepended to the rest, the last of which will be treated as a sequence. "The last

Re: (list* ())

2010-01-22 Thread MiltondSilva
See this: http://groups.google.com/group/clojure/browse_thread/thread/bc938600ddaaeada/0600e5c3f0c44770?lnk=gst&q=nil#0600e5c3f0c44770 -- 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: (list* ())

2010-01-22 Thread j DeSeno
The doc for list* says the last element will be treated as a seq. (seq ()) returns nil. On Fri, Jan 22, 2010 at 1:30 PM, samppi wrote: > This is not a big deal: it is a quibble with a weird and inconvenient > behavior of list*: when given an empty sequence, it returns nil > instead of the empty

Re: (list* ())

2010-01-22 Thread samppi
I'm writing a Clojure parser in Clojure. A certain parser reads a series of forms, and returns a seq (potentially including nil). Certain other parsers use the first parser to read list forms, vector forms, map forms, and set forms. The vector parser calls vec on its contents' sequence, the set pa

Re: (list* ())

2010-01-22 Thread ataggart
On Jan 22, 1:30 pm, samppi wrote: > This is not a big deal: it is a quibble with a weird and inconvenient > behavior of list*: when given an empty sequence, it returns nil > instead of the empty list. Why is this? According to list*'s > documentation, list* should always return a list. Judging

Re: list of open source clojure projects to contribute?

2009-12-24 Thread Meikel Brandmeyer
Hi, Am 23.12.2009 um 18:59 schrieb Phil Hagelberg: >> http://www.google.com/search?hl=en&q=site:github.com+clojure > > Also noteworthy: all Clojure projects on Github sorted by most recent > activity: > > http://github.com/languages/Clojure/updated > > That weeds out inactive projects. Then y

Re: list of open source clojure projects to contribute?

2009-12-23 Thread Seth
BitBucket (the GitHub of Mercurial) has a few pages of Clojure-based projects: http://bitbucket.org/repo/all/?name=clojure On Dec 22, 9:27 pm, Kasim wrote: > I am just thinking if anyone can list up open source projects so one > can pick and work on? -- You received this message because you are

Re: List quasi-quoting

2009-12-23 Thread Sean Devlin
I try to avoid using reading macros in macro definitions. Maybe you could wrap the desired data in a quote form instead? On Dec 23, 6:13 am, Andreas Fredriksson wrote: > Hi, > I'm prototyping a source translation framework in Clojure and I've run > across a problem. I have a bunch of files with

Re: list of open source clojure projects to contribute?

2009-12-23 Thread Phil Hagelberg
Steve Purcell writes: > http://www.google.com/search?hl=en&q=site:github.com+clojure Also noteworthy: all Clojure projects on Github sorted by most recent activity: http://github.com/languages/Clojure/updated That weeds out inactive projects. > But the best plan is to start using clojure for

Re: list of open source clojure projects to contribute?

2009-12-23 Thread Steve Purcell
Here's a good start: http://www.google.com/search?hl=en&q=site:github.com+clojure But the best plan is to start using clojure for real work, then contribute to the open source tools you find yourself using. -Steve On 23 Dec 2009, at 02:27, Kasim wrote: > I am just thinking if anyone can lis

Re: list vs. vector as input to (into {} ...) ?

2009-07-11 Thread Kevin Downey
two element vectors implement MapEntry, two element lists do not On Sat, Jul 11, 2009 at 9:09 AM, Stuart Halloway wrote: > > Is there a reason these work differently? > > (into {} [(list 1 2) (list 3 4)]) > -> java.lang.ClassCastException: java.lang.Integer cannot be cast to > java.util.Map$Entry

Re: list vs vector

2009-05-17 Thread Mark Volkmann
On Fri, May 15, 2009 at 2:36 PM, Vagif Verdi wrote: > > What are the use case scenarios where one is preferable to the other > in clojure ? A lot of good points have been raised in this thread. A minor point to add is that literal vectors are a bit easier to pick out in code than literal lists.

Re: list vs vector

2009-05-16 Thread Stephen C. Gilardi
On May 16, 2009, at 8:23 PM, Michel S. wrote: That's a bit of a red herring, though? You can always rewrite the code to use normal (as opposed to tail) recursion, if you don't want to use reverse. Depending on how large the resulting list is, it's a space- vs- time tradeoff: the normal recurs

Re: list vs vector

2009-05-16 Thread Michel S.
On May 15, 4:41 pm, "Stephen C. Gilardi" wrote: > > Another nice benefit of Clojure's efficient vectors over lists is that   > functions that produce a collection of results can produce and store   > them in order without needing to "reverse" the result just before   > returning. Reversing is a

Re: list vs vector

2009-05-16 Thread Mark Engelberg
In my own experimentation, I was really surprised to find that traversal over vectors seemed to be faster than lists, so I tend to use vectors rather than lists for any "fixed collection" that I'm basically just traversing once I've built. Haven't benchmarked recently, though, so this could have

Re: list vs vector

2009-05-16 Thread Trevor Caira
Remember clojure, like other lisps, is homoiconic: the program code itself is clojure data. Lists are very common in clojure, since a list is is used in the function invocation syntax, e.g. (inc 0). Otherwise, used as a general purpose lists have the same benefits of linked lists over arrays that

Re: list vs vector

2009-05-15 Thread Stephen C. Gilardi
On May 15, 2009, at 3:36 PM, Vagif Verdi wrote: It looks to me like vectors almost completely overtake lists for all purposes. I think that's a fair statement. Lists are still: - key as the data structure that represents a "call" (to a function, macro, or special form) - useful for c

Re: list vs vector

2009-05-15 Thread David Nolen
And here are some numbers from my machine: (def my-list (list 'a 'b 'c 'd 'e 'f 'g 'h 'i 'j)) (def my-vector ['a 'b 'c 'd 'e 'f 'g 'h 'i 'j]) ; ~44ms (time (dotimes [x 100] (conj my-list 'k))) ; ~26ms (time (dotimes [x 100] (pop my-list))) ; ~100ms (time (dotimes [x 100] (conj my-vec

Re: list vs vector

2009-05-15 Thread tmountain
I'm no expert, but I think this explain some: Clojure's conj function is like Lisp's cons, but "does the right thing", depending on the data type. It is fast to add something to the front of the list, and slower to add something to the end. Vectors are the opposite, you can add to the end fast,

Re: list merge help

2009-01-11 Thread e
ahhh I see. That makes sense. So it's not like procedural programming. You could see what I was trying to understand. I didn't want case/swtich semantics. like the (cond) or if, else if style. I was trying to return at the first true thing, but it doesn't work like that. it always gets

Re: list merge help

2009-01-11 Thread Eric Lavigne
> > > this seemed like a clean, nice way to merge to sorted lists into one > sorted list. I'm not getting clojure syntax, it seems: > > > (defn listmerge [l1 l2] > (let [l1first (first l1) l2first (first l2)] >(if (= l1first nil) l2) >(if (= l2first nil) l1) >(if (< l1first l2first) >

Re: list merge help

2009-01-11 Thread James Reeves
On Jan 11, 5:53 pm, e wrote: > this seemed like a clean, nice way to merge to sorted lists into one > sorted list.  I'm not getting clojure syntax, it seems: > > (defn listmerge [l1 l2] >   (let [l1first (first l1) l2first (first l2)] >     (if (= l1first nil) l2) >     (if (= l2first nil) l1) >

Re: List comprehension: :when AND :while for the same binding?

2008-12-09 Thread Rich Hickey
On Mon, Dec 8, 2008 at 7:15 PM, Chouser <[EMAIL PROTECTED]> wrote: > On Mon, Dec 8, 2008 at 10:42 AM, Rich Hickey <[EMAIL PROTECTED]> wrote: >> >> On Dec 8, 10:08 am, Chouser <[EMAIL PROTECTED]> wrote: >>> >>> doseq currently supports both. If both appear on the same binding, >>> the :while is al

Re: List comprehension: :when AND :while for the same binding?

2008-12-08 Thread Chouser
On Mon, Dec 8, 2008 at 10:42 AM, Rich Hickey <[EMAIL PROTECTED]> wrote: > > On Dec 8, 10:08 am, Chouser <[EMAIL PROTECTED]> wrote: >> >> doseq currently supports both. If both appear on the same binding, >> the :while is always test first regardless of the order in which they >> appear in the dose

Re: List comprehension: :when AND :while for the same binding?

2008-12-08 Thread Chouser
On Mon, Dec 8, 2008 at 10:42 AM, Rich Hickey <[EMAIL PROTECTED]> wrote: > > On Dec 8, 10:08 am, Chouser <[EMAIL PROTECTED]> wrote: >> >> doseq currently supports both. If both appear on the same binding, >> the :while is always test first regardless of the order in which they >> appear in the dos

Re: List comprehension: :when AND :while for the same binding?

2008-12-08 Thread Rich Hickey
On Dec 8, 10:08 am, Chouser <[EMAIL PROTECTED]> wrote: > On Mon, Dec 8, 2008 at 9:06 AM, Rich Hickey <[EMAIL PROTECTED]> wrote: > > > On Dec 6, 7:52 pm, André Thieme <[EMAIL PROTECTED]> wrote: > >> (for [x (range 1 20) :when (> x 8) :while (< 0 (rem x 13))] x) ==> > >> java.lang.Exception: Unsup

Re: List comprehension: :when AND :while for the same binding?

2008-12-08 Thread Chouser
On Mon, Dec 8, 2008 at 9:06 AM, Rich Hickey <[EMAIL PROTECTED]> wrote: > > On Dec 6, 7:52 pm, André Thieme <[EMAIL PROTECTED]> wrote: >> (for [x (range 1 20) :when (> x 8) :while (< 0 (rem x 13))] x) ==> >> java.lang.Exception: Unsupported binding form: :while >> >> But: >> (for [x (range 1 20) :w

Re: List comprehension: :when AND :while for the same binding?

2008-12-08 Thread Rich Hickey
On Dec 6, 7:52 pm, André Thieme <[EMAIL PROTECTED]> wrote: > (for [x (range 1 20) :when (> x 8) :while (< 0 (rem x 13))] x) ==> > java.lang.Exception: Unsupported binding form: :while > > But: > (for [x (range 1 20) :when (> x 8)] x) ==> > (9 10 11 12 13 14 15 16 17 18 19) > > And: > (for [x (ra