Re: ANN: lambic v. 0.1.0

2012-06-15 Thread Peter Taoussanis
I don't know the first thing about logic programming so can't say whether something like this would be practical to implement or not - but boy what a neat idea! I'm constantly needing to restructure bits of data and while it's not exactly tough to do in Clojure, something like this would certai

Re: A tutorial for how to setup your clojure development environment for: Emacs, Leiningen and Linux.

2012-06-15 Thread Sean Corfield
On Thu, Jun 14, 2012 at 11:28 PM, fenton wrote: > What I'd suggest is that there be a git repo for clojure docs, where things > can be brought together like the types of articles i'm writing, but tended > by the clojure community. Phil has streamlined http://dev.clojure.org/display/doc/Getting+St

Re: How to do aynchrounous producer/consumer

2012-06-15 Thread Alan Malloy
(map consume (seque (produce-lazily))) On Friday, June 15, 2012 6:44:39 PM UTC-7, Warren Lynn wrote: > > > What I want to do is something I probably have done dozens of times in > C++: two threads, one thread putting items in a queue, another taking it > out (FIFO). How to do it in Clojure? I am

Re: Classpath set by lein swank or clojure-jack-in

2012-06-15 Thread Dave Kincaid
Thanks I'll give those things a try. swank-test was just a small project I threw together as an example for this post. The directory structure is the same as my big project though. I'll play around with your suggestions and see if I can find a pattern to when it works and when it doesn't. Thank

Re: Best practices for named arguments

2012-06-15 Thread David Jacobs
Very cool, this is exactly what I wanted. Thanks. On Friday, June 15, 2012 7:27:05 AM UTC-7, Gunnar Völkel wrote: > > Hello David. > I have a very similar scenario according to named parameters liker you. > Therefore I have written the library clojure.options which can be found > here: > https://

Re: Classpath set by lein swank or clojure-jack-in

2012-06-15 Thread Peter Buckley
Probably over-cautious because of my ignorance, but I don't know if I would name the project "swank-test" as I haven't paid too close attention to what seems a slightly confusing rule about "dashes in namespaces and underscores in filenames" - also swank-test might be some sort of existing names

Re: Is there a better way to do this

2012-06-15 Thread Sean Corfield
On Fri, Jun 15, 2012 at 7:30 AM, Baishampayan Ghose wrote: > This is how it should be done, really - > > (defn get-events-hlpr >  "Retrieves events from MongoDB." >  [] >  (vec (map #(dissoc :_id %) (mc/find-maps "events" ;; remove the :_id as > well Or in Clojure 1.4.0 and later: (defn get

Re: Classpath set by lein swank or clojure-jack-in

2012-06-15 Thread Sean Corfield
Have you tried visiting the project.clj file in Emacs and then doing M-x clojure-jack-in ? That should start lein swank in the project directory and pull in all the dependencies as expected. (you should start lein swank in the project root directory - containing project.clj - not in a subdirectory

How to do aynchrounous producer/consumer

2012-06-15 Thread Warren Lynn
What I want to do is something I probably have done dozens of times in C++: two threads, one thread putting items in a queue, another taking it out (FIFO). How to do it in Clojure? I am at a loss. I thought about a few options: 1. "watches", but it cannot change the queue itself (can only watc

Re: clojure.core.cache status?

2012-06-15 Thread Sean Corfield
On Fri, Jun 15, 2012 at 1:23 PM, Michael Fogus wrote: > Well, I've tried to cut a release today, but the Hudson build is > complaining about git connection errors. I will try again later today. I saw 0.6.0 on Maven Central - thank you! I'm currently running our application test suite. -- Sean A

Re: Classpath set by lein swank or clojure-jack-in

2012-06-15 Thread Dave Kincaid
Sure can. Here is the project.clj: (defproject swank-test "0.1" :source-path "src/main/clj" :test-path "test/clj" :java-source-path "src/main/java" :javac-options {:debug "true" :fork "true"} :resources-path "src/main/resources" :dependencies [[org.clojure/clojure "1.4.0"]

Re: Classpath set by lein swank or clojure-jack-in

2012-06-15 Thread Moritz Ulrich
That's strange. You usually just run lein swank in the folder with you project.clj. Nothing to do wrong there. Can you show the project.clj and the directory structure of a non-working project? -- Sent from my mobile Am 16.06.2012 01:07 schrieb "Dave Kincaid" : > I'm with you, Peter. The proble

Re: Classpath set by lein swank or clojure-jack-in

2012-06-15 Thread Dave Kincaid
I'm with you, Peter. The problem is I can't get lein swank and slime-connect working in a consistent way. It starts up fine but can't find any dependencies that I try to (use ...) or even any of the code in my .clj files that I try to access. I just can't understand what it's using as a classpa

Re: Classpath set by lein swank or clojure-jack-in

2012-06-15 Thread Peter Buckley
Once I got lein swank and slime-connect working in emacs, I essentially stopped using the repl directly. The real magic and beauty of writing clojure in emacs is that I can write a fn, then C-x C-e to evaluate it right there in the file. I can evaluate inner forms, test every line of the file to

Classpath set by lein swank or clojure-jack-in

2012-06-15 Thread Dave Kincaid
One of the things that really been holding me back from moving ahead with Clojure is the difficulty I have running code that I'm writing using a repl. I generally use Emacs to code Clojure and I really don't understand how the classpath gets set when I use either "lein swank + slime-connect" or

Re: Calling Clojure from Java and classloader

2012-06-15 Thread Warren Lynn
> It's not really a good idea to AOT your code and then directly try to > use it from java. The generated java bytecode isn't guaranteed to be > stable across versions of clojure, and you're depending on > implementation details. > > One way to use your clojure code from java is through RT

Re: clojure.core.cache status?

2012-06-15 Thread Michael Fogus
Well, I've tried to cut a release today, but the Hudson build is complaining about git connection errors. I will try again later today. -- 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: clojure.core.cache status?

2012-06-15 Thread Sean Corfield
On Fri, Jun 15, 2012 at 6:43 AM, Michael Fogus wrote: >> and I'm wondering how stable the APIs are and how close a 0.6.0 >> release might be? > Very very close. In fact, I will cut a release some time today. Awesome, thanx! That makes me feel a whole lot better about taking this puppy to producti

Re: ClojureScript Analyzer Decoupled

2012-06-15 Thread David Nolen
On Fri, Jun 15, 2012 at 1:41 PM, Timothy Baldridge wrote: > But I'd rather collaborate with ClojureScript. Are there any ongoing > efforts to make this cross platform? The current analyzer contains > quite a few java calls. For instance, .contains, and .indexOf. Is > Raphael working on this, or ca

Re: ClojureScript Analyzer Decoupled

2012-06-15 Thread Timothy Baldridge
I've been working on a platform-agnostic version of this over here: https://github.com/halgari/universal-clojure/blob/master/src/universal_clojure/core.clj But I'd rather collaborate with ClojureScript. Are there any ongoing efforts to make this cross platform? The current analyzer contains quite

ClojureScript Analyzer Decoupled

2012-06-15 Thread David Nolen
Thanks to Raphael Amiard's hard work the ClojureScript analyzer is now decoupled: http://github.com/clojure/clojurescript/commit/9ad79e1c9b87c862ccb7ad6aad37d90414123c76 This is a big step towards making the ClojureScript compiler infrastructure pluggable. There's a couple of JS things to clean u

Re: Calling Clojure from Java and classloader

2012-06-15 Thread Aaron Cohen
On Wed, Jun 13, 2012 at 11:48 PM, Warren Lynn wrote: > Ok, I hit a wall and really did not see this coming. > > Based on what I have read, its really easy for Clojure and Java to > work together. So I wrote some test Clojure code with a very simple > defrecord (say named as "testrec") and AOT comp

Re: Is there a better way to do this

2012-06-15 Thread Baishampayan Ghose
> Hi Baishampayan, > >> (defn get-events-hlpr [] >>   "Retrieves events from MongoDB." >>   (vec (mc/find-maps "events"))) > > Is that Emacs Lisp or Common Lisp? > > Bye, > Tassilo > > Just nitpicking that you adapted the OP's error of adding the docstring > after the parameter vector. ;-) You are

Re: clojure-csv library write-csv examples

2012-06-15 Thread Walter Tetzner
On Friday, June 15, 2012 10:01:24 AM UTC-4, octopusgrabbus wrote: > > The reason why I asked this question is this code looks like it's using > another csv library, so I'm confused. > That's because it is using another csv library: https://github.com/clojure/data.csv. clojure-csv: https://githu

Re: Is there a better way to do this

2012-06-15 Thread Tassilo Horn
Baishampayan Ghose writes: Hi Baishampayan, > (defn get-events-hlpr [] > "Retrieves events from MongoDB." > (vec (mc/find-maps "events"))) Is that Emacs Lisp or Common Lisp? Bye, Tassilo Just nitpicking that you adapted the OP's error of adding the docstring after the parameter vector. ;-

Re: Best practices for named arguments

2012-06-15 Thread Gunnar Völkel
Hello David. I have a very similar scenario according to named parameters liker you. Therefore I have written the library clojure.options which can be found here: https://github.com/guv/clojure.options The latest version is also on clojars. Greetings, Gunnar -- You received this message becaus

Re: Is there a better way to do this

2012-06-15 Thread Baishampayan Ghose
> I am receiving a sequence from a particular function so I want to get that > sequence and converted to a vector o I can return a vector instead. > > (defn get-events-hlpr [] > "Retrieves events from MongoDB." > (init) > (def items (mc/find-maps "events")) ;; get the sequence > (loop [vtr [] >   d

Re: Is there a better way to do this

2012-06-15 Thread Walter Tetzner
> You could just do (vec (mc/find-maps "events")). > Also, to dissoc :_id from each item, do (vec (map #(dissoc % :_id) (mc/find-maps "events"))). -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googleg

Re: Is there a better way to do this

2012-06-15 Thread Walter Tetzner
On Friday, June 15, 2012 9:54:37 AM UTC-4, Joao_Salcedo wrote: > Is the right way? > You could just do (vec (mc/find-maps "events")). Also, using def creates a top-level var. You probably wanted (let [items (mc/find-maps "events")] ...) instead. -- You received this message because you are s

Re: clojure-csv library write-csv examples

2012-06-15 Thread octopusgrabbus
The reason why I asked this question is this code looks like it's using another csv library, so I'm confused. (require '[clojure.data.csv :as csv] '[clojure.java.io :as io]) (with-open [in-file (io/reader "in-file.csv")] (doall (csv/read-csv in-file))) (with-open [out-file (io/wr

clojure-csv library write-csv examples

2012-06-15 Thread octopusgrabbus
I would appreciate getting a pointer to some clojure-csv library write-csv examples. 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 modera

Is there a better way to do this

2012-06-15 Thread Joao_Salcedo
HI All, I am receiving a sequence from a particular function so I want to get that sequence and converted to a vector o I can return a vector instead. (defn get-events-hlpr [] "Retrieves events from MongoDB." (init) (def items (mc/find-maps "events")) ;; get the sequence (loop [vtr [] data it

Re: clojure.core.cache status?

2012-06-15 Thread Michael Fogus
> and I'm wondering how stable the APIs are and how close a 0.6.0 > release might be? Very very close. In fact, I will cut a release some time today. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googleg

Re: Is there a reason why 'some' returns "nil" instead o "false"?

2012-06-15 Thread Tassilo Horn
"Jim - FooBar();" writes: >>> Yes. A correct version is >>> >>> (defn in? [coll e] >>>(some (partial = e) coll)) >> >> If just wrapping 'some' I think this is easier to read >> >> (defn in? [coll e] >> (some #{e} coll)) >> >> thanks for your time :-) > > sorry...you mea

Re: If a protocol creates a Java interface under the covers...

2012-06-15 Thread Jim - FooBar();
Performace was an issue right from the start for this project, that's why I went down the protocol/record path instead of multi-methods...surely, this is a decision to be made in the beginning, isn't it? I did take into account all the comments so far...my world is now fully immutable, reset!

Re: Enfocus issues

2012-06-15 Thread ckirkendall
Andreas Thank you for pointing this out. I have fixed this on the readme page. I also noticed it is wrong in a few other places. I will fix them today also. Enfocus also has a google group if you run into more issues. https://groups.google.com/group/enfocus Creighton -- You received t

Re: Best practices for named arguments

2012-06-15 Thread Marcus Lindner
I think the best is to use maps. It is rarly a good idea to have too many arguments. Am 15.06.2012 08:51 schrieb "David Jacobs" : > TL;DR: I want to know best practices for designing functions with multiple > optional arguments. > > Okay, so I'm working to build machine learning algorithms in Cloj

Re: Enfocus issues

2012-06-15 Thread ckirkendall
Thanks for point that out. It will be fixed shortly. CK On Friday, June 15, 2012 1:40:22 AM UTC-4, Andreas Kostler wrote: > > There you go...wrong on the example-page then. > Thanks David > > > On 15 June 2012 15:00, David Nolen wrote: > >> On Fri, Jun 15, 2012 at 1:23 AM, Andreas Kostler < >>

Re: If a protocol creates a Java interface under the covers...

2012-06-15 Thread Korny Sietsma
You keep talking about performance. I'm a long way from being a clojure expert, but one thing I *do* know is that premature optimization is the root of many many evils. May I suggest you first get your app working, in a clean understandable fashion, ideally with some solid unit tests. Then, and o

Re: 'dotimes' will not work inside a 'doto'...

2012-06-15 Thread Jim - FooBar();
On 15/06/12 01:00, Andy Fingerhut wrote: I highly recommend clojuredocs.org for adding examples of pitfalls/traps. I've added several there myself, e.g. for clojure.core/future (and also clojure.core/pmap, clojure.java.shell/sh): http://clojuredocs.org/clojure_core/cl

Re: Is there a reason why 'some' returns "nil" instead o "false"?

2012-06-15 Thread Jim - FooBar();
On 15/06/12 10:47, Jim - FooBar(); wrote: On 15/06/12 07:27, Tassilo Horn wrote: "Jim - FooBar();" writes: nice catch and point taken... however the exact same thing would happen if this was a function...it's just wrong ! Yes. A correct version is (defn in? [coll e] (some (par

Re: Is there a reason why 'some' returns "nil" instead o "false"?

2012-06-15 Thread Jim - FooBar();
On 15/06/12 07:27, Tassilo Horn wrote: "Jim - FooBar();" writes: nice catch and point taken... however the exact same thing would happen if this was a function...it's just wrong ! Yes. A correct version is (defn in? [coll e] (some (partial = e) coll)) Bye, Tassilo If just w

Re: Clojurescript (latest) advanced mode compilation => java.lang.ClassCastException ?

2012-06-15 Thread Dave Sann
compiled, no problem nice work, and thanks D On Friday, 15 June 2012 10:01:38 UTC+10, David Nolen wrote: > > This should be resolved in master - please let us know if you continue to > run into problems. > > On Thu, Jun 14, 2012 at 3:06 PM, David Nolen wrote: > >> Thank you! http://dev.clojure

Re: ANN: lambic v. 0.1.0

2012-06-15 Thread Vinzent
Seems very interesting! -- 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 unsubscribe from this gr

Re: Best practices for named arguments

2012-06-15 Thread David Jacobs
Ah I see, I didn't realize I could apply the general-descend algorithm to both atoms and arrays to get a flattened list. Thanks! On Friday, June 15, 2012 12:05:36 AM UTC-7, Meikel Brandmeyer (kotarak) wrote: > > Hi, > > you can use destructuring to provide defaults. And you can easily curry in

Re: Best practices for named arguments

2012-06-15 Thread David Jacobs
I'm not sure you read the whole question. I want to know how to delegate optional arguments to other functions with the same method signatures. On Friday, June 15, 2012 12:04:00 AM UTC-7, Vinzent wrote: > > TL;DR: I want to know best practices for designing functions with multiple >> optional ar

Re: Best practices for named arguments

2012-06-15 Thread Meikel Brandmeyer (kotarak)
Hi, you can use destructuring to provide defaults. And you can easily curry in options when passing things through. (defn general-descend [xy ys & {:keys [gradient-fn cost-fn yield-fn alpha iterations thetas] :or {cost-fncost yield-fn println alpha 0.0

Re: Best practices for named arguments

2012-06-15 Thread Vinzent
> > TL;DR: I want to know best practices for designing functions with multiple > optional arguments. > Use destructing: (defn f [required & {:keys [foo bar] :or {foo :default}}] [required foo bar]) (f 3 :bar 1 :foo 2) ;=> [3 2 1] (f 3 :bar 1) ;=> [3 :default 1] -- You received thi