your problem is '
' makes xml/parse a symbol and stops evaling it to a function
symbols are callable like keywords so if you have a hash with symbols
as keys you can
('a {'a 1 'b 2}) -> 1
so ('xml/parse "/Users/me/correct/path/to/my.xml") is trying to lookup
'xml/parse in "/Users/me/correct/path/t
- is not a "Java letter or digit" so it is not allowed in java method names.
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.8
user=> (Character/isJavaIdentifierPart (int \-))
false
user=>
On Fri, Jan 16, 2009 at 9:56 AM, Greg Harman wrote:
>
> I think I may have found a
and is also written as a macro to short circuit evaluation:
clojure.core/and
([] [x] [x & rest])
Macro
Evaluates exprs one at a time, from left to right. If a form
returns logical false (nil or false), and returns that value and
doesn't evaluate any of the other expressions, otherwise it re
On Fri, Jan 16, 2009 at 12:22 PM, Greg Harman wrote:
>
>> > 2. If I want the Clojure functions that underlie the methods in the
>> > generated class used directly by my Clojure code as well (which I do),
>> > then I'm stuck having to either violate standard Clojure/Lisp function
>> > naming conve
prn
On Fri, Jan 23, 2009 at 11:00 AM, Kevin Albrecht wrote:
>
> Below are two operations that print (1 2 3 4). How can I do something
> similar to print ("1 2 3" 4) to standard out?
>
> (println '("1 2 3" 4))
> -> (1 2 3 4)
>
> (def x "1 2 3")
> (println `(~x 4))
> -> (1 2 3 4)
>
> --Kevin Albr
instead of using binding and eval, you can generate a (fn ) form, eval
it, keep the result function stuffed away somewhere and apply it
instead of calling eval all the time
On Fri, Jan 23, 2009 at 1:10 PM, Zak Wilson wrote:
>
> It does seem like a legitimate use for eval, at least at first glanc
there is when-let, if-let, etc, that combine conditionals and lexical binding
On Fri, Jan 23, 2009 at 1:31 PM, BerlinBrown wrote:
>
> What is an idiom to call a function and also retain the result. For
> example, I see myself doing this a lot, but it seems to more code than
> would be needed.
>
(doc count)
-
clojure.core/count
([coll])
Returns the number of items in the collection. (count nil) returns
0. Also works on strings, arrays, and Java Collections and Maps
nil
On Wed, Jan 28, 2009 at 11:15 AM, Peter Wolf wrote:
>
> Here's a dumb question, but I can
actually rhickey showed up on irc and pointed something out:
15:23 rhickey : user=> (.contains [1 2 3] 2)
15:23 rhickey : true
15:23 rhickey : user=> (.contains '(1 2 3) 2)
15:23 rhickey : true
15:23 rhickey : what contains debate? :)
so because seqs, vectors, etc are java collect
have you looked at the available java frameworks like hadoop? there is
also some kind of java interface to erlang
instead of reinventing the wheel again...
On Thu, Jan 29, 2009 at 6:15 AM, Greg Harman wrote:
>
> One of Clojure's big selling points (obviously) is the support for
> concurrent prog
clojure-slim.jar lacks compiled clojure code. The java code is
compiled, so clojure-slim.jar is still completely usable as clojure,
it just have to compile things like core.clj when it loads them.
On Thu, Jan 29, 2009 at 4:56 PM, kkw wrote:
>
> Hi folks,
>
>I noticed that when I run 'ant' t
as a namespace is to a java package, defn- is to private, and defn is to public
On Tue, Feb 3, 2009 at 8:19 PM, Terrence Brannon wrote:
>
> What is the significance of the dash after defn? How does it differ
> from defn?
>
> Source:
> http://www.codepoetics.com/wiki/index.php?title=Topics:SICP_i
you can also use map destructuring.
(defn x [{:keys [a b c]}]
[a b c])
user=> (x {:a 1 :b 2 :c 3})
[1 2 3]
On Fri, Feb 6, 2009 at 7:52 AM, Jeffrey Straszheim
wrote:
> That is remarkably simple and elegant.
>
> On Fri, Feb 6, 2009 at 10:20 AM, Stuart Sierra
> wrote:
>>
>> On Feb 6,
I am not sure exactly how preduce differs from normal reduce, but
reduce is not a lazy operation, so it will result in the realization
of a lazy seq passed to it.
On Sun, Feb 8, 2009 at 2:13 PM, Jeffrey Straszheim
wrote:
> I have this piece of code:
>
> (defn- run-work-elements-in-parallel
> "
fn has an implicit (do ...)
#(do ...) behaves the same way.
#(a b c) expands to
(fn [] (a b c))
if you put in multiple forms you get
#((a b)(c d))
expands to
(fn [] ((a b) (c d)))
note the (a b) in the operator position.
On Tue, Feb 10, 2009 at 8:09 PM, Mark Volkmann
wrote:
>
> Just checking my
http://www.exampledepot.com/egs/java.io/CreateTempFile.html
On Sat, Feb 14, 2009 at 4:38 PM, Mark H. wrote:
>
> On Feb 14, 6:48 am, James Reeves wrote:
>> I've been having some difficulty coming up with a scheme for writing
>> to files in a thread-safe manner. The files are named with the hash
You might be interested in my pet macro: pl
http://github.com/hiredman/odds-and-ends/blob/8a84e6ddbad9d71f714ba16c3e1239633228a7eb/functional.clj#L94
it does transformations on code using zippers.
for example:
(pl inc $ inc $ 0) expands to (inc (inc 2))
pl is just a toy but it might be worth lo
filter, http://clojure.org/api#filter
On Tue, Feb 24, 2009 at 7:38 PM, Sean wrote:
>
> I've got the following list
>
> (:a nil nil :b :a)
>
> I want to call a "nil-killer" function, and get the following list
>
> (:a :b :a)
>
> How do I go about this? Could someone post a quick example?
> >
>
You should look at "->"
it lest you take (op3 (op2 (op1 input))) and write it as (-> input op1 op2 op3)
there is also "comp" which composes functions, and partial for partial
application.
some example comp usage:
http://github.com/hiredman/clojurebot/blob/297e266b0badf0f301a556e95771b940a80016e7/
Jline is known to have issues with unicode.
On Fri, Mar 6, 2009 at 2:58 PM, max3000 wrote:
>
> I'm getting similar results without jline.ConsoleRunner. Also as I
> mentioned I use RT.loadResourceScript and get the same results.
>
> However, I'm using the clojure release from 2008-12-17 (the only
I don't know how many arguments the method you are overriding with
onLogin takes, but the function you define should take one more
argument then the method you are overiding, the first argument being
an explicit reference to an instance
On Tue, Mar 10, 2009 at 12:16 PM, rb wrote:
>
> HI Chris,
>
if your walk pushes the items into a Queue, you can just reduce across the Queue
On Wed, Mar 11, 2009 at 9:24 AM, Jeffrey Straszheim
wrote:
> Currently the clojure.contrib.walk code provides a nice way to perform a
> depth first map operation on trees. However, I need to fold across a tree.
> I
this came up on irc starting:
http://clojure-log.n01se.net/date/2009-02-18.html#23:49
and the solution:
http://clojure-log.n01se.net/date/2009-02-19.html#0:30
On Wed, Mar 18, 2009 at 11:03 AM, Konrad Hinsen
wrote:
>
> Consider the following session:
>
> user=> /
> #
> user=> clojure.core//
> #
Symbols starting and ending with "." are reserved.
see http://clojure.org/reader the section on Symbols
On Wed, Mar 18, 2009 at 12:58 PM, Michael Wood wrote:
>
> On Wed, Mar 18, 2009 at 8:22 PM, Kevin Downey wrote:
>>
>> this came up on irc starting:
>> http
the api doc documents the latest release of clojure, which is the
pre-lazy release from back in december I believe.
On Wed, Mar 18, 2009 at 3:59 AM, Notfonk wrote:
>
> Hey
>
> i'm not sure this is the right place to post that
>
> Could you please remove lazy-cons from the api doc ? I'm a newbie
you want defmacro not definline. the result of a macro is a data
structure. that data structure is then evaluated in place of the call
to the macro. definline (I think?) behaves similar to a function, so
if it returns a data structure, you just get that data structure (the
data structure is not th
(defn mapmap [fn m]
(into {} (map #(vector (first %) (fn (second %))) m)))
On Sun, Mar 22, 2009 at 1:10 PM, Jon Nadal wrote:
>
> I often need to map a function over the values of a map while
> preserving keys--something like:
>
> [code]
> (defn mapmap [fn m]
> (let [k (keys m)
> v (m
ooh for
On Sun, Mar 22, 2009 at 9:27 PM, Jeff Valk wrote:
>
> On 22 March 2009 23:14, Timothy Pratley wrote:
>
>> Golf time!
>>
>> (defn mapmap [f m]
>> (into {} (map (fn [[x y]] [x (f y)]) m)))
>
> Ah, golf... :-)
>
> (defn mapmap [f m]
> (into {} (for [[k v] m] [k (f v)])))
>
> >
>
--
something like this came up on irc the other day. this is a good
opportunity for someone to write some macros that allow you to
specify a validator function for structs similar to refs and agents.
On Sat, Mar 28, 2009 at 2:20 PM, mikel wrote:
>
>
>
> On Mar 28, 4:05 pm, billh04 wrote:
>> I am
(.toString *ns*)
On Sun, Apr 5, 2009 at 12:39 PM, Stephen C. Gilardi wrote:
>
> On Apr 5, 2009, at 3:23 PM, dysinger wrote:
>
>> I need coffee - too many typos. I meant to say "I am trying to avoid
>> _typing_ 'x.y.z' twice"
>>
>> (str (the-ns 'user)) is is even more human-error prone than just
I think you misunderstand, I don't think he is expecting to being able
to use :foo as a key twice with different metadata.
I think he wants something like:
(def x {[:a] 1 [:b] 2})
then
(meta (first (keys (assoc x (with-meta [:a] {:x 1}) 2
;(-> (assoc x (with-meta [:a] {:x 1})) keys first m
I would be interested in seeing a full stack trace and some pastbined
code. there are no clojure strings, just java strings, and java
strings are charsequences.
On Thu, Apr 16, 2009 at 11:25 AM, prhlava wrote:
>
>
> Hello,
>
> I am trying to use a java library ( http://code.google.com/p/webdrive
ifn? returns true for things that implement clojure.lang.IFn, IFn is
the interface for things that can be put in the operator position in a
s-expr:
functions
vectors
maps
sets
keywords
symbols
...?
fn? returns true for just functions
On Sat, Apr 18, 2009 at 9:37 PM, tmountain wrote:
>
> Sorry f
no, the syntax is not the same.
user=> (macroexpand-1 '(.foo bar))
(. bar foo)
On Mon, Apr 27, 2009 at 2:51 PM, Boris Mizhen wrote:
>
> Hi Meikel, thanks for the answer.
>
> I wonder if someone could explain or point me to the explanation about
> *why* a Java static fn can't be passed just li
(into {} (apply map vector
'((cars bmw chevrolet ford peugeot)
(genres adventure horror mystery
{ford mystery, chevrolet horror, bmw adventure, cars genres}
On Mon, May 4, 2009 at 4:03 PM, Michel S. wrote:
>
>
>
> On May 4, 5:07 pm, Christophe Grand wrote
user=> (doc take-while)
-
clojure.core/take-while
([pred coll])
Returns a lazy sequence of successive items from coll while
(pred item) returns true. pred must be free of side-effects.
nil
user=>
On Thu, May 7, 2009 at 2:11 PM, CuppoJava wrote:
>
> I'm trying to acco
so I took a look at with this code:
http://gist.github.com/111935
output:
:original
"Elapsed time: 369.683 msecs"
:redux-1
"Elapsed time: 11672.329 msecs"
:redux-2
"Elapsed time: 74.233 msecs"
as to why there is such a huge difference between your code and
redux-2 I am not sure.
I would defin
http://gist.github.com/120289 using queues and Threads instead of agents
On Fri, May 29, 2009 at 4:11 PM, Laurent PETIT wrote:
>
> Hi,
>
> here is a second attempt, partly inspired by clojure's agents page,
> that looks better (true direct ring of agents, not just indirect ring
> via vector), an
two element vectors implement MapEntry, (into {} x) x needs to be
something that seq can be called on and will return a seq of MapEntrys
On Mon, Jun 1, 2009 at 10:39 AM, samppi wrote:
>
> Why does using a list with into and a map throw an exception, while
> using a vector is fine?
>
> Clojure 1
the new entry point is clojure.main
java -cp clojure.jar clojure.main ;no slash, with the corrent jar name
java -cp clojure.jar clojure.main --help
will print a nice help message
On Sun, Jun 7, 2009 at 8:20 AM, darrell wrote:
>
> OK, embarrassing
>
> Thanks, I was caught wishing to see a wow
you need to pass something in.
example:
=> (-> "foo" String. String.)
"foo"
=> (macroexpand '(-> String. String.))
(new String String.)
=> (macroexpand '(-> "foo" String. String.))
(new String (clojure.core/-> "foo" String.))
=> (macroexpand '(-> "foo" String.))
(new String "foo")
String. is o
gt; (String. (String.))
> ""
> user=> (macroexpand (String. (String.)))
> ""
> user=> (macroexpand `(String. (String.)))
> (new java.lang.String (java.lang.String.))
>
> Nesting is a must :)
> Thank you both for your helpful reply
>
> On Jun
On Tue, Jun 9, 2009 at 7:49 PM, Richard Newman wrote:
>
> Thanks, Konrad and Andrew, for chipping in!
>
>>> There's an outline of an implementation of multisets (I think that's
>>> the same as your bags) at:
>>>
>>> http://code.google.com/p/clojure-contrib/source/browse/trunk/src/
>>> cloju
On Sat, Jun 13, 2009 at 2:02 PM, Wrexsoul wrote:
>
> Now I'm working on some Swing code and came up with these, which are
> obviously going to be useful:
>
> (defmacro do-on-edt [& body]
> `(SwingUtilities/invokeLater #(do ~...@body)))
>
> (defmacro get-on-edt [& body]
> `(let [ret# (atom nil)]
On Sat, Jun 13, 2009 at 2:55 PM, Meikel Brandmeyer wrote:
> Hi,
>
> Am 13.06.2009 um 23:29 schrieb Meikel Brandmeyer:
>
>> (defmacro get-on-edt
>> [& body]
>> `(get-on-edt* (fn [] ~body)))
>
> Of course ~...@body instead of ~body...
>
> Sincerely
> Meikel
>
>
I know you (Meikel) already fixed i
ext foo "bar")))
On Sat, Jun 13, 2009 at 5:23 PM, Aaron Cohen wrote:
>
> Isn't this a case of wrapping a Java API needlessly?
>
> What's so bad about: (SwingUtilities/invokeLater my-func) ?
> -- Aaron
>
>
>
> On Sat, Jun 13, 2009 at 5:59 PM, Kevin Dow
user=> (def s (StringBuilder. "aaa"))
#'user/s
user=> (. s setCharAt 0 \b)
nil
user=> s
#
user=> (. s setCharAt (int 0) (char \b))
nil
user=> (. s setCharAt (int 0) (char \e))
nil
user=> s
#
user=>
works for me
On Sat, Jun 13, 2009 at 7:28 PM, tmountain wrote:
>
> I'm writing some simple code,
you can use apply to avoid in-lining:
user=> (binding [+ -] (apply + '(5 3)))
2
On Tue, Jun 16, 2009 at 11:16 AM, Michel S. wrote:
>
>
>
> On Jun 16, 1:42 pm, Paul Stadig wrote:
>> On Tue, Jun 16, 2009 at 1:38 PM, Michel Salim wrote:
>>
>>
>>
>> > It's currently not possible to dynamically reb
On Sun, Jul 5, 2009 at 5:18 AM,
philip.hazel...@gmail.com wrote:
>
> Hi,
>
> The following code works as expected:
>
> (import 'javax.imageio.ImageIO 'java.io.File
> 'java.awt.image.BufferedImage)
> (defn bi-get-pixels
> [bi]
> (vec (.. bi (getData) (getPixels 0 0 (.getWidth bi) (.getHeight bi)
On Fri, Jul 10, 2009 at 1:00 PM, Daniel Lyons wrote:
>
>
> On Jul 10, 2009, at 12:24 PM, Sean Devlin wrote:
>
>>
>> A quick java program:
>>
>> public static void main(String[] args) {
>> System.out.println(1.0/0.0);
>> }
>>
>> Infinity
>>
>>
>> On Jul 10, 11:08 am, John Harrop wrote:
>>> This
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
the sequence functions operate on sequences. if you pass in something
that is not a sequence, like a vector, they call seq on it internally.
so what you get back from filter or map is a sequence. conj has
consistent behavior across types, you just get a different type out of
map/filter/etc then wh
closures capture lexical scope, binding creates dynamic scope. lexical
scope is where a closure is defined, dynamic is when it is called.
because filter is lazy, the closure is called outside the dynamic
scope created by binding
On Jul 14, 1:07 pm, Aaron Cohen wrote:
> I'm a little unclear on w
this is how you do it:
user=> (def a 0)
#'user/a
user=> (binding [a 1] (map #(+ % a) (range 5)))
(0 1 2 3 4)
user=> (binding [a 1] (let [a a] (map #(+ a %) (range 5
(1 2 3 4 5)
user=>
you capture the dynamic scope in the lexical scope so the closure can
close over it.
dunno how applicable t
yes there is a way: http://clojure.org/multimethods
On Fri, Jul 24, 2009 at 11:44 AM, BerlinBrown wrote:
>
> Are there ways to override functions so that if you have different
> parameters, you get different logic?
> >
>
--
And what is good, Phaedrus,
And what is not good—
Need we ask anyone
user=> (defmulti length empty?)
#'user/length
user=> (defmethod length true [x] 0)
#
user=> (defmethod length false [x] (+ 1 (length (rest x
#
user=> (length [1 2 3 4])
4
On Fri, Aug 21, 2009 at 12:41 PM, Michel
Salim wrote:
>
> On Fri, 2009-08-21 at 11:02 -0700, Sigrid wrote:
>> Hi,
>>
>
I think this would necessitate an added layer of indirection and
reflection, which would mean taking a performance hit.
On Mon, Aug 31, 2009 at 2:54 PM, Stuart
Sierra wrote:
>
> That's a clever trick. How does the block know which interface method
> was invoked?
> -SS
>
> On Aug 31, 2:41 pm, rb
you could try running this test script:
http://gist.github.com/179346
the script downloads clojure and does a test aot compile.
if everything works the only output you should see is "Hello World"
example:
hiredman rincewind ~% sh ./clojure-aot-test.sh
Hello World
On Tue, Sep 1, 2009 at 11:3
gen-class generates a stub java class that dispatches to clojure
functions, you can re-def the clojure functions that back the stubbed
out class.
On Sat, Sep 5, 2009 at 12:10 PM, Gorsal wrote:
>
> I am trying to add clojure code to an eclipse plugin. To do so, the
> code i compiled into class fil
de
> in it. So I can't simply redef it...
>
> -Original Message-
> From: clojure@googlegroups.com [mailto:cloj...@googlegroups.com] On Behalf Of
> Kevin Downey
> Sent: Saturday, September 05, 2009 7:46 PM
> To: clojure@googlegroups.com
> Subject: Re: Dynamically Chang
you are using an atom as a temporary variable. please don't do that.
(doseq [f files]
(with-open [of (open-file f)]
(do-dangerous-io of)))
On Sun, Sep 13, 2009 at 1:05 PM, Constantine Vetoshev
wrote:
>
> I have some code which opens a bunch of resources (say, files), and
> needs to make
user=> (macroexpand '(with-open [x A y Y] do stuff here))
(let* [x A] (try (clojure.core/with-open [y Y] do stuff here) (finally
(. x clojure.core/close
user=>
with-open expands to a (try (finally (.close ...)))
On Sun, Sep 13, 2009 at 7:38 PM, Richard Newman wrote:
>
>> Clojure does not se
have you seen http://clojure.org/patches ?
On Wed, Sep 16, 2009 at 12:53 PM, Howard Lewis Ship wrote:
> What is the procedure for getting patches (to clojure-contrib) committed?
> I've created a couple of issues in Assembla, created and attached patches.
> What's the next step to get it actually
:(
map is lazy, so you'll need to wrap it in doall
(dotimes [i 4] (println "Happy Birthday" ({2 "Dear XXX"} i "To You")))
On Thu, Sep 17, 2009 at 9:17 PM, David Nolen wrote:
> Actually to be fair, here's a Clojure version that uses as little whitespace
> as the Scala and Java ones do.
> (map #
If any exceptions are thrown by an action function, no nested
dispatches will occur, and the exception will be cached in the Agent
itself. When an Agent has errors cached, any subsequent interactions
will immediately throw an exception, until the agent's errors are
cleared. Agent errors can be exa
I think the point of this style of api is you just define your functions like
(defn one [] )
(defn two [] )
and call the function like
(redis/with-server *db*
(one) (two))
On Thu, Oct 22, 2009 at 2:44 PM, Radford Smith wrote:
>
> I'm trying out redis-clojure. Right now, my code looks li
you can always just construct the call as a string or as a
datastructure and pass it through read/eval
On Wed, Oct 28, 2009 at 2:04 PM, Meikel Brandmeyer wrote:
> Hi,
>
> Am 28.10.2009 um 20:46 schrieb Tiago Antão:
>
>> But my point is to be able to construct the method name in runtime.
>
> You'
user=> ((eval `(fn [x#] (~(symbol ".setFileSelectionMode") x# 1))) jfc)
nil
user=>
On Thu, Oct 29, 2009 at 6:38 AM, Meikel Brandmeyer wrote:
>
> Hi,
>
> On Oct 29, 2:07 pm, Tiago Antão wrote:
>
>> The eval form still shows some problems, if I do this preparation:
>>
>> (import javax.swing.JFil
eval calls read for somethings.
2009/10/30 Tiago Antão :
>
> On Thu, Oct 29, 2009 at 1:38 PM, Meikel Brandmeyer wrote:
>>> All good here, but, if I do the eval variation,
>>> user=> (eval (list (symbol ".setFileSelectionMode") jfc 1))
>>
>> Another example which shows that eval is not worth the
it'd be nice if clojure came with an Exception class that extended
IMeta so you could use (catch MetaException e (if (= :my-exception
(type e)) do-stuff (throw e)))
On Sun, Nov 1, 2009 at 1:07 PM, Meikel Brandmeyer wrote:
> Hi,
>
> Am 01.11.2009 um 20:47 schrieb Teemu Antti-Poika:
>
>
>> The onl
(Integer/parseInt "5") is actually (. Integer parseInt "5") which
works fine because "." is the operator position, and "." is a special
form
On Mon, Nov 2, 2009 at 11:32 AM, ataggart wrote:
>
> If (Integer/parseInt "5") works, then not all functions need be an
> implementation of IFn; or perhaps
(f (first items)) => nil
((f (first items)) (for-each f (rest items))) => (nil (for-each f
(rest items))) => (.invoke nil (for-each f (rest items))) => calling a
method on nil is a NPE
lists are function applications
On Tue, Nov 3, 2009 at 9:33 AM, Dean Wampler wrote:
> I'm working the exercise
I don't understand, the error message you get is the error that occurred.
the docstring from even? says it throws an exception if the argument
is not and integer.
I would hope that anyone that has read the docstring for contains?
would not use (contains? 'foo 'bar), because, uh, that just makes
the behavior of functions outside of their domain is undefined. I
guess I still don't get it. why would you use a function on something
outside of its domain? do people just pick functions at random to
compose their programs?
2009/11/9 Tiago Antão :
>
> On Mon, Nov 9, 2009 at 8:0
ammers have developed a culture
> where errors are generally not caught or disguised in any way.
> There's sort of a "crash early and crash hard" philosophy, to increase
> the likelihood that a crash will happen in the block of code that is
> causing the problem and not late
http://paste.lisp.org/display/87611#2
"infinite seq of swing events"
On Thu, Nov 12, 2009 at 1:48 AM, Jeff Rose wrote:
> On Nov 12, 1:22 am, nchubrich wrote:
>> I'm curious what the best idiomatic way of handling events is (e.g.
>> receiving a series of messages and dispatching functions on the
user=> (import 'java.util.HashMap)
java.util.HashMap
user=> (def m (doto (HashMap.) (.put 'a :a) (.put 'b :b)))
#'user/m
user=> m
#
user=> (into {} m)
{b :b, a :a}
user=> (class *1)
clojure.lang.PersistentArrayMap
user=>
On Tue, Nov 17, 2009 at 1:56 PM, Richard Newman wrote:
> Sean,
>
> If the c
1.1 is not representable as an Integer(Java class, or primitive int)
and is not an integer (mathematical sense) so expecting to be
representable as one, is kind of... odd.
On Sun, Nov 22, 2009 at 4:14 PM, Don wrote:
> I am having a problem converting a string to decimal. I want to
> convert "1.0
user=> (read-string "1.1")
1.1
user=>
On Sun, Nov 22, 2009 at 4:48 PM, Don wrote:
> Thanks a bunch Richard.
>
> On Nov 22, 4:47 pm, Richard Newman wrote:
>> > I am having a problem converting a string to decimal. I want to
>> > convert "1.0" to decimal 1.0.
>>
>> For a double (not decimal):
>>
future also uses the same threadpool as agents, so once you call
future the threadpool spins up, and just sort of sits around for a
while before the jvm decides to exit, which is why the program would
sit around for 50 seconds
On Wed, Nov 25, 2009 at 10:30 AM, Hong Jiang wrote:
> Thanks for your
uh, and you just want the agent to reference an empty vector?
(send a (comp second list) [])
(send a (constantly []))
(send a empty)
...
On Tue, Dec 1, 2009 at 2:37 PM, Don wrote:
> I actually came up with this function that takes in an agent and
> proceeds to pop each item while agent still has
user=> (vec (map min [2 4 6 7] [1 3 9 2] [2 4 5 6] [6 1 3 8] [4 8 2 1]))
[1 1 2 1]
user=>
On Wed, Dec 2, 2009 at 2:53 PM, Stefan Kamphausen
wrote:
> Hi,
>
> On Dec 2, 11:43 pm, Don wrote:
>> I am having difficulty approaching this problem. I'm not sure if it
>> can be done in one swoop, or re
instant second lisp: just write your own interpreter
On Sun, Dec 20, 2009 at 6:39 PM, Jonathan Smith
wrote:
> Lisp Flavored Erlang is an extremely interesting lisp. in my opinion.
>
> You get Erlang, and you also get s-expressions and macros.
>
> Common Lisp and Scheme are the obvious choices, I
I think something more abstract would be good. A function or macro
where you pass it an "IO Spec" and it takes care of all the class
stuff.
(io/read [:bytes :from :as p]
(do-stuff-with-a-byte p))
(io/read [:lines :from :as p]
(do-stuff-with-a-string p))
(io/read [:lines :from ]) ;no :as b
I have been playing with a gui repl for clojure: http://github.com/hiredman/Repl
instructions are light, but you can check it out, and use lien to jar
it up, it is gen-class'ed (but does not require AOt'ing) and has a
-main function so you can run it from an uberjar.
http://www.thelastcitadel.com/
ah, well, the differences are:
a. this repl is written in Clojure
b. this repl can "print" arbitrary jcomponents, not just text. for
example in the screenshot a ChartPanel from JFreeChart is rendered in
the repl
On Sun, Jan 3, 2010 at 11:42 PM, Albert Cardona wrote:
> I built a Swing REPL for c
java uses local settings, on windows the default encoding is some
godawful thing (same on Mac, still godawful, but different) set
file.encoding to pick something sane
On Wed, Jan 13, 2010 at 1:52 PM, Lukas Lehner wrote:
> Hi all
>
> The clojure unicode reading, evaluating and printing was discuss
ant now is actually REPL
> user=> (System/setProperty "file.encoding" "UTF8")
> "UTF8"
> user=> "éőó"
> "�o�"
> user=>
>
> L
>
> On 1/13/2010 11:34 PM, Kevin Downey wrote:
>>
>> java uses local setti
what you are seeing is the transition from arraymap to hashmap
On Mon, Jan 18, 2010 at 6:46 PM, Stuart Halloway
wrote:
> Is this expected behavior?
>
> {1 "this" 1 "is" 1 "strange"}
> => {1 "this", 1 "is", 1 "strange"}
>
> (into {} {1 "this" 1 "is" 1 "strange"})
> => {1 "strange"}
>
> {1 "this" 1
clojure structs are an optimized version of maps for a set of shared
keys. if you don't have a defined set of shared keys you just have a
map. so by all means, use a map
On Tue, Jan 19, 2010 at 3:52 PM, Andreas Wenger
wrote:
> Hi,
>
> I would like to know why defstruct without providing any keys
, Jan 19, 2010 at 3:59 PM, Andreas Wenger
wrote:
> On 20 Jan., 00:56, Kevin Downey wrote:
>> clojure structs are an optimized version of maps for a set of shared
>> keys. if you don't have a defined set of shared keys you just have a
>> map. so by all means, use a map
&g
how is that not an argument? I'm pretty sure I just used it as one.
keep in mind defstruct is largely to be superseded by deftype.
http://clojure.org/contributing
On Tue, Jan 19, 2010 at 4:10 PM, Andreas Wenger
wrote:
>> I fail to see how it requires changing a lot of code. it just means
>> you
I think your use of "workaround" is pejorative. And can it even be
called a work around if it is a best practice even when there is
nothing to work around?
On Tue, Jan 19, 2010 at 4:28 PM, Andreas Wenger
wrote:
>> how is that not an argument? I'm pretty sure I just used it as one.
>
> What I want
"empty classes in Java" what does that mean?
as I said, structs are an optimization on maps, that optimization
doesn't work for empty structs, so empty structs "of course" don't
make sense
On Wed, Jan 20, 2010 at 12:39 AM, Andreas Wenger
wrote:
>> I think your use of "workaround" is pejorative.
for is lazy, and your code formatting is horrible.
On Tue, Feb 2, 2010 at 2:48 PM, Wardrop wrote:
> I've noticed that the output of a script, is often different to the
> output of the same commands if run on the REPL. This makes sense, but
> here's a situation which has got me a little confused.
the 11th at Zokas is good for me
On Wed, Feb 3, 2010 at 10:07 PM, ajay gopalakrishnan wrote:
> I'm in!
> But on 11th. I cannot make it on 15th
>
>
> On Wed, Feb 3, 2010 at 7:01 PM, Phil Hagelberg wrote:
>>
>> Hello, clojurists of Seattle.
>>
>> Let's meet! I'm thinking of getting folks together
don't use def inside functions, ever. in scheme define is lexically scoped,
so you do that sort of thing. clojure is not scheme. if you want a lexically
scoped function use a lexical scoping construct like let or letfn.
On Mon, Feb 8, 2010 at 12:12 PM, Brenton wrote:
> What is the Clojure best p
scheme's define is scoped inside a function. clojure is not scheme.
clojure's def (which defn uses) is not lexical or scoped in anyway, it
always operates on global names. if you want lexical scope please use
one of clojure's lexical scoping constructs, let or letfn.
On Wed, Feb 10, 2010 at 1:28 P
http://clojure.org/contributing
seq-utils was recently renamed:
http://groups.google.com/group/clojure-dev/browse_thread/thread/49068754a8c2efb9#
On Wed, Feb 10, 2010 at 3:38 PM, Wardrop wrote:
> I've written a function which I think would be a good inclusion into
> the Clojure.Contrib library. I
http://groups.google.com/group/clojure-dev/browse_thread/thread/d090b5599909497c#
On Wed, Feb 10, 2010 at 3:57 PM, Wardrop wrote:
> Thanks for the link.
>
> As part of my second question, could someone take a look at the code
> I've posted and tell me if it's a good implementation and follows
> c
1 - 100 of 324 matches
Mail list logo