How to display Clojure version in REPL?
Such as: (println clojure-version) ? ...
Such as: (println clojure-version) ? ...
Hey, I'm reading "Programming Clojure" and I'm interested in a book that discusses how to create macros as extensive as possible. Do you suggest a book for this? Thanks. ...
Hi, have anyone seen a Solr plugin example written in Clojure? I guess it should be straight forward, but I would appreciate a simple example before I started working on one specific plugin. Thanks. ...
Hello all. What's the latest for using VimClojure with Clojure 1.2? I've tried the instructions from a number of different pages that tell me how to set up Clojure, Leiningen and VimClojure, but I can't get any of them to properly start the REPL. There is always an exception raised from a forName() call. I read this could possibly be ...
What are the best practices for defining constants in Clojure in terms of style, conventions, efficiency, etc. For example, is this right? (def *PI* 3.14) Questions: Should constants be capitalized in Clojure?...
Hi All, I'm performing streaming reads of an object using BufferedReader. I need to do two things with this object: Pass it to a SuperCSV csv reader Obtain the raw lines and keep them in a (Clojure) lazy sequence Currently, I am having to use two different BufferedReaders: one as an argument to a SuperCSV CSV reader class and one t...
I missed a short syntax to express fundamental operations over functions in Clojure. Because of that, I started to use º as a shorthand for comp (cause it's closer to the math operator but easily accessible) and ¬ for partial (because reminds me of missing parameters). What are your thoughts about this? is it useful or does it have the ...
Name the ways you know to start the Clojure REPL. What is your favourite ? Does it highlight things for you ? I know of : 1. NetBeans IDE with the Enclojure plugin, and 2. the Leiningen shell script : lein repl No favorite for me so far, and I'd certainly like some colors. What else ? ...
What i the difference between Clojure STM ( dosync) approach and Java synchronize Block ? Im reading the code below from "The sleeping barber" problem. (http://www.bestinclass.dk/index.clj/2009/09/scala-vs-clojure-round-2-concurrency.html) (defn the-shop [a] (print "[k] entering shop" a) (dosync (if (< (count @queue) ...
I have the option of directly implementing a Protocol in the body of a defrecord instead of using extend-protocol/extend-type (defprotocol Fly (fly [this])) (defrecord Bird [name] Fly (fly [this] (format "%s flies" name))) =>(fly (Bird. "crow")) "crow flies" If I now try to override the Fly protocol, I get an error (extend-ty...
There is printf. It prints directly to stdout. How about sprintf, which formats the same way as printf, but returns a string with no side-effects? ...
Why doesn't this produce the output I expect? (defn test-fn [] (do (println "start") (map #(println (+ % 1)) '(1 2 3)) (println "done"))) It outputs start done Whereas I would expect start 2 3 4 done ...
say i create a program in clojure and i have to deliver it to a client. the client does have some computer knowledge but he does not know/want to start the repl, load my program, and run it. he wants to double click an exe file or run a shell script how do i package my program and deliver (the program itself with the clojure jars) ? ...
For example, if the input is 825 the output expected is (0 1 2 0 1). What this means is: 0 two's, 1 three's, 2 five's, 0 seven's and 1 eleven. Doing this imperatively was quite easy for me. Functional, not so much. Could you please guide me how to go about solving the above problem in a functional way? Note: Fold/reduce ways will be pr...
I'm attempting to use clojure.contrib.io's (1.2) append-spit to append to a file (go figure). If I create a text file on my desktop, as a test, and attempt to append to it in a fresh repl, this is what I get: user> (append-spit "/Users/ihodes/Desktop/test.txt" "frank") Backtrace: 0: clojure.contrib.io$assert_not_appending.invoke(io.c...
Are there any Principles for Clojure ? a. Like the S.O.L.I.D. Object-Oriented Design Principles for OO languages like Java ? b. or others more heuristic, like "Tell don't ask", "Favor Composition vs Inheritance", "Talk to Interfaces" ? Are there any design patterns (for flexible code) ? What is the counter part of the basic of funct...
what is the purpose of namespaces ? and, more important, should they be used as objects in java (things that have data and functions and that try to achieve encapsulation) ? is this idea to far fetched ? :) or should they be used as packages in java ? or should they be used more generally as a module system or something ? ...
I'm looking for a more idiomatic way, if possible, to write the following clojure code: (import '(System.Net HttpWebRequest NetworkCredential) '(System.IO StreamReader)) (defn downloadWebPage "Downloads the webpage at the given url and returns its contents." [^String url ^String user ^String password] (def req (HttpWebRe...
I have an application that, in order to reload plugins, requires them with the :reload option whenever they are to be reloaded. I've noticed that this is building up memory about 2-3 megs at a time when I do it. I'm curious as to what could cause this sort of thing to happen. Is data from previous reloads being kept in memory? Is there a...
I'm in the process of checking out Clojure for the first time. I've found it useful looking at the (doc xxx) and (source xxx) of the Clojure core library, but I'm more concerned with how you would organise and put together a full application. Are there any excellent, open source examples of this? For example, to learn how to code well ...