Rich mentioned on #clojure that a patch to implement *print-length*
would be welcome.
I've uploaded a patch that implements Common Lisp's *print-length* and
*print-level* for Clojure:
http://clojure.googlegroups.com/web/print-length-level.patch
The CL docs are at:
http://www
On Oct 22, 6:17 am, Chouser <[EMAIL PROTECTED]> wrote:
> On Wed, Oct 22, 2008 at 4:30 AM, Brett Morgan <[EMAIL PROTECTED]> wrote:
>
> > I understand the lisp way is to use the reader plus macros to interpret the
> > incoming data stream. This is hella cool in that it seriously cuts down on
> > t
Hi,
On 24 Okt., 00:42, BerlinBrown <[EMAIL PROTECTED]> wrote:
> And then I have a utility to load hello_world.lisp and execute
> the hello-world call.
>
> At the command line:
> #Inspect: hello-world function was called
> #Hello World
> #Inspect: hello-world has finished executing.
There is
On Oct 24, 3:42 am, BerlinBrown <[EMAIL PROTECTED]> wrote:
> I asked this on common lisp thread but I want to work with clojure as
> well:
>
> With clojure and I am assuming the introspection properties. How
> can I add code to clojure code that will tell me when a function
> is called and when
Rich,
When I do the following:
(gen-and-load-class 'user.UserException :extends Exception)
(defn th [arg]
(throw (new user.UserException "thrown exception")))
(defn test-fn []
(try
(dorun (map th '(1 2 3)))
(catch user.UserException e
On Thu, Oct 23, 2008 at 6:42 PM, BerlinBrown <[EMAIL PROTECTED]> wrote:
>
> For example, pseudo code in common lisp, hello_world.lisp:
>
> (defun hello-world ()
> (format t "Hello World"))
>
> (hello-world)
>
> And then I have a utility to load hello_world.lisp and execute
> the hello-world
Binding isn't suppose to work for macros. Macros expand during
compile-time, and binding only affects vars at runtime. (and) expands
into let* and if, neither of which you can bind because they are
special rather than being vars/functions -- see (macroexpand `(and 1
2)). Similary, fn expands to
On Oct 23, 6:42 pm, BerlinBrown <[EMAIL PROTECTED]> wrote:
> I asked this on common lisp thread but I want to work with clojure as
> well:
>
> With clojure and I am assuming the introspection properties. How
> can I add code to clojure code that will tell me when a function
> is called and when
I asked this on common lisp thread but I want to work with clojure as
well:
With clojure and I am assuming the introspection properties. How
can I add code to clojure code that will tell me when a function
is called and when has finished executing. I want to take any lisp
code and this particul
On 23 Okt., 15:12, Rich Hickey <[EMAIL PROTECTED]> wrote:
> On Oct 22, 6:45 pm, André Thieme <[EMAIL PROTECTED]> wrote:
> I think, in general, this proposal, while interesting, has the
> difficulty that it reduces the power of #() to not much more than
> currying, and has some presumptions that n
In SVN 1075, binding doesn't seem to work for macros:
;defined as fn to avoid "can't take value of a macro" exception
(defn bind-test
[& args] `(println "bind-test" [EMAIL PROTECTED]))
(binding [and bind-test]
(and 1))
I recall this used to work (from some experiments I ran in May of
this ye
On Thu, Oct 23, 2008 at 11:55 AM, R. P. Dillon <[EMAIL PROTECTED]> wrote:
>
> Very clear explanation - I guess I thought that it would be possible
> to to do the equivalent of (constantly 3) using the macro. I was just
> overlooking the arity issue with the reduce call.
It's possible, but ugly.
On Oct 23, 2008, at 10:53 AM, Rich Hickey wrote:
> Any thoughts on this as part of the upcoming bit of breaking changes?
I think it would be a very useful change. I'm in favor.
--Steve
--~--~-~--~~~---~--~~
You received this message because you are subscribed t
Very clear explanation - I guess I thought that it would be possible
to to do the equivalent of (constantly 3) using the macro. I was just
overlooking the arity issue with the reduce call.
Thanks for taking the time to explain!
Cheers,
Rick
--~--~-~--~~~---~--~~
On Thu, Oct 23, 2008 at 10:53 AM, Rich Hickey <[EMAIL PROTECTED]> wrote:
>
> I'd rather enhance doto to do this and not add another variant. The
> break would be that current (doto x (foo 42)) would have to become
> (doto x (.foo 42)).
>
> Any thoughts on this as part of the upcoming bit of breaki
On Oct 21, 10:30 am, mb <[EMAIL PROTECTED]> wrote:
> Hi,
>
> On 21 Okt., 14:41, mb <[EMAIL PROTECTED]> wrote:> (defmacro doto->
>
> The name is actually also up to discussion. doto is already
> in use and this change is incompatible to "legacy" code.
> I couldn't come up with a good alternative.
Thanks guys, I get it now. I was forgetting that #^ attaches to the
next thing read, it makes sense now!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to clo
On Thu, Oct 23, 2008 at 8:38 AM, Stephen C. Gilardi <[EMAIL PROTECTED]> wrote:
>
> Clojure could validate all the arguments to use/require and I think it
> should since this appears to be frequent tripping point for folks.
>
> Opinions on the value of that are welcome.
I think we'd get more milea
Hi Paul,
On 23 Okt., 15:11, Paul Drummond
<[EMAIL PROTECTED]> wrote:
> I am a bit puzzled by how metadata seems to behave differently
> depeding on where it's used and whether #^ is included or not:
AFAIU, #^ attaches the given map to the thing read.
> (defn #^{:doc "doc"} my-fn ([x] x))
> ;;W
On Oct 23, 9:11 am, Paul Drummond
<[EMAIL PROTECTED]> wrote:
> I am a bit puzzled by how metadata seems to behave differently
> depeding on where it's used and whether #^ is included or not:
>
> (defn #^{:doc "doc"} my-fn ([x] x)) ;;Works
> (defn {:doc "doc"} my-fn ([x] x)) ;;Error: Second a
On Oct 22, 6:45 pm, André Thieme <[EMAIL PROTECTED]> wrote:
> On 23 Okt., 00:28, wwmorgan <[EMAIL PROTECTED]> wrote:
>
> > You can get most of the functionality you're looking for with partial
>
> Yes sure. The thing is that currying is nothing but syntactical sugar.
> It's not the functionality I
I am a bit puzzled by how metadata seems to behave differently
depeding on where it's used and whether #^ is included or not:
(defn #^{:doc "doc"} my-fn ([x] x)) ;;Works
(defn {:doc "doc"} my-fn ([x] x)) ;;Error: Second argument to def
must be a Symbol
(defn my-fn [x] x #^{:doc "doc"});;E
> Just a technical note: please consider diff -u or
> diff -c for patches. It provides more context and
> also helps in case the hunk moved in the meantime.
Ahhh ... the -u is what I was looking for ... couldn't think of it.
I'll remember that from now on, thanks!
- J.
--~--~-~--~~-
Hi,
On 23 Okt., 14:48, "J. McConnell" <[EMAIL PROTECTED]> wrote:
> Here's a tiny patch against the VimClojure syntax file to allow Vim to
> recognize BigDecimal literals (numbers suffixed with "M"):
>
> kant[~/.vim/syntax]$ diff clojure.vim.orig clojure.vim
> 162c162
> < syn match clojureNumber
Here's a tiny patch against the VimClojure syntax file to allow Vim to
recognize BigDecimal literals (numbers suffixed with "M"):
kant[~/.vim/syntax]$ diff clojure.vim.orig clojure.vim
162c162
< syn match clojureNumber "\<-\?[0-9]\+\>"
---
> syn match clojureNumber "\<-\?[0-9]\+M\?\>"
Hope s
On Oct 23, 2008, at 2:50 AM, [EMAIL PROTECTED] wrote:
> Who is casting which Boolean to what there? And, more importantly,
> what do I need to fix in my code line?
Hi Konrad,
Here is the correct syntax for 'use' in this case (with the current
SVN Clojure which now defines clojure/remove):
Hi Rick,
First of all:
#(x) is equivalent with (fn [] (x)). So as an example with reduce:
user=> (reduce #(+ %1 %2) (range 1 101))
5050
user=> (reduce (fn [x y] (+ x y)) (range 1 101))
5050
So it should be obvious, that #(3) throws exception as soon as it is
called, since it is equivalent to (fn
Using #() for "one off" functions, you get some odd behavior:
(reduce #(3) (range 1 100))
throws an exception:
java.lang.IllegalArgumentException: Wrong number of args passed to:
eval--2365$fn
as does:
(reduce (fn [] 3) (range 1 100)
but:
(reduce (constantly 3) (range 1 100))
performs as one would
On 22.10.2008, at 19:41, Matthias Benkard wrote:
> Personally, I'd define multimethods as the “interface“, in a single
> namespace, and implement them for any set of data structures that I
> wanted to support.
Multimethods were my first idea as well, but I couldn't think of a
good way to defin
Hi,
On 23 Okt., 08:50, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> This leads me to a more down-to-earth question: what is the right way
> to use clojure/zip in a program? First I tried
>
> (use 'clojure.zip)
I normally use an alias: (require '[clojure.zip :as zip])
user=> (-> (zip/ve
> I don't see any way to significantly improve your speed, but I can
> save you some lines of code:
Thanks! I ended up calling out to grep instead :) Here is the code if
someone else wants to do similar things:
(defn real-grep [pattern]
(debug (str "pattern: " pattern))
(let [cmd-arr
31 matches
Mail list logo