to rethink your design,
perhaps by using different names for the super and sub methods.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post to this group, send email to clojure
On Mar 22, 10:34 am, Mark Volkmann r.mark.volkm...@gmail.com wrote:
(defn get-output [fn]
(let [sw (StringWriter.)]
(binding [*out* sw] (fn))
(.toString sw)))
This is what clojure.core/with-out-str does.
-Stuart Sierra
--~--~-~--~~~---~--~~
You
argument types. You need one method with a
conditional:
(defn create-visitor []
(proxy [VoidVisitorAdapter] []
(visit [arg1 arg2]
(if (instance? MethodDeclaration arg1)
...
You could also define a multimethod and call it from the proxy.
-Stuart Sierra
equality would be difficult to impossible
in Clojure, since it relies on Java's hash/pointer/equality semantics.
But Enchilada looks interesting, and a hash-based data structure in
Clojure would also be interesting.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received
system is pretty popular and even
supported by build tools other than Maven
Maven is a big, complicated beast, but... it's there, it's widely
deployed, and it's Java. That makes it a good choice in my book. The
less new infrastructure Clojure requires, the better, I believe.
-Stuart Sierra
(NO_SOURCE_FILE:0)
; wants java.lang.Number, but I was hinting for java.lang.Double
As above, the type tag is not a constraint. But + needs a number,
and that *is* a constraint.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received this message because you are subscribed
On Mar 19, 8:22 am, Rich Hickey richhic...@gmail.com wrote:
So far it seems like sequential let has proven a useful default, and
I'd rather have one let than two.
Agreed - sequential let is a better default.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received
testing...
-Stuart Sierra
On Mar 19, 3:28 pm, Frantisek Sodomka fsodo...@gmail.com wrote:
Hello Stuart all!
As discussed in this thread:
test-is: generating and processing testing
datahttp://groups.google.com/group/clojure/browse_frm/thread/3e84efefd7c0...
, sometimes it is necessary
/
-Stuart Sierra
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to
clojure+unsubscr
On Mar 17, 4:46 am, linh nguyenlinh.m...@gmail.com wrote:
Is it possible to reload a modified Java class in REPL?
You could write a custom ClassLoader to load (and then reload) your
Java classes. Not impossible, but not trivial.
-Stuart Sierra
On Mar 16, 8:14 am, Rich Hickey richhic...@gmail.com wrote:
Did anyone consider ffilter or find-first?
I've changed it to find-first in seq-utils. That seems to be the
least objectionable name, all things considered, and has the virtue of
being easy to remember.
-Stuart Sierra
, especially in a proportional font.
Others I considered: find1, filter1, select1, pick, detect, spot,
hit, ...
pick might be good.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post
trouble than it was worth.
-Stuart Sierra
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email
consumes the entire sequence. In the
case of an infinite sequence, it may never terminate! So overloading
first would conflate two very different behaviors.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
coll)))
-Stuart Sierra
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to
clojure+unsubscr
for key-value arguments:
(ns com.example.foo
:use [clojure.contrib.duck-streams]
:import [[java.util Map ArrayList]])
But I don't think there's much to gain by changing it.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received this message because you are subscribed
Hi Allen,
Sorry I haven't kept up with this. I think, though, that it's best to
have it as a standalone library in clojure-contrib, so that people can
use it with other testing frameworks if they want to.
-Stuart
On Mar 13, 3:20 pm, Allen Rohner aroh...@gmail.com wrote:
Any other options out
generate bytecode that
the JVM will optimize.
-Stuart Sierra
--~--~-~--~~~---~--~~
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
To unsubscribe from this group
to successive instance members were null before continuing ...
This has been discussed here:
http://groups.google.com/group/clojure/browse_thread/thread/c4eb149248859a18/aab137e1d9363f67
-Stuart Sierra
--~--~-~--~~~---~--~~
You received this message because you
be a useful feature. I'll look at implementing it,
should be doable.
-Stuart Sierra
--~--~-~--~~~---~--~~
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
On Mar 11, 2:45 am, mikel mev...@mac.com wrote:
I just wanted to say thanks to Stuart Sierra for test-is.
On Mar 11, 9:15 am, stephaner stepha...@gmail.com wrote:
I use test-is too, this is a very usefull test framework.
You're both very welcome!
-Stuart Sierra
.
Therefore, this form is not safe on infinite sequences!
For example, (first (filter neg? (iterate inc 0))) never terminates.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post
.
-Stuart Sierra
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to
clojure+unsubscr
I do use this pattern, but if I were naming it I think I'd call it
find-first. But that's scarcely shorter than (first (filter ...),
which is why I've never actually defined it.
-Stuart Sierra
On Mar 8, 3:20 pm, André Thieme splendidl...@googlemail.com wrote:
I regularily stumble upon
Java doesn't have a C-like structure type, so Java objects still have
overhead. If you want the absolute minimum number of bytes in memory,
you can create Java primitive arrays in Clojure:
(make-array Integer/TYPE 100)
Then access them with the aset... and aget functions.
-Stuart Sierra
On Mar 8, 9:39 am, David Sletten da...@bosatsu.net wrote:
Is there a function to capitalize the first letter of a string or a
better way than this idiotic code?
Once again, Apache Commons to the rescue: http://tinyurl.com/d38wwq
(StringUtils/capitalize clojure)
;;= Clojure
-Stuart Sierra
-need
I don't even use struct-maps in Clojure, just plain 'ol maps, sets,
vectors, and lists. They really do provide everything you need.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group
example, you probably want print-cause-trace instead of
print-stack-trace. You probably also need a number much higher than
5 to get useful information.
Someone else put a more elaborate stack trace library on github, you
could search the list for it.
-Stuart Sierra
file as the source code (using
clojure.contrib.test-is, of course), except in cases where
dependencies make that awkward. I'm trying to train myself to write a
test for every bug I find, so I can prove that I've fixed it.
-Stuart Sierra
--~--~-~--~~~---~--~~
You
combination.
-Stuart Sierra
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to
clojure+unsubscr
, and write lookup and assoc functions that use
i*columns+j as the index.
I'm guessing (a) for small, non-sparse vectors, (b) for large, sparse
vectors, and (c) for large, non-sparse vectors. Totally untested,
unverified, and unsubstantiated. :)
-Stuart Sierra
(+ x y), a macro (and
x y), or a special form (if x y z). The choice of function/macro is
really just an implementation detail. What matters is what the form
does, and what it returns.
-Stuart Sierra
On Mar 4, 8:03 pm, Elena egarr...@gmail.com wrote:
I wonder if Clojure does employ the same
, is to build something that works alongside atoms/
agents/refs/vars, *not* something that adds a whole separate cells
API.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post to this group
On Feb 27, 9:57 am, Rich Hickey richhic...@gmail.com wrote:
I've added (back) synchronous watches (svn 1309+), which used to exist
for agents, now for all reference types.
Cool. I won't have much time to play with this until next week, but I
look forward to experimenting with it.
-Stuart
it?
Definitely. When you're applying a bunch of functions to the same
object, it can be clearer to use -. I don't use it often, but when I
do, my code is much easier to read.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received this message because you are subscribed
implementations so
far.
-Stuart Sierra
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to
clojure
for a
Clojure in a Box type of download, filling the role that IDLE does
for Python. One could easily package Waterfront, Clojure core, and
contrib in a single JAR that runs with a simple java -jar, to help
newcomers get started with the language quickly. I can help with the
build files.
-Stuart
I've occasionally thought of adding domap to clojure.contrib.seq-
utils:
(defn domap [f coll]
(doall (map f coll)))
-Stuart Sierra
On Feb 24, 1:23 pm, Jason Wolfe jawo...@berkeley.edu wrote:
You could use doseq?
Now, if you want eager evalation *and* a result seq, I think you're
stuck
I've always thought *features* was a nuisance in CL, since very few
values were ever standardized. It ends up being used like browser-
sniffing code in JavaScript.
-Stuart Sierra
On Feb 23, 12:16 pm, pmf phil.fr...@gmx.de wrote:
Some (most, if not all) CL variants have a *features*-var
. It's never caught on. For one thing, it's harder
than you think when you get into all the edge-cases. For another, it
usually doesn't offer any compelling advantages over the standard
syntax.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received this message because
where you can assert non-trivial properties that
always hold.
That's not to say there isn't a place for this in contrib. I'd be
happy to have this available as an extension to test-is, but I'd
prefer to have it in its own namespace so that test-is doesn't grow
too much.
-Stuart Sierra
On Feb 23
Hi all,
I added a file to contrib, load_all.clj, to help test which
libraries don't work under the new, lazier, Clojure. It's just a
script that requires every lib. I think I got them all; please add
any that are missing. I deliberately left out test_clojure.clj and
test_contrib.clj because
.
-Stuart Sierra
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to
clojure+unsubscr
That's really nifty, Phil! I'll have to check it out.
-Stuart Sierra
On Feb 18, 7:07 pm, Phil Hagelberg p...@hagelb.org wrote:
I've been cooking up a little tool to help with running tests using
test-is. It's a little cumbersome to need to switch back and forth
between the test buffer
that gen-class really only generates a stub
class, which dynamically loads a Clojure namespace (from source or
compiled) and uses the definitions from that namespace.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Is your Clojure app running in a REPL? I've run into situations where
it seems like the Derby lock file doesn't go away until the Clojure
process terminates.
-Stuart Sierra
On Feb 17, 10:28 am, BrianS bstephen...@enclojure.org wrote:
Has anyone had experience creating clojure applications
checkout http://clojure-contrib.googlecode.com/svn/trunk/ clojure-
contrib-lazy
-Stuart Sierra
--~--~-~--~~~---~--~~
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
On Feb 16, 3:52 pm, Jeffrey Straszheim straszheimjeff...@gmail.com
wrote:
Isn't that second url just the normal one for contrib trunk?
Oops, sorry.
svn checkout http://clojure-contrib.googlecode.com/svn/branches/lazy/
clojure-
contrib-lazy
--~--~-~--~~~---~--~~
.
I await corrections. :)
-Stuart Sierra
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to
clojure
/news/2009/020509-sicortex.html
says they use slower, cheaper processors that work best when you're
doing lots of small computations in parallel.
The part I get excited about is the 8 TB of memory. When can I get
THAT on my desk?
-Stuart Sierra
Whoops, this caught me today. Whereas let evaluates its bindings
sequentially, binding does not! Observe:
(def a a1)
(def b b1)
(let [a a2, b a] b)
;;= a2
(binding [a a2, b a] b)
;;= a1
I wouldn't call this a bug, but I think it's worth noting in the doc
string for binding.
-Stuart Sierra
point of view.
If you want different behavior, you have to check the type in your
function or use a multimethod.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post to this group, send
Thanks, Chas. Fixed in SVN rev. 448.
-Stuart Sierra
On Feb 10, 4:36 pm, Chas Emerick cemer...@snowtide.com wrote:
In the process of tracking down some failing test-is tests, I believe
I discovered that it (via stacktrace) swallows exceptions.
Specifically, when an error occurs, it uses
On Feb 6, 2:02 pm, Peter Wolf opus...@gmail.com wrote:
How does one convert a Clojure Map to the equivalent Java Map? I bet I
could do it in one line if I knew the magic.
To convert all keys to strings, there's clojure.contrib.walk/stringify-
keys.
-Stuart Sierra
.
Yes. In the current implementation of test-is, tests are compiled
into functions when they are defined. So compile-time exceptions
can't be caught. I assume these situations are fairly rare and easily
corrected.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received
:
user= (map #(/ 10 %) [1 2 0 5])
java.lang.ArithmeticException: Divide by zero
(10 5 user=
-Stuart Sierra
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post to this group, send email to clojure
Hello, New York! If you're interested, I'm presenting at the New York
Hadoop User Group [1] next Tuesday, February 10, at 6:30.
I'll talk about using Clojure with Hadoop, among other things.
[1] http://www.meetup.com/Hadoop-NYC/
-Stuart Sierra
the
result to each supplied case, evaluating whatever returns true or raising an
error otherwise. Your basic ecase like macros.
There's some code very similar to what you describe in
clojure.contrib.fcase.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received
On Feb 5, 2:12 pm, Vincent Foley vfo...@gmail.com wrote:
Do you have slides for those of us who cannot attend?
I'll post a link when I finish them. :) But my slides tend to be
images, not outlines. I don't think this meetup is recorded.
-Stuart Sierra
the action function?
My use-case is a REPL-like utility that can run each expression the
user types in a separate thread, and can kill off threads that are
misbehaving or not terminating.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received this message because you
that there are at least two other
implementations of Cell-like libraries, so clearly there's a lot of
interest in this topic.
-Stuart Sierra
On Jan 30, 8:53 am, Timothy Pratley timothyprat...@gmail.com wrote:
Hi Stuart,
On Jan 30, 1:43 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote:
I have put
A few people have gotten Clojure to run on .NET using bridges like
IKVM. Check the list archives for details.
-S
On Jan 29, 10:50 am, Shawn Hoover shawn.hoo...@gmail.com wrote:
Heartland Clojure Users,
I'm giving a presentation on Clojure next month for the Indianapolis
ALT.NETgroup. The
.
-Stuart Sierra
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to
clojure+unsubscr
(an auto-
agent) whose value is defined by an expression. Whenever one of the
other variables (agent, atom, or ref) referenced in the expression
changes its value, the expression is automatically reevaluated and the
value of the auto-agent is updated.
-Stuart Sierra
Hi Zak,
I think this is a reasonable use of eval, since you're evaluating an
expression that is generated at run-time. The alternatives are messy.
-Stuart Sierra
On Jan 23, 10:20 am, Zak Wilson zak.wil...@gmail.com wrote:
I'm trying my hand at genetic programming. (Full post about why
Hi Frank,
I'd also recommend looking at Restlet http://www.restlet.org/ and
the Java Servlets API.
-Stuart Sierra
On Jan 21, 4:39 pm, Frank ffai...@gmail.com wrote:
Hi,
I am interested in trying to use Clojure to develop web-based
applications. Can someone point me to any Clojure libraries
they are emptied or go
out of scope?
-Stuart Sierra
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email
Hi,
It means that some of the maps can be nil, but at least one of them
has to be non-nil. some requires a predicate, but since nil is
logical false, we can just use identity. Here's the behavior:
user (merge nil nil nil)
nil
user (merge {:a 1} nil {:b 2})
{:b 2, :a 1}
-Stuart
a window and runs a process forever.
That's an unfortunate side effect of using Clojure as a scripting
language like Perl or Python. Perhaps it would be more proper for the
distributed file to define a function that will run the application.
-Stuart Sierra
-seq returns a lazy sequence, but you have to consume that
sequence before with-open closes the file.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post to this group, send email
.
-Stuart Sierra
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to
clojure+unsubscr
Very interesting, Christophe. I've been playing with StringTemplate
http://www.stringtemplate.org/ lately, but this separates design
from code even further. Can it do conditionals, as in if this
variable is true, includes this HTML element?
-Stuart Sierra
On Jan 19, 5:34 am, Christophe Grand
of Java, that
means you have to accept reflection-based method calls.
-Stuart Sierra
--~--~-~--~~~---~--~~
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
...))]
(doseq [[x y] [ ...all your test values ...]]
(my-predicate x y
Peace, and happy testing.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post to this group, send email
Thanks for the comments, Luke, glad we're thinking along the same
lines!
-Stuart Sierra
On Jan 19, 1:24 pm, Luke Amdor luke.am...@gmail.com wrote:
Thanks Stuart for the with-test macro. It will make my life much
easier. I have been putting my tests in the :test metadata and running
them
! function, which works on
anything:
-
clojure.core/alter-meta!
([iref f args])
Atomically sets the metadata for a namespace/var/ref/agent/atom to
be:
(apply f its-current-meta args)
f must be free of side-effects
-Stuart Sierra
On Jan 19, 2:18 pm, Christophe Grand christo...@cgrand.net wrote:
In the only example, I use 'when-not to conditionally display an element.
Got it, I didn't recognize at first what html/show was doing.
-S
--~--~-~--~~~---~--~~
You received this message because
some complicated metaprogramming.
-Stuart Sierra
On Jan 18, 5:11 am, anand.prabhakar.patil
anand.prabhakar.pa...@gmail.com wrote:
Hi all,
I'm new to Java, Lisp and Clojure, so please be patient. I'm trying to make
a function that behaves as follows: (my-deref x) returns x if x is a var, or
@x
or on the blog.
-Stuart Sierra
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to
clojure+unsubscr
You might be able to write this using reduce, but I'm not sure
exactly what you're trying to achieve here. Do you have a more
concrete example?
-S
On Jan 18, 2:55 pm, DavidH davidh...@gmail.com wrote:
In the code I'm writing, I seem to run into a certain pattern a lot.
Often enough anyway
of. Some macros examine their arguments to decide what
kind of code to produce, and some depend on lazy evaluation, like
and or cond. These macros cannot simply be wrapped in functions.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received this message because you
, not an interpreter. The compiler
doesn't remember syntax. There is no running image in the Smalltalk
sense.
So the 100% perfect refactoring you have in mind may not be possible
without reimplementing a large portion of Clojure itself.
-Stuart Sierra
(like show, source, javadoc) and just call them through SWANK.
-Stuart Sierra
--~--~-~--~~~---~--~~
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
To unsubscribe
-
clojure
-Stuart Sierra
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to
clojure+unsubscr
architecture. Java's
just-in-time compiler generates optimized assembly for every
architecture. It's not perfect, but steadily improving.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group
Hello, fellow Stuarts, and others,
Fixed now, SVN rev. 377. I've temporarily abandoned the fancier error
reporting I had for functional predicates. I'm going to try to
restore that without breaking anything else. :)
Peace, love, and happy testing,
-Stuart Sierra
On Jan 16, 7:54 am, Stuart
On Jan 16, 11:02 am, Stuart Sierra the.stuart.sie...@gmail.com
wrote:
Fixed now, SVN rev. 377. I've temporarily abandoned the fancier error
reporting I had for functional predicates. I'm going to try to
restore that without breaking anything else. :)
Ok, I figured out how to do it. Now
Hi Allen,
Good idea. But instead of setting *e I've modified report to print
a brief stack trace for every error. See if that works.
-Stuart Sierra
On Jan 14, 11:30 pm, Allen Rohner aroh...@gmail.com wrote:
Here's a trivial patch that I've found useful. After catching an
uncaught exception
simpler.
-Stuart Sierra
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to
clojure+unsubscr
There is a standalone compiler that runs without the REPL:
clojure.lang.Compile. The best examples of using it are the Ant
build.xml files for Clojure and clojure-contrib.
If I have time tomorrow I'll try to post a more detailed how-to.
-Stuart Sierra
On Jan 15, 6:53 pm, linh nguyenlinh.m
of it this way --
macros only exist during compilation. Functions like apply get
evaluated at run-time. A macro like and has no value at run-time,
so you can't use it as an argument to a function.
-Stuart Sierra
--~--~-~--~~~---~--~~
You received this message
I was afraid that would happen. I'll fix it, probably tomorrow.
-the other Stuart
On Jan 15, 6:27 pm, Stuart Halloway stuart.hallo...@gmail.com wrote:
The improved error reposting in test-is breaks some tests, e.g. from
the book:
(deftest test-lazy-index-of-any-with-match
(is
.
-Stuart Sierra
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
map to ensure the
keys are the correct type.
-Stuart Sierra
--~--~-~--~~~---~--~~
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
To unsubscribe from this group
to do is try
it.
-Stuart Sierra
On Jan 12, 12:41 am, Mark P pierh...@gmail.com wrote:
I have recently found out about Clojure and am
rather impressed. I am seriously considering
whether Clojure is a viable language for use at
work. The main stumbling block would be if
performance (both
with map:
(map #(* % 2) '(1 2 3))
;;= (2 4 6)
The second is a little more complicated, but still doable:
(reduce (fn [m [k v]] (assoc m k (str v Mark)))
{} {:greet hello :farewell goodbye})
;;= {:farewell goodbye Mark, :greet hello Mark}
-Stuart Sierra
and maps are. There isn't a good way to
conceptualize that as a function.
I've probably just made this more confusing, but that's the best I
could come up with.
-Stuart Sierra
On Jan 12, 6:51 pm, Ethan Herdrick herdr...@gmail.com wrote:
Then why are sets callable? Not that I'm complaining - I
some is already lazy, so you may not need to change anything at
all. You might also be able to use filter, which will not do
anything until you consume the output sequence.
-Stuart Sierra
On Jan 11, 4:44 pm, samppi rbysam...@gmail.com wrote:
Let's say I have a function, alt:
(defn alt
Hi Patrick,
Here's one way to do it:
(defn new-person [name]
(ref {:name name, :friends #{}}))
(defn are-friends [a b]
(dosync
(commute a assoc :friends (conj (:friends @a) b))
(commute b assoc :friends (conj (:friends @b) a
(def bill (new-person Bill))
(def bob (new-person
My recommendation would be to not write scripts at all. Instead, write
a -main function for your namespace and launch your application at
the Java command line in the usual way. In general, I think
distributed libraries should never have top-level side effects.
-Stuart Sierra
On Jan 9, 2:00 am
1001 - 1100 of 1221 matches
Mail list logo