Clojure is not a pure functional programming language. It allows side-
effects everywhere.
On Mar 22, 3:26 pm, Joshua Fox joshuat...@gmail.com wrote:
I dove into Lisp and Scheme several times in the past, but only with Clojure
did Lisp really catch?
1. Clojure abandons the 1950's cruft, with
On Sun, 22 Mar 2009 at 23:27, Jeff Valk wrote:
Ah, golf... :-)
(defn mapmap [f m]
(into {} (for [[k v] m] [k (f v)])))
For the record, I think the original approach is the most clear. And it's
actually shorter.
(defn mapmap [f m]
(zipmap (keys m) (map f (vals m
defn- is pretty useful. But wouldn't it be equally useful to have
def-, defmulti-, defmacro-, etc.?
I'm aware that it is possible to add the private tag to the metadata
of the var, but in many code samples I've seen, people routinely get
this wrong (I believe you need to attach the metadata to
On 22.03.2009, at 21:10, Jon Nadal wrote:
I often need to map a function over the values of a map while
preserving keys--something like:
...
Is there a more concise way to do this in Clojure? If not, is this
something that might be worth putting in the contrib?
Look at
On Sun, Mar 22, 2009 at 1:17 PM, CuppoJava patrickli_2...@hotmail.com wrote:
So, considering it seems that not many other people have run into this
issue, can I assume that most people just haven't had a need to call a
super multi-method? Is it a bad design choice to call your inherited
I've been thinking quite a bit about the OO side of Clojure the past
couple of days, and trying to figure out how common OO design patterns
would look when ported over to Clojure's way of doing things.
The most obvious thing that others have noted is that you can
effectively simulate a mutable
On Sun, Mar 22, 2009 at 11:53 PM, Jeff Valk jv-li...@tx.rr.com wrote:
For the record, I think the original approach is the most clear. And it's
actually shorter.
(defn mapmap [f m]
(zipmap (keys m) (map f (vals m
But it traverses m twice, which is likely to be less efficient.
I had a good time presenting an overview of Clojure at this years
TheServerSide Java Symposium.
A few questions from the crowd (of about 15 attendees) that I couldn't
accurately respond to:
1) What prevents thread starvation when using (dosync) and ref's?
It seems to me that conflicting
On Mon, Mar 23, 2009 at 1:45 AM, Howard Lewis Ship hls...@gmail.com wrote:
If you have a long running process that continually modifies a
collection and retains the new version ... does the new version retain
the old version? For how long?
In general, I think it's safe to assume that
On Mar 22, 2009, at 10:27 PM, Mark Engelberg wrote:
I've been thinking quite a bit about the OO side of Clojure the past
couple of days, and trying to figure out how common OO design patterns
would look when ported over to Clojure's way of doing things.
The most obvious thing that others
Thanks for that Tim - perfect.
On Mar 19, 11:49 pm, Timothy Pratley timothyprat...@gmail.com wrote:
http://clojure.org/java_interop
Note that while method fns can be provided to override protected
methods, they have no other access to protected members, nor to super,
as these capabilities
Any other tricks or techniques
There is defn- http://clojure.org/api#toc189 as well as the :private
metadata tag.
Joshua
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post to this group, send
Yes, the :private metadata tag is probably the simplest way to make
the whole object private, and then just expose the manipulation
functions. The closure solution is similar in this regard. I guess
the point I failed to convey is that I'm really wondering if there's a
way to effectively make
Hi,
I'd been using the 20081217 release. The following code worked, as
long as Structure was in the working directory:
Clojure
user= (use 'Structure)
nil
However, after I updated to 20090320, I get the following errors:
Clojure
user= (use 'Structure)
java.io.FileNotFoundException: Could not
The attached patch to clojure.core implements an optional universal
parent type for Clojure hierarchies and defines such a type for the
global default hierarchy. With this patch applied, Clojure passes the
test_clojure and test_contrib test suites in clojure.contrib. I also
tested it with
On Mar 22, 2009, at 11:47, stephaner wrote:
I join the crowd too,
Me too!
Like many here, I have used lots of languages over time, starting
with Microsoft Basic in 1982 and ranging from various Assemblers via
C and Fortran to more recent high-level languages. For the last
twelve years,
double thumbs up :)
--~--~-~--~~~---~--~~
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
On Mon, Mar 23, 2009 at 3:11 AM, Konrad Hinsen
konrad.hin...@laposte.net wrote:
On 22.03.2009, at 21:10, Jon Nadal wrote:
I often need to map a function over the values of a map while
preserving keys--something like:
...
Is there a more concise way to do this in Clojure? If not, is this
I'm (fashionably?) late to share my appreciation. Excellent language
- I can only imagine good things for Clojure in the future.
Thanks Rich!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post
On Mon, Mar 23, 2009 at 3:27 AM, Mark Engelberg
mark.engelb...@gmail.com wrote:
I suspect that if you use double-colon keywords for the keys, you get
a bit more privacy in the sense that these keys are slightly harder to
accidentally manipulate from other namespaces, so perhaps that could
at
On Mon, Mar 23, 2009 at 4:59 AM, Rich rwml...@gmail.com wrote:
Hi,
I'd been using the 20081217 release. The following code worked, as
long as Structure was in the working directory:
Clojure
user= (use 'Structure)
nil
However, after I updated to 20090320, I get the following errors:
Frantisek Sodomka wrote:
On Mar 19, 12:58 pm, Jason Sankey ja...@zutubi.com wrote:
Also, is there somewhere I can contribute test cases for this to
prevent a future regression?
Tests for clojure.zip can from now on go to test-clojure.clojure-zip:
On Mar 23, 2009, at 12:15, Mark Volkmann wrote:
Look at clojure.contrib.generic.functor/fmap. It does what you need
for maps, for all the other Clojure collections (where it works like
map except that its return value is a collection of the same type as
the input value), and you can
On 23/03/2009 9:03, Mark Engelberg wrote:
defn- is pretty useful. But wouldn't it be equally useful to have
def-, defmulti-, defmacro-, etc.?
I'm aware that it is possible to add the private tag to the metadata
of the var, but in many code samples I've seen, people routinely get
this wrong
Sounds like OSGi. Any progress on Clojure working with OSGi?
On Mar 22, 9:59 pm, Phil Hagelberg p...@hagelb.org wrote:
Bradbev brad.beveri...@gmail.com writes:
I feel that the next big growth phase for Clojure will be in the user
community and the code that we can generate. A good package
Structure.clj does call ns as shown below:
(ns Structure)
So, as far as I can tell, Clojure should look for Structure.clj in the
class path. At least, that's what it used to do. I guess I could move
all the code into a sub-directory, and rename all the namespaces--but
I'd rather keep it
Ditto.
March 20th 2009 Rich Hickey Appreciation Day
-Rayne
--~--~-~--~~~---~--~~
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
Is there a simpler way to do this?
(defn get-months []
(drop-last (.getMonths (java.text.DateFormatSymbols.
(defn get-weekdays []
(drop 1 (.getWeekdays (java.text.DateFormatSymbols.
Aloha,
David Sletten
--~--~-~--~~~---~--~~
You received this
I prefer the into version which allows to write a mapmap that preserves the
map type (eg sorted or hash):
(defn mapmap [f m]
(into (empty m) (for [[k v] m] [k (f v)])))
Christophe
On Mon, Mar 23, 2009 at 7:53 AM, Jeff Valk jv-li...@tx.rr.com wrote:
On Sun, 22 Mar 2009 at 23:27, Jeff Valk
On Mar 23, 7:30 am, Mark Volkmann r.mark.volkm...@gmail.com wrote:
I hadn't run across :: before. How do you determine the namespace of a
keyword? I'd like to see the difference between
(def k1 :a) and (def k2 ::b)
Of course both create vars (k1 and k2) in the user namespace by
default,
I'm struggling to understand the following lines of code from
clojure.lang.LockingTransaction.run:
if (ref.tvals == null) {
ref.tvals = new Ref.TVal(e.getValue(),
commitPoint, msecs);
} else if (ref.faults.get() 0) {
On Mon, Mar 23, 2009 at 7:04 AM, Konrad Hinsen
konrad.hin...@laposte.net wrote:
On Mar 23, 2009, at 12:15, Mark Volkmann wrote:
Look at clojure.contrib.generic.functor/fmap. It does what you need
for maps, for all the other Clojure collections (where it works like
map except that its return
On Mon, Mar 23, 2009 at 7:34 AM, Rich rwml...@gmail.com wrote:
Structure.clj does call ns as shown below:
(ns Structure)
So, as far as I can tell, Clojure should look for Structure.clj in the
class path. At least, that's what it used to do. I guess I could move
all the code into a
I just published part 3 of my monad tutorial for Clojure:
http://onclojure.com/2009/03/23/a-monad-tutorial-for-clojure-
programmers-part-3/
This part's topics are
- m-zero, m-plus, and :when clauses in domonad
- the state monad
As always, don't hesitate to leave your comments on the
On Mar 23, 2009, at 14:26, Mark Volkmann wrote:
That leaves the question whether there is still any need for the
clojure.lang.ISeq implementation. At the moment it is used for lists,
but that is not particularly consistent. I guess I will remove it.
Maybe you should keep it to support
Hi,
When I start slime with the new clojure_20090320 in classpath I get the
messages:
user= user= java.lang.Exception: Unable to resolve symbol: lazy-cons in this
context (core.clj:70)
user= user= java.lang.Exception: No such var:
swank.swank/ignore-protocol-version (NO_SOURCE_FILE:5)
user=
2009/3/23 Warren warrenthomasw...@yahoo.com
Sounds like OSGi. Any progress on Clojure working with OSGi?
Hello,
For the general OSGi infrastructure, I don't know.
For Eclipse in particular, yes: I've succesfully run a proof of concept
class from within clojuredev. To be able to do that, I
Thanks for the article. I found it very informative.
--~--~-~--~~~---~--~~
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
You could always build something where setters/getters are auto-magically
created if specified by the constructor macro. And with clojure.contrib.def
you could auto-magically generate private setters/getters.
On Mon, Mar 23, 2009 at 4:27 AM, Mark Engelberg mark.engelb...@gmail.comwrote:
I've
You need to make sure all the different moving parts are based on the newest
version of Clojure as well. This includes swank-clojure, clojure-mode, and
any other libs you might be using.
On Mon, Mar 23, 2009 at 9:51 AM, Dan Pomohaci dan.pomoh...@gmail.comwrote:
Hi,
When I start slime with
On Mar 22, 2009, at 21:26, Joshua Fox wrote:
I dove into Lisp and Scheme several times in the past, but only
with Clojure did Lisp really catch?
1. Clojure abandons the 1950's cruft, with all-caps and
abbreviations like SETQ and CDR. However, Scheme does this too,
without achieving
I also had the NO_SOURCE_FILE error when using contrib packages, upon
upgrade to 20090320. My CLASSPATH included .. I had to revert to
starting clojure with an explicit -cp. I'm new to both Java and
Clojure, but this led me to think my CLASSPATH was being ignored. I
chalked it up to my
There was some talk in the IRC channel on Friday about releases
http://clojure-log.n01se.net/date/2009-03-20.html#10%3a17
One of the things mentioned was adding some way to detect (at runtime) the
version of Clojure. I realize it is more complicated because we're on the
bleeding edge here and
On Mon, 23 Mar 2009 at 03:29, Mark Engelberg wrote:
But it traverses m twice, which is likely to be less efficient.
I wondered about this too, and actually no. Zipmap is efficient. It constructs
its return map in a single loop from two lazy seqs. Performance is practically
identical to the
On Mon, 23 Mar 2009 at 07:57, Christophe Grand wrote:
I prefer the into version which allows to write a mapmap that preserves the
map type (eg sorted or hash):
(defn mapmap [f m]
(into (empty m) (for [[k v] m] [k (f v)])))
Agreed. If it were in contrib, this would make most sense.
On Mar 23, 2009, at 16:36, Jeff Valk wrote:
I prefer the into version which allows to write a mapmap that
preserves the
map type (eg sorted or hash):
(defn mapmap [f m]
(into (empty m) (for [[k v] m] [k (f v)])))
Agreed. If it were in contrib, this would make most sense.
It is
When I was faced with the very same issue, removing .slime directory
from my home directory seems to have 'fixed' the issue.
Cheers,
suresh
On Mar 23, 6:51 am, Dan Pomohaci dan.pomoh...@gmail.com wrote:
Hi,
When I start slime with the new clojure_20090320 in classpath I get the
messages:
On Mon, 23 Mar 2009 at 10:48, Konrad Hinsen wrote:
It is already in clojure.contrib, with exactly that implementation,
and for exactly that reason:
Well I'm glad we agree then. :-) And thanks for the pointer.
-Jeff
--~--~-~--~~~---~--~~
You received this
Thanks man. Removing gcj does the trick. Sorry for the noise.
--~--~-~--~~~---~--~~
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
Using the new versions of null-string and read-field-aux that you gave
me, in my real application, the execution time went from 160 seconds
to 150 seconds. As for using macros, I wrote one for the example
program, but I realized that it wouldn't work in my application,
because I sometimes use
2009/3/19 Edward Shen shend...@hotmail.com
Hello,guys!
I'm reading 《Programming Clojure》. I've seen closure. But I
haven't seen how simulate Class.
Lisp can simulate Class by closure and nest Function.
Example:
(define (make-account balance)
(define (withdraw amount)
(if (=
On Sun, Mar 22, 2009 at 9:12 PM, Mark Volkmann r.mark.volkm...@gmail.comwrote:
I'm trying to understand the degree to which Clojure's STM provides
more concurrency than Java's blocking approach. I know it's difficult
to make generalizations and that specific applications need to be
measured,
I'll jump on this bandwagon, too!
I had Rich's talk on Clojure for Lisp Programmers bookmarked for a
couple of months last year and was afraid to watch it because I had a
feeling I might be unable to resist the lure of Clojure.
Finally, in early November, I watched the video. I was hooked. Such
. should be set by default. I verified that it was set using (.
System getProperties). I also tried explicitly setting the absolute
path using -cp. No luck on either count.
-Rich-
On Mar 23, 5:14 am, revoltingdevelopment
christopher.jay.jo...@gmail.com wrote:
I also had the NO_SOURCE_FILE
On Mar 23, 2009, at 9:27, Mark Engelberg wrote:
still be essential to the notion of equality). Any other tricks or
techniques for helping to hide or separate out the portions of a data
structure that are meant to be accessed or altered from the portions
that should only be accessed and
On Mon, Mar 23, 2009 at 10:09 AM, Konrad Hinsen
konrad.hin...@laposte.net wrote:
You seem to envisage exposing some aspects of your data structure as
part of the public API and have others reserved for use by
authorized support function. Could you give an example of a
situation where this
On Mar 23, 2009, at 18:20, Mark Engelberg wrote:
standard maps. I guess, loosely speaking, I was envisioning a model
in which seq on a hash map would only traverse the public keys, so
that library functions will work on your objects, without exposing
innards. But perhaps there is no
Thank you so much Rich to ease our collective pain !!!
Gaudeamus igitur ...
Albert
--
Albert Cardona
http://albert.rierol.net
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post to
I was envisioning .. only traverse the public keys
You could provide a function which uses select-keys to return a new map
with only the public* *keys.
This can be seen as an interface into the map held in the ref for read
access, though not for write.
Joshua
Hi Vincent!
Vincent Foley a écrit :
Using the new versions of null-string and read-field-aux that you gave
me, in my real application, the execution time went from 160 seconds
to 150 seconds. As for using macros, I wrote one for the example
program, but I realized that it wouldn't work in
On Mon, Mar 23, 2009 at 11:19 AM, Cosmin Stejerean cstejer...@gmail.com wrote:
On Sun, Mar 22, 2009 at 9:12 PM, Mark Volkmann r.mark.volkm...@gmail.com
wrote:
I'm trying to understand the degree to which Clojure's STM provides
more concurrency than Java's blocking approach. I know it's
that was happening? I know I could insert my own code to track that,
but it seems like this may be a commonly needed tool for Clojure to
detect excessive conflicts/retries in transactions. Maybe we could set
a special variable like *track-retries* that would cause Clojure to
produce a text
On Mon, Mar 23, 2009 at 2:36 PM, Mark Volkmann r.mark.volkm...@gmail.comwrote:
In the case where two transactions need to modify the same Ref they
definitely to be serialized, either by explicitly using locks in Java, or
by
letting Clojure automatically retry one of them. In either case
Let me clarify my last post. In both cases, the directory was on the
class path (either implicitly as ., or explicitly given the absolute
path).
However, in both cases I got the same FileNotFound exception.
-Rich-
On Mar 23, 6:39 am, Rich rwml...@gmail.com wrote:
. should be set by default. I
Hi,
Am 23.03.2009 um 11:17 schrieb Konrad Hinsen:
I added one more fix to this patch:
8) The docstring of defmulti now says that the optional hierarchy
argument must be a var referring to a hierarchy, rather than the
hierarchy itself.
This is not correct. defmulti may take any of Clojure's
2009/3/23 Phil Hagelberg p...@hagelb.org
Bradbev brad.beveri...@gmail.com writes:
I feel that the next big growth phase for Clojure will be in the user
community and the code that we can generate. A good package manager
will help fuel that growth.
I agree. The more I work with
I don't think anyone would claim that Clojure is an easier Lisp, if
anything it is harder. Programming in Common Lisp or Scheme is very
simple. Clojure on the other hand is like CL or Scheme with
additional cognitive demands on the programmer to think about
functional and concurrent
Hello,
there has been plenty of time to speak about that in the previous thread on
the subject, and it's a shame these interesting proposals had to wait for
the release of the functionality to pop up :-).
But I think it's my fault: when nobody did additional comments on the
thread, I considered
Hi group,
say I have 2 sequences
(def seq-a '(a1 a2 a3))
(def seq-b '(b1 b2 b3))
and want to iterate over them in parallel, like this
(par-doseq [a seq-a b seq-b] (prn a b))
which should print
a1 b1
a2 b2
a3 b3
The way I do it currently is using map (and last to fight
lazyness):
(last
On Thu, Feb 26, 2009 at 8:36 PM, Daniel Spiewak djspie...@gmail.com wrote:
Note that you cannot mix Java and Clojure sources within the same
project.
It is supported in the latest changeset. The following configurations
are possible:
-
Just Clojure:
*
On Mon, 2009-03-23 at 14:49 -0500, Cosmin Stejerean wrote:
The fact that B is tried once concurrently with A, and is then aborted
and retried is in my opinion the same as transaction B being stuck
waiting on a lock while A is being processed, but I can see how trying
B concurrently with
user= (repeat 10 (rand-int 49))
(4 4 4 4 4 4 4 4 4 4)
Hi,
(rand-int 49) will produce one integer, and repeat will repeat it 10
times, that is why you see same number repeated.
To fix this use:
user= (take 10 (repeatedly #(rand-int 49)))
(21 29 9 20 15 34 8 28 16 26)
--
Krešimir Šojat
On Mar 24, 12:01 am, Rowdy Rednose rowdy.redn...@gmx.net wrote:
Hi group,
say I have 2 sequences
(def seq-a '(a1 a2 a3))
(def seq-b '(b1 b2 b3))
and want to iterate over them in parallel, like this
(par-doseq [a seq-a b seq-b] (prn a b))
which should print
a1 b1
a2 b2
a3 b3
A
Hi all,
user= (repeat 10 (rand-int 49))
(4 4 4 4 4 4 4 4 4 4)
Can someone please tell me why this doesn't work?
It must be something obvious but I can't see the wood for the trees
right now - it's late and my head hurts!
Thanks,
Paul.
--
Iode Software Ltd, registered in England No. 6299803.
On Mar 23, 2009, at 5:24 AM, Jeff Valk wrote:
On Mon, 23 Mar 2009 at 03:29, Mark Engelberg wrote:
But it traverses m twice, which is likely to be less efficient.
I wondered about this too, and actually no.
I think Mark was referring to the call to 'keys'. But apparently
Clojure doesn't
Hello Everyone,
I've been reviewing the str-utils package, and I'd like to propose a
few changes to the library. I've included the code at the bottom.
USE MULTI-METHODS
I'd like to propose re-writing the following methods to used multi-
methods. Every single method will take an input called
Okay, it's up. Still new to github. Sorry about that. I *think* it's
here:
http://github.com/francoisdevlin/clojure-str-utils-proposal/tree/master
I'm not sure what the directory structure should be for everything
still. Perhaps somebody can point out how it should be done.
I'll put the
I can try that.
More generally, is it possible that I'm just doing this whole thing
wrong? That using vectors to represent binary fields and records in a
declarative is just a bad idea and that I should try and explore lower-
level alternatives?
Vincent
On Mar 23, 3:35 pm, Christophe Grand
On Mon, Mar 23, 2009 at 7:31 PM, Vincent Foley vfo...@gmail.com wrote:
More generally, is it possible that I'm just doing this whole thing
wrong? That using vectors to represent binary fields and records in a
declarative is just a bad idea and that I should try and explore lower-
level
Hello,
I have a use case for reading binary data from a file
into a C equivalent structure. I read the binary date
into a byte array before processing.
I came up with a split-byte-array function for this:
(defn split-byte-array
takes a byte-array and returns its various fields
as a list of
On Mon, 23 Mar 2009 at 20:10, David Sletten wrote:
I think Mark was referring to the call to 'keys'. But apparently
Clojure doesn't need to traverse the map to generate the keys?
The call to keys just creates a seq. There's no traversal until you consume it.
Not sure what you mean here.
When i use slime with lisp, it shows me function parameters, when
cursor is on a function name. But with clojure it only shows me
Evaluation Aborted. Is this because that feature not implemented, or i
setup something wrong ?
--~--~-~--~~~---~--~~
You received
Vagif Verdi vagif.ve...@gmail.com writes:
When i use slime with lisp, it shows me function parameters, when
cursor is on a function name. But with clojure it only shows me
Evaluation Aborted. Is this because that feature not implemented, or i
setup something wrong ?
Works for me. Would
I was curious about how some of the clojure code worked and observed
that the coding style is a little bit non idiomatic from typical Java
coding conventions. E.g. there aren't any javadoc comments on methods
or classes, non standard indents.
Something like checkstyle might prove useful.
If you're in or around Chicago I'd like to invite you to come out for
the first meeting of the Chicago Clojure User Group on April 15th.
Full details are at http://onclojure.com/chicago/
--
Cosmin Stejerean
http://offbytwo.com
--~--~-~--~~~---~--~~
You received
85 matches
Mail list logo