Hi Conrad,
Here is my take: https://gist.github.com/792959
Since I despise indices I wrote the core algorithm without them. That gave
me a maze generation code which can create a maze in any kind of graph. This
would be fun to run it on the utah teapot for example :-)
Christophe
On Thu, Jan
Ken Wesson kwess...@gmail.com writes:
On Sat, Jan 22, 2011 at 11:26 AM, Eric Schulte schulte.e...@gmail.com wrote:
Nice concise example,
Thanks.
A while back I implemented something similar; a propagator system using
agents fed with `send', coming in at a slightly more verbose ~35 lines
Thanks,it is an issue.
On Jan 24, 1:09 pm, David dsieg...@yahoo.com wrote:
Line 86 of core.clj is:
(list 'cadr caddr)
and should be:
(list 'caddr caddr)
On Jan 23, 9:45 pm, dennis killme2...@gmail.com wrote:
I have implemented a simple interpreter in clojure,it is just
Hi,
Yes,i have seen the rscheme.
cscheme is just an exercise,it is not practical at all.
On Jan 24, 1:44 pm, Andrzej ndrwr...@googlemail.com wrote:
Hi,
You may want to see if there is anything of interest for you
there:http://clojure.wikidot.com/scheme-interpreter-in-clojure
It has its
Dear all ,
how to get api download/generate for various lib such as contrib , enlive
,etc.
thanks
--
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
Note that posts from new members are
You can download Clojure 1.2 by going to http://clojure.org/, clicking the
Download link, and then clicking the Clojure 1.2 and Clojure Contrib
1.2 links.
Bill
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
Hi,
just a quick one:
(mapcat #([% 1]) [1 3 5])
gives an exception (wrong argument)
(mapcat (fn [a] [a 1]) [1 3 5])
works though...
What did I get wrong?
Thx
Las
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email
Hi,
On 24 Jan., 13:59, László Török ltoro...@gmail.com wrote:
just a quick one:
(mapcat #([% 1]) [1 3 5])
gives an exception (wrong argument)
(mapcat (fn [a] [a 1]) [1 3 5])
works though...
What did I get wrong?
#([% 1]) is equivalent to (fn [a] ([a 1])). Note the extra parens. You
That a problem people find often.
The thing is #(%) not the same as (fn [x] x) its more like (fn [x]
(x)).
So if you write #([x]) is (fn [x] ([x])) witch throws an error. You
would have to write #(vec %).
On Jan 24, 1:59 pm, László Török ltoro...@gmail.com wrote:
Hi,
just a quick one:
Thanks! :)
2011/1/24 Nick Zbinden nick...@gmail.com
That a problem people find often.
The thing is #(%) not the same as (fn [x] x) its more like (fn [x]
(x)).
So if you write #([x]) is (fn [x] ([x])) witch throws an error. You
would have to write #(vec %).
On Jan 24, 1:59 pm, László
On Mon, Jan 24, 2011 at 3:22 AM, Eric Schulte schulte.e...@gmail.com wrote:
Ken Wesson kwess...@gmail.com writes:
Why (fn [_] value) instead of (constantly value)? OK, actually
(constantly value) is textually longer, but I'd argue it might be
clearer. And it works; (constantly foo) accepts all
sorry , i want the documentation .which are the functions available ...
etc?
--
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
Note that posts from new members are moderated - please be
On Jan 23, 2011, at 10:56 PM, Ken Wesson wrote:
I've managed to make this more efficient, by making each agent send
process a larger portion of the job than one single item:
(defn eager-pmap [f colls]
(let [cores (.. Runtime getRuntime availableProcessors)
agents (cycle (for [_
If you go to http://clojure.org/ and look at the links on the left-hand side
of the page, you will find information about the language and the APIs. In
particular, the API link on the left-hand side of the page takes you to
information about all the core and contrib functions in the 1.2
The following code doesn't catch the exception thrown like I think it
should. Any recommendations appreciated.
https://gist.github.com/793340
Thank you,
Ryan
- - - -
(ns my-ns
(:use [clj-time.core :only [date-time]]))
(defn my-date-time
same as clj-time.core date-time but returns nil on
On Mon, Jan 24, 2011 at 5:50 PM, dennis killme2...@gmail.com wrote:
Hi,
Yes,i have seen the rscheme.
cscheme is just an exercise,it is not practical at all.
So was rscheme. :-) In many respects your implementation is more
complete than mine.
Cheers,
Andrzej
--
You received this message
On Mon, Jan 24, 2011 at 10:16 AM, Abraham vincent@gmail.com wrote:
sorry , i want the documentation .which are the functions available ...
etc?
For clojure.contrib? There's documentation on the web at
http://clojure.github.com/clojure-contrib/ and though I don't see a
download link you
On Jan 19, 2011, at 11:32 AM, Miki wrote:
I'd appreciate some comments about need functionality, bugs, code reviews and
such.
Thanks for this useful library. Some suggestions:
-I'd rather (copy-tree src dest) worked like cp -R src dest (including when
dest doesn't exist) rather than cp -R
This is much faster than either of the other eager-pmaps I posted to
this thread, and yet it's only using 60% CPU on my dual-core box. That
means there's still another x1.6 or so speedup possible(!) but I'm not
sure how.
Could -server make a difference here?
--
You received this message
On Sun, Jan 23, 2011 at 7:57 PM, Ken Wesson kwess...@gmail.com wrote:
Which tempts me to ask why you decided to bring it up again? :)
Because the topic arose again.
Because _you_ brought the topic up again.
Did you expect a different outcome this time?
You know what they say about madness
That would be a great application for this system. Each cell of the
spreadsheet could be a cell, and each formula could be a propagator.
I've implemented this and it seems to work well, I've committed this to
the repo above, and posted the spreadsheet code with example usage into
a gist at
On Mon, Jan 24, 2011 at 10:29 AM, Michael Gardner gardne...@gmail.com wrote:
Thanks for the work, Ken.
You're welcome.
Clojure's multi-threaded performance can be mysterious indeed
I think that may be generally true of multi-processing of every kind. :)
Anyway, for now I will probably just
how to get api docs for libraries such as enlive , etc?
--
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
Note that posts from new members are moderated - please be patient with your
first
On Mon, Jan 24, 2011 at 11:05 AM, Armando Blancas
armando_blan...@yahoo.com wrote:
This is much faster than either of the other eager-pmaps I posted to
this thread, and yet it's only using 60% CPU on my dual-core box. That
means there's still another x1.6 or so speedup possible(!) but I'm not
I don't think there is a catch-all mechanism for downloading documentation
for all libraries accessible by or written in Clojure. Perhaps you could
try going to the website for each library you are interested in and looking
for links with names like Download and Documentation. That often
On Mon, Jan 24, 2011 at 10:32 AM, Ryan Waters ryan.or...@gmail.com wrote:
The following code doesn't catch the exception thrown like I think it
should. Any recommendations appreciated.
https://gist.github.com/793340
Thank you,
Ryan
- - - -
(ns my-ns
(:use [clj-time.core :only
On Mon, Jan 24, 2011 at 11:14 AM, Sean Corfield seancorfi...@gmail.com wrote:
On Sun, Jan 23, 2011 at 7:57 PM, Ken Wesson kwess...@gmail.com wrote:
Which tempts me to ask why you decided to bring it up again? :)
Because the topic arose again.
Because _you_ brought the topic up again.
Did
Arguably it should be neither of these, but instead a macro of some
kind. The solution that would make it impossible to get this wrong
would be something like:
(defmacro primitives [ specs]
`(list
~@(for [s specs]
(if (coll? s)
`(list '~(first s) ~(second s))
`(list
Thank you Ken - I should have checked for Exception; not sure why I
didn't. Your other explanations were helpful too.
--
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
Note that posts from
I noticed that in 'with-open' macro the .close() method is called
without wrapping in another try-catch block. Exceptions raised in the
finally block prevails over the exception raised in the try block. Is
this intended behavior or I am missing something?
Is there an alternative where the
I'd like to propose different implementation of defnk, attached below.
Defnk2 translates keyword arguments to positional arguments at compile
time, and is therefore about 36x faster on my machine.
(defn expand-keyword-call [name pos kw-defaults args]
(if ( (count args) (count pos))
(throw
On Mon, Jan 24, 2011 at 2:19 PM, Ryan Waters ryan.or...@gmail.com wrote:
Thank you Ken - I should have checked for Exception; not sure why I
didn't. Your other explanations were helpful too.
You're welcome.
--
You received this message because you are subscribed to the Google
Groups Clojure
2011/1/24 Shantanu Kumar kumar.shant...@gmail.com:
I noticed that in 'with-open' macro the .close() method is called
without wrapping in another try-catch block. Exceptions raised in the
finally block prevails over the exception raised in the try block. Is
this intended behavior or I am
On Jan 24, 2011, at 1:54 PM, Laurent PETIT wrote:
That's interesting. Indeed, it seems to me that the .close() call
should be wrapped by a try / catch with an empty catch.
Why would client code want an exception thrown by .close() to get swallowed? Is
that not unexpected behavior in most
Just wrap it if you are paranoid about exception on close
(try (with-open [x y]
(throw (Exception. lololol)))
(catch Exception e (println (.getMessage e
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send
On Jan 25, 1:26 am, dysinger t...@dysinger.net wrote:
Just wrap it if you are paranoid about exception on close
(try (with-open [x y]
(throw (Exception. lololol)))
(catch Exception e (println (.getMessage e
The problem is that exception thrown by .close() overshadows
No need for wget etc,
For core you can download from,
https://github.com/clojure/clojure/tree/gh-pages
For contrib,
https://github.com/clojure/clojure-contrib/tree/gh-pages
Just click on download...
Regards...
--
Nurullah Akkaya
http://nakkaya.com
On Mon, Jan 24, 2011 at 5:55 PM, Ken
On Mon, Jan 24, 2011 at 3:58 PM, Nurullah Akkaya nurul...@nakkaya.com wrote:
No need for wget etc,
For core you can download from,
https://github.com/clojure/clojure/tree/gh-pages
For contrib,
https://github.com/clojure/clojure-contrib/tree/gh-pages
Just click on download...
Perhaps
(try (with-open [x y] ... )
(catch Exception)) ;; - catches any exception from with-open macro
I don't think you are correct.
--
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
Note
On Mon, Jan 24, 2011 at 4:07 PM, dysinger t...@dysinger.net wrote:
(try (with-open [x y] ... )
(catch Exception)) ;; - catches any exception from with-open macro
I don't think you are correct.
He is. Close exceptions lose any other exception or return value:
user= (defprotocol
On Jan 25, 2:07 am, dysinger t...@dysinger.net wrote:
(try (with-open [x y] ... )
(catch Exception)) ;; - catches any exception from with-open macro
I don't think you are correct.
Maybe this is subjective, but I am rarely interested in knowing what
exception does .close() throw - I
Yes. you are correct and I agree that you would lose the original exception
or return type. I was just saying you could catch the exception of the IO
close if needed.
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email
On Mon, 24 Jan 2011 13:30:49 -0800 (PST)
Shantanu Kumar kumar.shant...@gmail.com wrote:
On Jan 25, 2:07 am, dysinger t...@dysinger.net wrote:
(try (with-open [x y] ... )
(catch Exception)) ;; - catches any exception from with-open
macro
I don't think you are correct.
On Mon, Jan 24, 2011 at 2:27 PM, Shantanu Kumar
kumar.shant...@gmail.com wrote:
I noticed that in 'with-open' macro the .close() method is called
without wrapping in another try-catch block. Exceptions raised in the
finally block prevails over the exception raised in the try block. Is
this
On Jan 25, 2:47 am, Aaron Cohen aa...@assonance.org wrote:
On Mon, Jan 24, 2011 at 2:27 PM, Shantanu Kumar
kumar.shant...@gmail.com wrote:
I noticed that in 'with-open' macro the .close() method is called
without wrapping in another try-catch block. Exceptions raised in the
finally
Yes, you're right Shantanu.
apache commons io and spring framework, to name 2 things I know for
sure, are doing what you say: they swallow any exception that could be
thrown within the finally block, for the reasons you mention.
Of course, with-open allowing to do several binding, the
First, Sonatype's validation of -sources.jar and -javadoc.jar aren't as
stringent as you might expect. That is, the OSS/central repos' validation
routines appear to check for the existence of those artifacts corresponding
to a given jar artifact, but they aren't inspected for completeness.
On Monday, January 24, 2011 12:59:09 PM UTC, Las wrote:
What did I get wrong?
I believe #([% 1]) is equivalent to (fn [a] ([a 1])), not (fn [a] [a 1]) .
Thus, for #([% 1]) , [% 1] is called as a function. Vectors are functions
that take an index and return the vector's value at that index.
To build a browse-able API for clojure projects, you can use autodoc:
http://tomfaulhaber.github.com/autodoc/
On 1/24/11, .Bill Smith william.m.sm...@gmail.com wrote:
You can download Clojure 1.2 by going to http://clojure.org/, clicking the
Download link, and then clicking the Clojure 1.2 and
I personally find clojure docs (http://clojuredocs.org/) to be the best
source of core/contrib documentation.
~Adam~
--
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
Note that posts from new
apache commons io and spring framework, to name 2 things I know for
sure, are doing what you say: they swallow any exception that could be
thrown within the finally block, for the reasons you mention.
True, but if the body doesn't throw an exception, but the close does,
I wouldn't want the
2011/1/24 David Powell djpow...@djpowell.net:
apache commons io and spring framework, to name 2 things I know for
sure, are doing what you say: they swallow any exception that could be
thrown within the finally block, for the reasons you mention.
True, but if the body doesn't throw an
apache commons io and spring framework, to name 2 things I know for
sure, are doing what you say: they swallow any exception that could be
thrown within the finally block, for the reasons you mention.
True, but if the body doesn't throw an exception, but the close does,
I wouldn't want the
2011/1/25 Laurent PETIT laurent.pe...@gmail.com:
2011/1/24 David Powell djpow...@djpowell.net:
apache commons io and spring framework, to name 2 things I know for
sure, are doing what you say: they swallow any exception that could be
thrown within the finally block, for the reasons you
Hello.
If you have REPL, you can get any documentation via doc and
find-doc functions.
(doc reduce) ; print the documentation of reduce
(find-doc append) ; search documentations including word append
doc function can be used with almost all things documented:
variable, function, namespace, etc.
On Jan 24, 3:05 pm, Laurent PETIT laurent.pe...@gmail.com wrote:
2011/1/24 David Powell djpow...@djpowell.net:
apache commons io and spring framework, to name 2 things I know for
sure, are doing what you say: they swallow any exception that could be
thrown within the finally block, for
2011/1/24 Laurent PETIT laurent.pe...@gmail.com:
Yes, you're right Shantanu.
apache commons io and spring framework, to name 2 things I know for
sure, are doing what you say: they swallow any exception that could be
thrown within the finally block, for the reasons you mention.
for the
-I'd rather (copy-tree src dest) worked like cp -R src dest (including
when dest doesn't exist) rather than cp -R src/* dest/.
I agree, working on that.
-It would be nice if functions that create files or dirs (like mkdir and
touch) returned the new object's path, to allow chaining.
2011/1/25 Alan a...@malloys.org:
On Jan 24, 3:05 pm, Laurent PETIT laurent.pe...@gmail.com wrote:
2011/1/24 David Powell djpow...@djpowell.net:
apache commons io and spring framework, to name 2 things I know for
sure, are doing what you say: they swallow any exception that could be
Are we generally agreed that we want to preserve the body exception,
if any, else the close exception, if any, else the body return value?
Then, without further ado:
(defmacro with-open2 [binding-exprs body]
(if ( (count binding-exprs) 2)
`(with-open2 ~(vec (take 2 binding-exprs))
apache commons io and spring framework, to name 2 things I know for
sure, are doing what you say: they swallow any exception that could be
thrown within the finally block, for the reasons you mention.
True, but if the body doesn't throw an exception, but the close does,
I wouldn't want the
On Jan 22, 5:13 pm, Stuart Halloway stuart.hallo...@gmail.com wrote:
Please don't. It has already been discussed and declined. The metadata
is uglier because we want doing this to be slightly ugly..
The Clojure/core team is led by its technical advisors, Rich Hickey and
myself. In this
On Mon, Jan 24, 2011 at 4:54 PM, Shantanu Kumar
kumar.shant...@gmail.com wrote:
On Jan 25, 2:47 am, Aaron Cohen aa...@assonance.org wrote:
On Mon, Jan 24, 2011 at 2:27 PM, Shantanu Kumar
kumar.shant...@gmail.com wrote:
I noticed that in 'with-open' macro the .close() method is called
2011/1/25 Ken Wesson kwess...@gmail.com:
Are we generally agreed that we want to preserve the body exception,
if any, else the close exception, if any, else the body return value?
Then, without further ado:
(defmacro with-open2 [binding-exprs body]
(if ( (count binding-exprs) 2)
On Mon, Jan 24, 2011 at 7:26 PM, Aaron Cohen aa...@assonance.org wrote:
The inner exception to me should clearly be caught and not rethrown.
So I would really expect to see two printouts when this is run, once
for doit and once for close.
Neither would I. I think you've misunderstood
On Mon, Jan 24, 2011 at 7:32 PM, Laurent PETIT laurent.pe...@gmail.com wrote:
2011/1/25 Ken Wesson kwess...@gmail.com:
Are we generally agreed that we want to preserve the body exception,
if any, else the close exception, if any, else the body return value?
Then, without further ado:
Thanks, Ken. Much more productive than all this philosophy about what
makes sense the rest of us are discussing; I'd vote for this patch
if you put it in JIRA.
On Jan 24, 3:59 pm, Ken Wesson kwess...@gmail.com wrote:
Are we generally agreed that we want to preserve the body exception,
if any,
2011/1/25 Ken Wesson kwess...@gmail.com:
On Mon, Jan 24, 2011 at 7:32 PM, Laurent PETIT laurent.pe...@gmail.com
wrote:
2011/1/25 Ken Wesson kwess...@gmail.com:
Are we generally agreed that we want to preserve the body exception,
if any, else the close exception, if any, else the body return
On Mon, Jan 24, 2011 at 7:40 PM, Alan a...@malloys.org wrote:
Thanks, Ken. Much more productive than all this philosophy about what
makes sense the rest of us are discussing; I'd vote for this patch
if you put it in JIRA.
No patch; sorry; don't have a CA. Laurent improved on it somewhat
2011/1/25 Ken Wesson kwess...@gmail.com:
On Mon, Jan 24, 2011 at 7:32 PM, Laurent PETIT laurent.pe...@gmail.com
wrote:
2011/1/25 Ken Wesson kwess...@gmail.com:
Are we generally agreed that we want to preserve the body exception,
if any, else the close exception, if any, else the body return
of course I missed something :-(
2011/1/25 Laurent PETIT laurent.pe...@gmail.com:
2011/1/25 Ken Wesson kwess...@gmail.com:
On Mon, Jan 24, 2011 at 7:32 PM, Laurent PETIT laurent.pe...@gmail.com
wrote:
2011/1/25 Ken Wesson kwess...@gmail.com:
Are we generally agreed that we want to preserve
There it is, corrected:
(in-ns 'clojure.core)
(defmacro with-open
bindings = [name init ...]
Evaluates body in a try expression with names bound to the values
of the inits, and a finally clause that calls (.close name) on each
name in reverse order.
{:added 1.0}
[bindings body]
On Mon, Jan 24, 2011 at 7:43 PM, Laurent PETIT laurent.pe...@gmail.com wrote:
2011/1/25 Ken Wesson kwess...@gmail.com:
Ah, I guess it may be a bit cleaner to just eschew finally
altogether and close in the try and in the catch. The one thing that's
a bit icky about that is that if the body
Huh. We came up with almost the same final version. I guess I took 13
minutes longer because I tested mine -- yours still has the missing #.
:)
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
Ugly? Aww, I thought the ^ metadata looked kinda cute...
It is a bit awkward that defn- exists and not def-, but it seems defs
are not going to be as common as defns (though I'll admit I haven't
written or read enough complex idiomatic Clojure code to know for
sure). And if you really want to
On Mon, Jan 24, 2011 at 8:42 PM, Nick Brown nwbr...@gmail.com wrote:
Ugly? Aww, I thought the ^ metadata looked kinda cute...
It is a bit awkward that defn- exists and not def-, but it seems defs
are not going to be as common as defns (though I'll admit I haven't
written or read enough
Seems pretty clear that your macports version of curl is the problem, it's
up to you what you want to do about it. I don't know if uninstalling it
would leave you with the OS X version of curl or not. Link to get you
started:
Hello.
And if you really want to be consistent you would probably
also want defmulti-, defmacro-, defstruct-, defprotocol-, etc.
In my opinion, if defn- is not in core but in contrib, I feel be consistent.
By the way, defstruct- and defmacro- is in contrib consistently :-)
If we really
Hi Larry,
As a quick temporary workaround you could just set your PATH environment
variable so that it picks up the curl executable from /usr/bin instead
of the broken MacPorts one from /opt/local/bin.
$ which curl
/opt/local/bin/curl
$ export PATH=/usr/bin:$PATH
$ which curl
/usr/bin/curl
i would totally recommend uninstalling macports, and moving over to
homebrew which is far better (https://github.com/mxcl/homebrew).
On Mon, Jan 24, 2011 at 8:44 PM, Alex Osborne a...@meshy.org wrote:
Hi Larry,
As a quick temporary workaround you could just set your PATH environment
variable
user (use '[clojure.contrib.http.agent :as ha])
WARNING: bytes already refers to: #'clojure.core/bytes in namespace:
user, being replaced by: #'clojure.contrib.http.agent/bytes
nil
user (string (http-agent http://url.that.doesnt.exist.com;))
This will block indefinitely since the url does not
On Mon, Jan 24, 2011 at 11:23 PM, HiHeelHottie hiheelhot...@gmail.com wrote:
user (use '[clojure.contrib.http.agent :as ha])
WARNING: bytes already refers to: #'clojure.core/bytes in namespace:
user, being replaced by: #'clojure.contrib.http.agent/bytes
nil
user (string (http-agent
The changed code should catch 'Exception', not 'Throwable' because the
latter is a common ancestor of both 'Exception' and 'Error'. An
'Error' must not be swallowed at any point in the system, unless you
are writing an app server or a JVM implementation. ;-)
Regards,
Shantanu
On Jan 25, 6:11 am,
Hi,
On 25 Jan., 01:33, Ken Wesson kwess...@gmail.com wrote:
It looks a little quirky in macroexpand output and seems slightly ugly
but it works and probably isn't even inefficient at runtime, as the
close symbol presumably has a name slot that takes up four bytes
whether it's nil or a
Hi,
On 25 Jan., 01:57, Laurent PETIT laurent.pe...@gmail.com wrote:
(try (. ~(bindings 0) close) (catch Throwable _))
New code should use (.close foo) instead of (. foo close), IIRC.
Sincerely
Meikel
--
You received this message because you are subscribed to the Google
Groups Clojure group.
85 matches
Mail list logo