'doseq instead 'for works fine:
(doseq [y (range 1999 2011), w (range 1 52)] (print-data y w))
On Jul 7, 11:14 am, Stuart Halloway stuart.hallo...@gmail.com wrote:
This usage of for is ill-advised: for is not a loop, it is a comprehension.
This will not do what you want if, for example, you
Yes, you can do this by defining an EntityResolver that corrects the
bad system id, define a SAXParser that uses that resolver, and pass
the parser into the xml/parse call. Something like this:
(import
'[javax.xml.parsers SAXParserFactory]
'[org.xml.sax EntityResolver InputSource])
(def
Here's some of Rich Hickey's rationale, from an old IRC chat (http://
clojure-log.n01se.net/date/2008-11-06.html):
Clojure doesn't allow user-defined reader macros because they can't
be combined - there's no namespace support, unlike for regular macros
the clash problem is significant - I don't
Bear in mind that Scala is about 5 years older than Clojure, so it's
had more time to build up momentum.
On Jun 18, 5:56 pm, cageface milese...@gmail.com wrote:
Unfortunately there seems to be a lot more commercial momentum for
Scala though. It's still a blip compared to the mainstream
You don't want to encode the whole URL, just the keys and values in
the query string. Something like this:
(defn encode-params [request-params]
(let [encode #(URLEncoder/encode (str %) UTF-8)
coded (for [[n v] request-params] (str (encode n) = (encode
v)))]
(apply str (interpose
As Lauren Petit points out, you need the macro to define the whole
desired result. Something like this should do it:
(defmacro defautoroutes [name paths]
(let [getps (for [p paths] `(GET ~(str / p) (foo ~p)))]
`(defroutes ~name ~...@getps)))
(defautoroutes all-routes one two three)
On
Per Alex Osborne's reference to BigInteger constructors, here's a
random BigInteger function:
(defn rand-bigint [#^BigInteger bign, #^Random rnd]
(let [bits (inc (.bitLength bign))
bigr (BigInteger. bits rnd)]
(- bign (.multiply bigr) (.shiftRight bits
--
You received this
The attr-map adds key-value pairs to the metadata for the function
symbol. The doc for 'defn' makes this clearer.
On Jan 20, 8:02 am, Jacek Generowicz jacek.generow...@googlemail.com
wrote:
In Clojure 1.1.0, the documentation states:
clojure.core/defmulti
([name docstring? attr-map?
(apply arg)
On Oct 21, 7:49 pm, samppi rbysam...@gmail.com wrote:
Is there a standard function that takes one argument and calls it?
That is, the function equivalent to #(%). Or is that the best idiom
there is?
--~--~-~--~~~---~--~~
You received this message