Re: All subsets of a vector

2011-11-09 Thread Bob Shock
Or my current favorite take-while iterate combo: C:\clojure-1.2.0java -jar clojure.jar Clojure 1.2.0 user= (take-while seq (iterate rest [1 2 3 4])) ([1 2 3 4] (2 3 4) (3 4) (4)) user= (take-while seq (iterate butlast [1 2 3 4])) ([1 2 3 4] (1 2 3) (1 2) (1)) user= On Nov 9, 4:52 pm, Alex

Re: Newbie help in pitching in

2011-10-19 Thread Bob Shock
I would recommend adding examples to clojuredocs.org and adding new problems to 4clojure.com. On Oct 19, 4:32 pm, Rett Kent rett.k...@gmail.com wrote: Hi all, Now that I have my shiny new, clojure-dev membership, I'd like to pitch in.  I took a look at the pages describing how to contribute.

Re: How To Empty A Tree or Returning The Skelton of A Tree Without Leaves

2011-09-07 Thread Bob Shock
I am confused by your question. If you are looking for help on a 4clojure problem, you may post to the new Google 4clojure group (http://groups.google.com/group/4clojure). If not, please give more details on the skeleton of a tree problem and I'm sure someone here can help. On Sep 7, 3:38 pm,

Re: is there a 4Clojure forum anywhere?

2011-08-27 Thread Bob Shock
Hint: use the take function. On Aug 27, 8:45 pm, Shree Mulay shreemu...@gmail.com wrote: yeah, i'm stuck on the nth without cheating problem myself...  would be cool if there were forums for this site! :) -- You received this message because you are subscribed to the Google Groups Clojure

Re: is there a 4Clojure forum anywhere?

2011-08-26 Thread Bob Shock
Is there a recovery group for 4clojure.com addicts? Stop now! Don't go further before it's too late and you are checking the website every five minutes waiting for the next problem, obsessing over every character in your code so you can get one of the best code golf scores, etc. But seriously,

Re: Creating a map algorithmically

2011-08-09 Thread Bob Shock
user= (def n 5) #'user/n user= (zipmap (range 2 (inc n)) (repeat true)) {5 true, 4 true, 3 true, 2 true} user= As a start... On Aug 9, 10:50 am, Kevin Sookocheff kevin.sookoch...@gmail.com wrote: Hi, I have a question regarding the map data structure. I'm trying to program a Sieve of

Re: Argument is not an array, in a function inside deftype

2010-12-30 Thread Bob Shock
I don't get any errors when I run your code. This is the output: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Are you sure you are using the latest Clojure 1.2 version and not an early beta, etc.? Process finished with exit code 0 On Dec 29, 11:25 pm, Jarl Haggerty

Weird result for (get max key)

2010-11-19 Thread Bob Shock
I had a bug in my code where I meant to type: (get map key) and instead typed: (get max key) It seems that any function name I put in for max always returns nil. user= (get max 3) nil user= (get min 3) nil user= (get maxx 3) java.lang.Exception: Unable to resolve symbol: maxx in this context

Re: Why so?

2010-09-05 Thread Bob Shock
I've been programming in large OO applications since about 1993. One problem is that a lot of useful code gets buried way deep in an OO class hierarchy, where you are forced to create lots of intermediate objects just to get to the useful functions. This really hurts the re-usability, unit

Re: How can I create Java generic classes from Clojure?

2009-09-30 Thread Bob Shock
Sorry, that was TOO easy. Too many years as a Java programmer have rotted my brain!. --~--~-~--~~~---~--~~ 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

How can I create Java generic classes from Clojure?

2009-09-29 Thread Bob Shock
If I have a Java function that uses ListInteger or MapString,Integer, is there anyway to create these in Clojure the same way I can create vectors or maps? For example, if a function signature is: void foobar(List x, Map y) I can pass standard vectors and maps to it, but I can't figure out how