On Sat, Feb 5, 2011 at 1:01 AM, Alan wrote:
> That's not how macros work. They can only operate on the parameters
> they're passed, as symbols and lists.
Clojure macros can also see literal maps, sets, and vectors, not to
mention integers, strings, and the like. (Ever seen
"IllegalArgumentExcepti
That's not how macros work. They can only operate on the parameters
they're passed, as symbols and lists. If you prepare a value for them
elsewhere, those values will only be available in the macroexpansion
(runtime), not at compile time.
Granted, it would be nice if the functionality were exposed
On Sat, Feb 5, 2011 at 12:08 AM, Eugen Dück wrote:
> yes, the code is more complex and it is in contrib. Changing contrib
> requires you to send an intercontinental mail first, as mentioned in
> my other post today... :) Reason enough to first checkout the other
> options and dig deeper into macro
On Fri, Feb 4, 2011 at 10:35 PM, Ken Wesson wrote:
> Perhaps. But it's well known that any barrier to participation causes
> a percentage drop in same.
This topic keeps coming up, and while a large number of people have
signed CAs (many of us at the conference last year), people keep
citing it as
On Feb 5, 1:52 pm, Eric Lavigne wrote:
> This makes me think that the original macro needs some refactoring.
> There should be a function that handles most of the work, and a macro
> to make your code shorter in the common case.
>
> (defn unquoted-param [x] (println x))
>
> (defmacro quoted-param
I have a bunch of older computers sitting at home, and thought I'd put
them to use for experimenting with clojure-hadoop and swarmiji.
However, I can't figure out which branch of clojure-hadoop to use.
Stuart Sierra's branch looks like the canonical one, but hasn't been
updated since March 2010. a
>> Which is of course what the quote is supposed to do. But is there any
>> way to get that macro to expand to using the value of asdf, rather
>> than the symbol itself? Or can only changing the macro fix this? I
>> fear the latter, which would imply that using quotes like that in a
>> macro should
On Fri, Feb 4, 2011 at 11:24 PM, Eugen Dück wrote:
> I'm using a macro that, stripped down to just expose my problem, looks
> like this:
>
> (defmacro quoted-param
> [x]
> `(println '~x))
>
> It's all nice if I call it like
>
> (quoted-param 23)
>
> It will print the number 23. The following, ho
I'm using a macro that, stripped down to just expose my problem, looks
like this:
(defmacro quoted-param
[x]
`(println '~x))
It's all nice if I call it like
(quoted-param 23)
It will print the number 23. The following, however, will print
"asdf", rather than 23:
(def asdf 23)
(quoted-param
On Fri, Feb 4, 2011 at 9:51 PM, Sean Corfield wrote:
> On Fri, Feb 4, 2011 at 6:39 PM, Ken Wesson wrote:
>> It says "Transfer of a right on a nonexclusive basis does not require
>> a written agreement". As long as Clojure gets a worldwide,
>> nonexclusive, royalty-free license with EPL-compatible
On Feb 5, 11:51 am, Sean Corfield wrote:
> off to Rich... If someone really feels signing and mailing an
> agreement is "too much work" then they don't seem very committed to
> contributing, IMO. It's really not much of a hardship is it?
Things like github's pull requests are really great, as the
On Fri, Feb 4, 2011 at 6:39 PM, Ken Wesson wrote:
> It says "Transfer of a right on a nonexclusive basis does not require
> a written agreement". As long as Clojure gets a worldwide,
> nonexclusive, royalty-free license with EPL-compatible redistribution
> terms, that ought to be good enough, shou
On Fri, 4 Feb 2011 18:36:34 -0800
Sean Corfield wrote:
> On Fri, Feb 4, 2011 at 6:16 PM, Eugen Dück wrote:
> > Is it really necessary, though? We all agree to EULAs and make other
> > more significant legal commitments online all the time, and in some
> > cases without having proven who and wher
On Fri, Feb 4, 2011 at 9:36 PM, Sean Corfield wrote:
> On Fri, Feb 4, 2011 at 6:16 PM, Eugen Dück wrote:
>> Is it really necessary, though? We all agree to EULAs and make other
>> more significant legal commitments online all the time, and in some
>> cases without having proven who and where we a
On Fri, Feb 4, 2011 at 6:16 PM, Eugen Dück wrote:
> Is it really necessary, though? We all agree to EULAs and make other
> more significant legal commitments online all the time, and in some
> cases without having proven who and where we are.
There are certainly some legal transactions that do no
On Fri, 4 Feb 2011 18:00:24 -0800
Sean Corfield wrote:
> On Fri, Feb 4, 2011 at 5:24 PM, Eugen Dück wrote:
> > Furthermore, I was really surprised to find on
> > http://clojure.org/contributing
> > that I have to send a (non-e)mail around the world to be able to
> > contribute
> Written accepta
On Feb 5, 11:00 am, Sean Corfield wrote:
> On Fri, Feb 4, 2011 at 5:24 PM, Eugen Dück wrote:
> > Furthermore, I was really surprised to find
> > onhttp://clojure.org/contributing
> > that I have to send a (non-e)mail around the world to be able to
> > contribute
>
> Written acceptance of a contr
On Fri, Feb 4, 2011 at 5:24 PM, Eugen Dück wrote:
> Furthermore, I was really surprised to find on http://clojure.org/contributing
> that I have to send a (non-e)mail around the world to be able to
> contribute
Written acceptance of a contributor's agreement is fairly common on
large open source
In June 2009, Rich wrote in "clojure goes git!":
> Some items are still outstanding:
>
> Importation of existing issues
> Placement of generated contrib documentation
> Patch submission policy
>
> In particular, please don't send pull requests via GitHub at this
> time.
An
On Feb 4, 11:06 am, Conrad wrote:
> Thanks guys for the informative replies!
Probably also worth reading the tutorial (lein help tutorial in recent
versions) as it covers these questions in more depth.
-Phil
--
You received this message because you are subscribed to the Google
Groups "Clojure"
On Fri, 04 Feb 2011 15:05:39 -0500, B Smith-Mannschott
wrote:
What should I name this thing? I'm concerned that "thread" is
confusing due to its dual meaning. let seems in line with clojure
conventions.
(thread-let [x ...] ...)
(thread-with [x ...] ...)
(thread-through [x ...] ...)
(let-> [x
Exciting. Keep me updated.
On Feb 4, 1:39 pm, Mark Fredrickson
wrote:
> Thanks to one and all for the replies. For the moment, I'm going to
> concentrate on the DSL itself and start puttering with a Clojure
> parser for CodeMirror (http://codemirror.net/), a JavaScript text
> editor, which should
On Fri, Feb 4, 2011 at 12:05, B Smith-Mannschott wrote:
> I came up with this macro, but I'm unsure what to call it:
>
> (defmacro thread-let [[varname init-expression :as binding] & expressions]
> {:pre [(symbol? varname)
> (not (namespace varname))
> (vector? binding)
>
Missing some parens there. Should be (->> (take 2)), of course.
On Feb 4, 12:53 pm, Alan wrote:
> Another solution, which is not especially satisfying but is worth
> considering, is to use the most-common thread style at the top level,
> and interweave some exceptions for the less-common style.
>
Another solution, which is not especially satisfying but is worth
considering, is to use the most-common thread style at the top level,
and interweave some exceptions for the less-common style.
(-> 10
range 20
(->> take 2))
or
(->> 10
(#(range % 20))
(take 2))
On Feb 4, 12:05 pm
On Fri, Feb 4, 2011 at 3:05 PM, B Smith-Mannschott
wrote:
> (defmacro thread-let [[varname init-expression :as binding] & expressions]
> {:pre [(symbol? varname)
> (not (namespace varname))
> (vector? binding)
> (= 2 (count binding))]}
> `(let [~@(interleave (repeat varna
Clojure's threading macros -> and ->> to be quite a win. It breaks
down when the expression to be chained together are not consistent in
nesting the threaded expression second or last. An idiomatic way to
gain the necessary flexibility seems to be via let:
(let [x (line-seq x)
x (sort x)
Thanks to one and all for the replies. For the moment, I'm going to
concentrate on the DSL itself and start puttering with a Clojure
parser for CodeMirror (http://codemirror.net/), a JavaScript text
editor, which should be simplified by cribbing from the Scheme parser
implementation. This is someth
Thanks guys for the informative replies!
-Conrad
On Feb 4, 11:30 am, Conrad wrote:
> Hi everyone: Even though I'm an intermediate clojure user, I realize
> there's some basic things I just don't understand about JARs and
> Leiningen. It seems to me the answers to these questions would make
> gre
If you need efficient numeric matrix operations, your best bet is to
move away from higher level abstractions like seqs and (especially)
refs and just use a one-dimensional Java array of primitives of size
(* m n), and indexed as (+ (* i m) j) or (+ (* j n) i) using primitive
arithmetic for speed.
Yes, Ken's original suggestion was correct -- the clojure code had to
look like a real java bean. It works perfectly now, so thanks!
On Feb 3, 3:55 pm, Stuart Sierra wrote:
> I don't know what "select * from StockTick(symbol=..." is doing, but it
> looks like the error is coming from the library
Thanks a lot for both responses. I really appreciate it! The zip is really nice.
On Fri, Feb 4, 2011 at 11:39 AM, Despite wrote:
> I like to use zip and zip-filter with xml files. For example (suppose
> clojure.zip is aliased as zip and clojure.contrib.zip-filter.xml is
> aliased as zf):
>
> (
Could you possibly put up a minimal example of code that shows the
problem? I'm having a hard time following exactly what you're doing
but would like to help. :)
sincerely,
--Robert McIntyre
On Fri, Feb 4, 2011 at 10:20 AM, Nick wrote:
> I've got a matrix transformation that I'm doing which i
cool! thought you had to refer or something the namespace, but i guess
the reader works differently.
changes are here
https://github.com/Storkle/defrecord2
basically, i modified it to work with print-dup and i got rid of the
pprint methods and changed the way constructor names are specified. so
n
On Fri, 4 Feb 2011 08:30:21 -0800 (PST)
Conrad wrote:
> Hi everyone: Even though I'm an intermediate clojure user, I realize
> there's some basic things I just don't understand about JARs and
> Leiningen. It seems to me the answers to these questions would make
> great additions to the Leiningen
These are all questions about Maven, the dependency management / build
system used by many Java developers, on top of which leiningen is built.
1. The sources are publicly accessible maven repositories, of which clojars
is one. When running 'lein deps', you can see the repositories that
leiningen
I've got a matrix transformation that I'm doing which is really slow.
I'm looking for ways to speed it up.
source is a NxD matrix (seqs of seqs of values). I will set and read
this matrix.
dest is a NxN transformation of f in which indices are mapped to
specific indices of f. I will only read th
I like to use zip and zip-filter with xml files. For example (suppose
clojure.zip is aliased as zip and clojure.contrib.zip-filter.xml is
aliased as zf):
(def bo-zip (zip/xml-zip (xml/parse "http://api.twitter.com/1/statuses/
friends/barackobama.xml"
Then I can use zip-filters to get the info I
Hi everyone: Even though I'm an intermediate clojure user, I realize
there's some basic things I just don't understand about JARs and
Leiningen. It seems to me the answers to these questions would make
great additions to the Leiningen FAQ (unless I'm the only one
boneheaded enough not to be able to
Here is my attempt using enlive:
(require '[net.cgrand.enlive-html :as html])
(import '[java.net URL]))
(def *url* "http://api.twitter.com/1/statuses/friends/barackobama.xml";)
(defn print-friends [url]
(let [data (html/xml-resource (URL. url))]
(doseq [user (html/select data [:user])]
On Feb 4, 10:11 am, Ken Wesson wrote:
> This does it without using juxt:
>
> (defn supermap [fs & cs]
> (map apply fs (apply map vector cs)))
This is really nice. Even handles infinity properly:
(supermap (repeat +) (range 3) (range 3))
=> (0 2 4)
Thanks Ken and Meikel!
Mike
--
You receiv
On Fri, Feb 4, 2011 at 10:11 AM, Ken Wesson wrote:
> With juxt it's as Meikel wrote:
>
> (defn supermap [fs & cs]
> (apply map (apply juxt fs) cs))
Or not. Hm, juxt documentation needs clarifying.
> (defn supermap [fs & cs]
> (map apply fs (apply map vector cs)))
--
You received this messag
On Fri, Feb 4, 2011 at 9:19 AM, Mike wrote:
> This is probably a pretty newb question...sorry. I'm looking for the
> idiomatic way to apply a seq of functions to other seqs. In other
> words, a version of map that doesn't take a single f, but a seq of
> them.
>
> (map f c1 c2 ... cn)
> => ((f c1
Or maybe on a second look:
(map apply fs c1 ... cn)?
(user=> (map #(apply %1 %&) [+ - *] [1 2 3] [1 2 3])
(2 0 9)
vs.
user=> (map (juxt + - *) [1 2 3] [1 2 3])
([2 0 1] [4 0 4] [6 0 9])
Sincerely
Meikel
--
You received this message because you are subscribed to the Google
Groups "Clojure" gr
Hi,
(map (juxt f1 f2 f3) c1 c2 c3)
(map (apply juxt fs) c1 c2 c3)
(apply map (apply juxt fs) cs)
Sincerely
Meikel
--
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
This is probably a pretty newb question...sorry. I'm looking for the
idiomatic way to apply a seq of functions to other seqs. In other
words, a version of map that doesn't take a single f, but a seq of
them.
(map f c1 c2 ... cn)
=> ((f c11 c21 ... cn1) (f c12 c22 ... cn2) ... (f c1m c2m ... cnm)
Hi Mark,
I don't have answers to your bigger questions, but
> question: if GAE is the only game in town, do people have a
> preferrence over the various packages available on github (app-magic,
> appengine-clj, others)?
I've recently moved my apps to appengine-magic. It does a good job of
setti
Hello, Can some one show me how to navigate through xml?
I am trying to have some fun with clojure and think of doing a simple
xml navigation, it seems I didn't get the basics and not know how to
do this simple thing in clojure.
For example, I try to get the user id and name of all barackobama
tw
Hi,
On 4 Feb., 01:03, Stuart Sierra wrote:
> Or get another operating system. :)
In general this won't help. A quick check on wikipedia gave, that only
reiserfs allows for filenames longer than 256 Bytes. (looking at:
ext3, ext4, reiserfs, XFS, JFS, HFS+, NTFS; for ufs there was no info,
but I
49 matches
Mail list logo