Here's my experience with 1.6.0_12:
When I run
(load-file "celsius.clj")
(celsius/celsius)
from a REPL in a Cygwin rxvt, the problem recurs as before:
The Swing window comes up, but input is not echoed in the swing window
until I hit return in
the rxvt window.
If I use a cmd shell, I do
>
>
> > Seems like this kind of dispatch and the Datalog project might meet up
> soon?
> > Or am I totally wrong?
>
> I have given it zero thought.
Perhaps interesting to pursue? Rich had brought it up in conversations about
predicate dispatch. Could greatly help from the performance side of thin
On Feb 12, 1:27 pm, David Nolen wrote:
> Neat! You've removed the need to even define a dispatch-fn.
Maybe; maybe not. The built-in dispatch mechanism uses a selection
scheme that applies a sequence of increasingly restrictive, but also
increasingly costly, tests; basically, the tests in order
On Thu, Feb 12, 2009 at 7:10 PM, Conrad wrote:
>
> Hi, is there a standard way to tell if a variable is bound? I couldn't
> find a way.
> Basically I want something like this, but without the horrible hacks:
>
>> (def foo 33)
That's actually doing two different steps:
1. creating a Var named 'fo
"Stephen C. Gilardi" writes:
> Now I apply the patch and use the convenience it offers:
>
> user=> (def a (java.io.StringReader. "123[145]"))
> #'user/a
> user=> (read a)
> 123
> user=> (read a)
> 145
>
> The "[" on the input stream was lost so the second obje
On Thu, Feb 12, 2009 at 10:20 PM, Chouser wrote:
> There's a misplaced paren in take-while in the lazy branch. Patch attached.
For what it's worth, using the lazy branch for my clojure-classes
project, I had to make two kinds of changes (not counting the patch to
core). I had to remove a coupl
I'm not sure if I fully understand what you want, but I find this sort
of thing is often cleanest using mutable data structures, i.e., (off
the top of my head, possibly buggy),
(defn visit
([node] (visit node (HashSet.)))
([node s]
(when-not (.contains s node)
I've copied-and-pasted (not typed in) the following code into the
REPL:
(str
"INSERT ALL"
" INTO mdroverffprd.mc_system_user_region (system_user_id,
region_code) VALUES ('" 'a "', 'RS01')"
" INTO mdroverffprd.mc_system_user_region (system_user_id,
region_code) VALUES ('" 'a "', 'RS02')"
Sounds good. The one hitch is that I'm passing around a "visited" hash (I'm
actually traversing a graph looking for spanning trees), so I end up calling
(reduce XX [visited acc] (get-children node)) on the children, which (I
think) kills the laziness.
On Thu, Feb 12, 2009 at 10:18 PM, Jason Wolfe
On Feb 12, 6:12 pm, Laurent PETIT wrote:
> Do you know if there's a way to overload methods with the same arity, then ?
>
> I'm thinking about .read(char ) .read(byte ) .read(String ) .read(Integer )
> ... for example, ?
I think they're all the same method, from the Clojure point of view.
If yo
There's a misplaced paren in take-while in the lazy branch. Patch attached.
--Chouser
--~--~-~--~~~---~--~~
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
On Feb 12, 4:01 pm, Jeffrey Straszheim
wrote:
> It is easy to do a lazy preorder walk of a tree (in psuedo-clojure):
>
> (fn visit [node]
> (lazy-cons node (map visit (get-children node
>
> So, that much is obvious. However, I cannot think of an obvious way to do a
> post-order traversal
On Feb 11, 4:06 pm, Phil Hagelberg wrote:
> I think that the bike shed should definitely be red.
I hadn't heard that one before :)
Issue here: http://code.google.com/p/clojure-contrib/issues/detail?id=29
-Jason
--~--~-~--~~~---~--~~
You received this message b
At http://clojure.org/api#drop-last, the formal parameter "s" needs to
be changed to "coll":
(drop-last s)
(drop-last n s)
Return a lazy seq of all but the last n (default 1) items in coll
--~--~-~--~~~---~--~~
You received this message because you are subscribed
That's very neat Perry!
user=> (let-> [? 5] inc)
6
user=> (let-> [? 5] inc (+ 2 ?))
8
user=> (let-> [? 5] inc (+ 2 ?) (+ ? 3))
11
user=> (let-> [? 5] inc (+ 2 ?) (+ ? 3) (+ 4))
4
What should happen when/if the seq arg doesn't contain the symbol? I
believe how you currently handle it is correct a
Well, there is the IO! macro to wrap side effects. This works with the
transactions mechanism.
So foo! does show up, but is not followed rigorously.
On Thu, Feb 12, 2009 at 7:57 PM, Kevin Albrecht wrote:
>
> If no one knows of any existing conventions, does anyone have ideas
> for conventions?
If no one knows of any existing conventions, does anyone have ideas
for conventions?
--~--~-~--~~~---~--~~
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 un
On Feb 13, 12:10 am, Conrad wrote:
> Hi, is there a standard way to tell if a variable is bound? I couldn't
> find a way.
There's an isBound method on the Var class:
(.isBound #'foo)
But the var has still got to exist, i.e. you have to (declare foo)
first.
If you want to check a var _exists_,
There's certainly better, but at least, you can try this :
(def void)
(.isBound (var void))
; or (.hasRoot (var void)) depending on what you want
--
Laurent
2009/2/13 Conrad
>
> Hi, is there a standard way to tell if a variable is bound? I couldn't
> find a way.
> Basically I want something
Try:
(contains? (ns-map *ns*) 'foo)
*ns* binds to the current namespace.
On Thu, Feb 12, 2009 at 7:10 PM, Conrad wrote:
>
> Hi, is there a standard way to tell if a variable is bound? I couldn't
> find a way.
> Basically I want something like this, but without the horrible hacks:
>
> (defn bou
Sorry to keep revising things; here's an improved version of let->,
which better supports (as near as I can tell -- please try to break)
arbitrary let-style destructuring. (The previous version favored
single-symbol bindings, but I can imagine use cases where [a b :as
all] kinds of destructuring a
Hi, is there a standard way to tell if a variable is bound? I couldn't
find a way.
Basically I want something like this, but without the horrible hacks:
(defn bound? [var]
(try (eval var)
true
(catch java.lang.Exception x false)))
> (bound? 'foo)
false
> (def foo 33)
33
It is easy to do a lazy preorder walk of a tree (in psuedo-clojure):
(fn visit [node]
(lazy-cons node (map visit (get-children node
So, that much is obvious. However, I cannot think of an obvious way to do a
post-order traversal lazily. I sort of assume it cannot be done, as the
whole po
Sure. I'll send the document tomorrow.
On Thu, Feb 12, 2009 at 7:48 AM, Rich Hickey wrote:
>
>
>
> On Feb 11, 10:34 pm, Jeffrey Straszheim
> wrote:
> > I'd love to add Clojure-Datalog. I'm still working on it, but it now
> > implements complete Datalog rules, including stratified negation and
Hello again,
As I said in my first answer, clojuredev doesn't provide anything more than
what Eclipse has to offer in this area, at least not yet.
And honestly, I don't know if eclipse provides such a functionality "out of
the box".
Cheers,
--
Laurent
2009/2/11 Rayne
>
> Do you mean, just e
My Datalog stuff has a lot of circularities, and I chose the "map of keys"
approach. It has worked pretty well for me.
On Thu, Feb 12, 2009 at 3:24 PM, Jason Wolfe wrote:
>
> I think there are two basic ways to do this. One is to use one of the
> mutable Clojure types mentioned above (or any m
Hello,
Thanks for having shared that,
Do you know if there's a way to overload methods with the same arity, then ?
I'm thinking about .read(char ) .read(byte ) .read(String ) .read(Integer )
... for example, ?
--
Laurent
2009/2/12 Craig McDaniel
>
> For the benefit of others, since this t
On Feb 12, 2009, at 4:56 PM, anderspe wrote:
I have tried to compile a simple "Hello World" but the closest a got
was a class file, witch can't be used,
just reports that Class Hello could not be found.
I've seen this symptom before. The following rules may help:
- The target directory for t
In a nutshell (not tested, but nothing should miss, just typos if it doesn't
work) :
mkdir test-compile
cd test-compile
mkdir classes
mkdir src
mkdir src/echo
echo "(ns echo.test) (defn echo [msg] msg)" > src/echo/test.clj
java -cp path/to/clojure.jar:src/:classes/ clojure.lang.Repl
user> (compile
Have a look at how the clojure-contrib project is compiled. The
build.xml file will help.
--~--~-~--~~~---~--~~
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 12, 2009, at 3:39 PM, Phil Hagelberg wrote:
I'm no Java IO expert, but it sounds like a BufferedReader is the
right
thing in the majority of cases. I think having "read" wrap its
stream in
a PushbackReader where necessary is a much better, non-intrusive
solution, and my implementatio
For the benefit of others, since this took me a while to understand...
When using gen-class to extend or implement a superclass with
overloaded methods, use a single multi-arity function to override the
overloaded methods in the superclass:
expmeth/ClassA.java:
package expmeth;
public class Clas
Hi!
I have tried to compile a simple "Hello World" but the closest a got
was a class file, witch can't be used,
just reports that Class Hello could not be found.
Does anyone have time to tell me step by step how-to
I am new to LISP and Clojure but not to Java.
--~--~-~--~~
Mark Volkmann writes:
>> 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, b
On Thu, Feb 12, 2009 at 3:26 PM, Stuart Sierra
wrote:
>
> 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'
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
Hello, where can I find more Swing examples for Clojure?
hm
--~--~-~--~~~---~--~~
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
Thanks for your help, it worked.
On Feb 12, 12:15 am, Harrison Maseko wrote:
> OK. Let me try that.
>
> On Feb 11, 11:09 pm, Shawn Hoover wrote:
>
> > On Wed, Feb 11, 2009 at 3:10 PM, Harrison Maseko wrote:
>
> > > Hi everyone,
> > > I just downloaded Clojure Box today and tried to run the exa
I tackled this exact problem a few days ago. My solution was to use
atoms (very poorly). My code is on the group as bsptree.clj
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group,
+1 as well for pipe and let->
--~--~-~--~~~---~--~~
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+unsub
Hello,
I was surprised today to see that my Starcraft replay program became
slower when I updated my Clojure working copy. About a week ago,
Chouser helped me adding type hints to avoid reflection in my
functions. The warnings came back today.
I started going through the different revisions of
Mark Fredrickson writes:
> While (read) taking an argument seems valid, I think you can do what
> you want in the short term using binding:
read actually already takes an argument, it just (without my patch)
requires it to be a PushbackReader.
> IIRC, duck-streams has a (with-reader ...) form
On Thu, Feb 12, 2009 at 12:22 PM, Meikel Brandmeyer wrote:
> Hi,
>
> Am 12.02.2009 um 18:29 schrieb Mark Volkmann:
>
>> (def f-infinite-seq (map f (iterate inc 0))) ; values 0 through infinity
>>
>> (println "The first is" (first f-infinite-seq))
>> (println "The third is" (nth f-infinite-seq 2))
Stuart Sierra writes:
> I could change "duck-streams/reader" to return a PushbackReader
> instead of a BufferedReader. Unfortunately, "readLine" is defined in
> BufferedReader but NOT in PushbackReader. We need "readLine" for
> "clojure.core/line-seq". So we can't have it both ways. Blame Ja
+1 for pipe and let-> as above, with the non-seq => (non-seq local)
translation.
--~--~-~--~~~---~--~~
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 unsubs
Thanks for the help! The code comes from the Java tutorials at
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#headertooltip
which compiles and runs as advertised on my system.
Here's an attempt to use it in clojure, which does display the table
correctly, but the prn
> Nice work!
Thanks.
> Two things related to 'strcat'.
>
> 1) This is already implemented as clojure.core/str (and is more
> efficient than concat'ing)
> 2) This function is never called :)
Yeah, that code was cut and pasted from some older work I did. It was
removed when I started using prxml.
I think there are two basic ways to do this. One is to use one of the
mutable Clojure types mentioned above (or any mutable Java type) to
make an actually circular structure, as you describe. For instance,
you could accomplish (almost) what you want if :parent is an atom.
The other way is to gi
Let me amend:
Instead of pipe-as, I think the symbol-binding version of the macro
should be derived from the more common macro, which is -> & not pipe.
So I'd vote for pipe & a let-> that takes a bindings vector as its
first argument (sample implementation below).
Perry
(defmacro let->
"Like
On Thu, Feb 12, 2009 at 12:22 PM, Meikel Brandmeyer wrote:
> Hi,
>
> Am 12.02.2009 um 18:29 schrieb Mark Volkmann:
>
>> (def f-infinite-seq (map f (iterate inc 0))) ; values 0 through infinity
>>
>> (println "The first is" (first f-infinite-seq))
>> (println "The third is" (nth f-infinite-seq 2))
On Feb 12, 12:15 pm, Meikel Brandmeyer wrote:
> > I dislike this strategy for two related reasons: (1) It cannont be
> > nested. Here is a pseudo-example:
>
> > (?-> 2 ... some computations ... (f (?-> ... I don't have access to
> > the outer "?" anymore... )))
>
> > (2) Shadowing user bindings
Neat! You've removed the need to even define a dispatch-fn. I'll need to
chew on this for a bit (I'm a little slow :) I'm still working on my attempt
at implementing protocols, but I'm not totally clear on where it will go or
how useful it will be.
Seems like this kind of dispatch and the Datalog
After just having a quick discussion with Rich I think the specificity
discussion threw me off with regards to the functional aspect of the
templates transforming the document.
I'm definitely munging the two together in my examples and, at the
time, my expectations. But I think I have a better id
Rich Hickey writes:
> Yes. Issue/patch welcome.
Great; issue and patch attachment are here:
http://code.google.com/p/clojure/issues/detail?id=79&colspec=ID%20Type%20Status%20Priority%20Reporter%20Owner%20Summary
I haven't written much Java, but the implementation seems pretty
straightforward.
On Feb 12, 12:53 pm, Phil Hagelberg wrote:
> I'd expect to be able to do (read (reader my-file)), but this isn't OK
> because read needs a java.io.PushbackReader. It seems vaguely wrong
> somehow to have a function called "reader" return something that cannot
> be "read" from.
I could change "du
Hi Christophe,
Thank you for the quick reply!
Snippets
I think what you have suggested for snippets sounds perfect. Using
[selector to single out this snippet] from within a file is definitely
way better then what I was envisioning. I think having the ability to
define a single snippet as well a
While (read) taking an argument seems valid, I think you can do what
you want in the short term using binding:
(binding [*in* my-reader]
(print (read)))
It has been my general observation that vars + binding in Clojure fill
the niche that optional arguments fill in other languages. While it
ma
Hi,
Am 12.02.2009 um 18:29 schrieb Mark Volkmann:
(def f-infinite-seq (map f (iterate inc 0))) ; values 0 through
infinity
(println "The first is" (first f-infinite-seq))
(println "The third is" (nth f-infinite-seq 2))
The result is cached in f-infinite-seq. So as long as you hold
onto the
Hi,
Am 12.02.2009 um 16:15 schrieb Mark Fredrickson:
I dislike this strategy for two related reasons: (1) It cannont be
nested. Here is a pseudo-example:
(?-> 2 ... some computations ... (f (?-> ... I don't have access to
the outer "?" anymore... )))
(2) Shadowing user bindings. If I bind ? t
Phil Hagelberg writes:
> I've got a problem where I have a reader (it's a java.io.BufferedReader
> that came from duck-streams, if that matters at all) and I want to call
> "read" on it.
I should mention that I know *how* to do this:
(read (java.io.PushbackReader. (reader file)))
I just thi
On Feb 12, 2009, at 12:53 PM, Phil Hagelberg wrote:
>
>
> I've got a problem where I have a reader (it's a
> java.io.BufferedReader
> that came from duck-streams, if that matters at all) and I want to
> call
> "read" on it.
>
> I'd expect to be able to do (read (reader my-file)), but this is
I've got a problem where I have a reader (it's a java.io.BufferedReader
that came from duck-streams, if that matters at all) and I want to call
"read" on it.
I'd expect to be able to do (read (reader my-file)), but this isn't OK
because read needs a java.io.PushbackReader. It seems vaguely wrong
bOR_ writes:
>>> (push "/home/boris/.emacs.d" load-path)
>>This is actually already on the load-path by default; no need to add it.
>
> Standard load-path on ubuntu didn't include ~/.emacs.d for me. Not
> sure why not.
You're right; my bad.
> 1. Creating a .emacs with the load-path .emacs.d
>
Here's some simple code that demonstrates evaluation of items in an
infinite, lazy sequence. The function f contains a println side-effect
so I know when it's being called.
(defn f
"square the parameter and divide by 2"
[x]
(println "calculating f of" x)
(/ (* x x) 2.0))
; Create an infi
http://www.infoq.com/news/2009/02/jruby-clojure
Even if I'm a daily java programmer, I like the following sentence a lot :
"Choosing a lower level, system language, be it C (for MRI) or Java (for
JRuby)" , justifying to use clojure when JRuby needs performance (!) while
still using a "high level
thaks everyone!
-sun
On Feb 12, 11:59 am, Laurent PETIT wrote:
> Hello,
>
> one solution : java API to the rescue :
>
> (defn digits [s] (apply str (filter #(Character/isDigit %) s)))
>
> or
>
> (def digits (comp (partial apply str) (partial filter #(Character/isDigit
> %
>
> if you prefer
Hello,
one solution : java API to the rescue :
(defn digits [s] (apply str (filter #(Character/isDigit %) s)))
or
(def digits (comp (partial apply str) (partial filter #(Character/isDigit
%
if you prefer a more haskellish form :-)
2009/2/12 wubbie
>
> Hello,
>
> How can I do this? Do we
wubbie a écrit :
> Hello,
>
> How can I do this? Do we have a function that checks if
> it's a char or digit?
>
> (digits "a2c3")
> -> "23"
Many predicates on characters are defined in java.lang.Character:
http://java.sun.com/javase/6/docs/api/java/lang/Character.html
user=> (apply str (filter #(
Hello,
How can I do this? Do we have a function that checks if
it's a char or digit?
(digits "a2c3")
-> "23"
Thanks,
sun
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send
>
There seems to be a general consensus that some sort of explicit form
of threading would be useful. Below are snippets of other messages,
outlining the remaining points. I should point out that we are not
limited to one macro/function to handle our needs. For my own part, I
think as wri
On Feb 12, 2009, at 4:21 AM, Albert Cardona wrote:
I may be missing something fundamental about "binding", because I
can't
understand how the imports fail inside the binding block:
[this works]
But this doesn't (restarted the Repl to remove imports):
user=> (import '(java.io StringWriter
Christophe Grand a écrit :
> Tom Hickey a écrit :
>
>> What about grouping selectors?
>>
> Patch welcome :-)
>
Done.
#{[selector1] [selector2]} is selector1, selector2
I also added selector-steps union:
[#{:h1 :h2 :h3} :a] is h1 a, h2 a, h3 a
Christophe
--
Professional: http://cgra
Created issued including patch:
http://code.google.com/p/clojure/issues/detail?id=78
The CA is in the mail.
On Wed, Feb 11, 2009 at 2:08 PM, Rich Hickey wrote:
>
>
>
> On Feb 11, 4:36 am, "Remco van 't Veer" wrote:
>> On Tue, Feb 10, 2009 at 1:57 PM, Remco van 't Veer
>> wrote:
>>
>>
>>
> The real hit would come with bignums, no? But as far as the routine
> use of MOD goes we're probably talking about fixnums > 99% of the time.
Good point,
I tried some more timings on various configurations:
; Currently submitted (soon to be dethroned) patch
(defn mod1
"Modulus of num and d
Done: http://code.google.com/p/clojure/issues/detail?id=77
On Thu, Feb 12, 2009 at 2:06 PM, Rich Hickey wrote:
>
>
>
> On Feb 12, 5:30 am, "Remco van 't Veer" wrote:
>> Should I open in issue for this?
>>
>> W/dalvikvm( 214): VFY: unable to resolve virtual method 6650: Ljava/
>> lang/StringBu
There are also unchecked versions. Don't know if they are needed at
this moment. We have unchecked-remainder, but there isn't unchecked-
quotient or unchecked-modulo.
I added tests for mod, rem & quot to test-clojure.numbers:
http://code.google.com/p/clojure-contrib/source/browse/trunk/src/clojur
Dare I suggest it <- might be an interesting 'name' for 'pipe' given
that -> calls in prefix and 'pipe' calls in postfix. But I'd rather
not see it contending with Datalog which <- is nice to use. | isn't
'official', but it works fine... > and < aren't 'officially' usable in
symbols either so wh
On Feb 12, 5:30 am, "Remco van 't Veer" wrote:
> Should I open in issue for this?
>
> W/dalvikvm( 214): VFY: unable to resolve virtual method 6650: Ljava/
> lang/StringBuilder;.append (C)Ljava/lang/AbstractStringBuilder;
> W/dalvikvm( 214): VFY: rejecting opcode 0x6e at 0x0043
> W/dalvikvm(
On Feb 10, 2009, at 6:37 PM, Timothy Pratley wrote:
>
> I would have expected the mult to be a performance hit, but my overly
> simple tests show it performing better:
> user=> (time (dotimes [i 100] (zero? (* 5 11
> "Elapsed time: 183.358706 msecs"
> user=> (time (dotimes [i 100] (o
On Feb 11, 10:34 pm, Jeffrey Straszheim
wrote:
> I'd love to add Clojure-Datalog. I'm still working on it, but it now
> implements complete Datalog rules, including stratified negation and
> boolean filters. It can now be used for basic tasks, although the
> interface is rough.
>
> Name: Cloj
You night want to consider this:
user=> (def m {:myself nil :yourself 'moo})
#'user/m
user=> m
{:myself nil, :yourself moo}
user=> (def m2 (assoc m :myself m))
#'user/m2
user=> m
{:myself nil, :yourself moo}
user=> m2
{:myself {:myself nil, :yourself moo}, :yourself moo}
Now, if :myself' value w
On Feb 11, 6:48 pm, pmf wrote:
> Hi,
>
> I have just read about the upcoming JDK 6u14 [1], which mentions that
> one of the features is support for loading anonymous classes [2].
>
> Is this being considered for Clojure? I couldn't really extract from
> the article whether this is backwards-com
You might want to check out zippers, which give you the ability to
navigate and 'edit' a tree structure, but using immutable data
structures.
There are some good explanations on this thread:
http://groups.google.com/group/clojure/browse_thread/thread/d8871da625420b71/1bce7c6d9def2031
--~--~--
On Feb 12, 10:47 pm, Frantisek Sodomka wrote:
> Also, "mod" seems too strict about numbers it accepts (only
> integers!):
*chuckle* indeed, why be so strict!
Removed the integer checks, hey it is looking really similar to SBCL
now o_O
http://clojure.googlecode.com/issues/attachment?aid=-820378
"Plus a macro makes for shorter syntax, which is part of its purpose."
Yeah the shorter syntax becomes even more apparent when you're piping/
threading through one-arg functions where it also saves on
parenthesis, as the "->" and "pipe" macros expand to a list if
necessary.
E.g. this code in a c
Also, "mod" seems too strict about numbers it accepts (only
integers!):
user=> (rem 1 2/3)
1/3
user=> (mod 1 2/3)
java.lang.IllegalArgumentException: mod requires two integers
(NO_SOURCE_FILE:0)
user=> (rem 4.5 2.0)
0.5
user=> (mod 4.5 2.0)
java.lang.IllegalArgumentException: mod requires two in
Christophe Grand a écrit :
> Universal and attribute selectors can be easily added.
>
I added :* (universal), attr= and attr?
[:body :> :*] ; body > *
[[:a (attr= :href "http://google.com";)]] ; a[href="http://google.com";]
[[:a (attr? :href)]] ; a[href]
>> 4) Attributes
>> Do you hav
Hi Tom!
Thanks for your interest in Enlive.
Tom Hickey a écrit :
> I am trying out Enlive and had some questions regarding it's feature
> set and your future plans in terms of functionality.
>
I grow it as I go: I haven't a clearly outlined future features list
(I'm thinking about JS/jQuery
David Nolen and I were recently discussing CLOS and method dispatch. I
implemented such a scheme for my own use. This post is an FYI for
David and anyone else who might be interested in generic functions and
predicate dispatch.
Here's a transcript of a sample session in which I exercise the
dispa
Not a guru here (far from!), but don't get too thrown off by what the
word 'immutable' means in your head. In Clojure 'immutable' refers
more to how things work in the belly of the beast..
Clojure has 4 constructs (vars, refs, agents and atoms) to faciliate
mutating things. Probably the best thin
Should I open in issue for this?
W/dalvikvm( 214): VFY: unable to resolve virtual method 6650: Ljava/
lang/StringBuilder;.append (C)Ljava/lang/AbstractStringBuilder;
W/dalvikvm( 214): VFY: rejecting opcode 0x6e at 0x0043
W/dalvikvm( 214): VFY: rejected Lclojure/core$slurp__4218;.invoke
(Ljav
I may be missing something fundamental about "binding", because I can't
understand how the imports fail inside the binding block:
This works:
user=> (import '(java.io StringWriter))
nil
user=> (def bout (StringWriter.))
#'user/bout
user=> (bind
I'm new to Clojure so this may be a stupid question.
I want to make a tree out of these things:
(defstruct treeNode :parent :children :data)
so that every node knows which node is its parent and which nodes are
its children.
But, given that these things are immutable, I am baffled as to how th
On 11.02.2009, at 18:18, Perry Trolard wrote:
> In any case, I vote for approaching Konrad Hinsen about putting this
> in clojure.contrib.macros when a naming convention is agreed on.
When I started clojure.contrib.macros, I intended it as a repository
for everybody's small macros that don't h
94 matches
Mail list logo