Nice! Towards a similar purpose, I wrote a little Emacs hack last week
that web-scrapes clojars.org and inserts the artifact declaration at
the cursor. Since I had to rely on their search feature, I couldn't do
proper regular expression matching.
-Per
On Fri, Apr 9, 2010 at 11:23 AM, Heinz N. Gie
On Fri, Apr 9, 2010 at 11:26 AM, Douglas Philips wrote:
> On 2010 Apr 8, at 11:48 PM, Per Vognsen wrote:
>>
>> The body of fn is still compiled in an expression context. When the
>> compiler sees (fn [...] ...), it will introduce the bindings into the
>> local environment and recursively compile t
On 2010 Apr 8, at 11:48 PM, Per Vognsen wrote:
The body of fn is still compiled in an expression context. When the
compiler sees (fn [...] ...), it will introduce the bindings into the
local environment and recursively compile the body in that
environment. Note that I said compile rather than eva
Some people might have had to endure my complains about maven already (no
worries this isn't one of them). Them aside I usually don't complain without
attempting to do something against the problem I see.
So here you go lein-search. It's by far not perfect and surely not the nicest
or best way
Adam Smyczek's "Introduction to Monads" video is now available.
http://www.youtube.com/user/LinkedInTechTalks?feature=mhw5#p/u/0/ObR3qi4Guys
I'll work on getting an HD version up Friday.
-mike
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post
On Fri, Apr 9, 2010 at 10:35 AM, Douglas Philips wrote:
> On 2010 Apr 8, at 11:16 PM, Per Vognsen wrote:
>>
>> It's not a defn thing. If you write (do (a) (b) (c)) at the REPL, you
>> should see the same exception.
>
> Yes, I would expect that since at the REPL I am asking to have the
> expression
On 2010 Apr 8, at 11:16 PM, Per Vognsen wrote:
It's not a defn thing. If you write (do (a) (b) (c)) at the REPL, you
should see the same exception.
Yes, I would expect that since at the REPL I am asking to have the
expression evaluated immediately.
Same with let.
Yet, if I say: '(do (a) (b)
On Fri, Apr 9, 2010 at 10:04 AM, Douglas Philips wrote:
> I'm trying to understand how the two forms here differ:
>
> In a fresh repl:
>
> user=> '((a) (b) (c))
> ((a) (b) (c))
>
> which is OK, those are just symbols.
>
> But then:
>
> user=> (defn x [] (a) (b) (c))
> j
I'm trying to understand how the two forms here differ:
In a fresh repl:
user=> '((a) (b) (c))
((a) (b) (c))
which is OK, those are just symbols.
But then:
user=> (defn x [] (a) (b) (c))
java.lang.Exception: Unable to resolve symbol: a in this context
(NO_SOURCE_FIL
On Thu, Apr 8, 2010 at 3:32 PM, Stefan Kamphausen
wrote:
> In the long run the Clojure community should either create an
> "official" fork of SLIME (and try to port the good stuff, that happens
> in SLIME) or try to work closer together with the fine SLIME folks. I
> don't think that we should ri
Or you can separate concerns a bit more:
(defn transpose [xs]
(apply map vector xs))
Now Nurullah's original suggestion applies:
(map #(apply max %) (transpose xs))
-Per
On Fri, Apr 9, 2010 at 12:38 AM, James Reeves
wrote:
> On Apr 8, 1:13 pm, John Sanda wrote:
>> [
>> [1 2 3]
>> [2 5
Thanks for your response. Since that's already more than I can chew
I'll stick to regular pom files as I try to follow your directions and
look through docs and samples.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email
On Thu, 08 Apr 2010 18:32:56 -0400, Stefan Kamphausen
wrote:
you're using a rather recent checkout of CVS SLIME. They added
keyword args to compile-file-for-emacs which is currently not
understood on the clojure swank side. The quickest way to fix that
would be changing that part of SLIME.
It sounds like the doseq is the macro you're looking for, e.g.
(doseq [c my-components]
(.setVisible c true))
On Thu, Apr 8, 2010 at 5:07 PM, strattonbrazil wrote:
> What's the function to call java code on multiple java components? If
> I have a sequence of Java swing components and I want t
Hi,
you're using a rather recent checkout of CVS SLIME. They added
keyword args to compile-file-for-emacs which is currently not
understood on the clojure swank side. The quickest way to fix that
would be changing that part of SLIME. Yes, this is ugly.
It's really a pity that SLIME and clojure
> What's the function to call java code on multiple java components? If
> I have a sequence of Java swing components and I want to go through
> and set the same properties for each one, I would use a for loop in
> Java. If I were using immutable structs in clojure, I'd just a map
> and just chang
What's the function to call java code on multiple java components? If
I have a sequence of Java swing components and I want to go through
and set the same properties for each one, I would use a for loop in
Java. If I were using immutable structs in clojure, I'd just a map
and just change the keys
On Thu, Apr 8, 2010 at 4:57 PM, Armando Blancas
wrote:
>> Looks cool. This should help the XML-allergic :)
>
> Though I don't like it, the XML is the least of my problems. Don't
> know what to do or even where to start. I want to do the following in
> maven or pmaven, but anything beyond their Hel
On Apr 8, 11:08 am, David Nolen wrote:
> In my own code I only avoid the convenience of destructuring in the
> rare tight loops such as calculations intended to drive animations.
But when you write a function you would have to decide positional vs.
keyword. Would you then take a guess about usage
> Looks cool. This should help the XML-allergic :)
Though I don't like it, the XML is the least of my problems. Don't
know what to do or even where to start. I want to do the following in
maven or pmaven, but anything beyond their Hello World example has
been a real struggle :-(Any pointers?
Yes, I meant that :-)
But I agree that some more sugar in general in map destructuring could
help (and be more DRY).
e.g.
(defn g [a b & {:keys [[c 1] [d 2]]}] [a b c d])
or
(defn g [a b & {c [:c 1] d [:d 2]]}] [a b c d])
in the general case
2010/4/8 Chris Perkins :
> On Apr 7, 5:41 am, La
On Apr 7, 5:41 am, Laurent PETIT wrote:
> I think defnk is deprecated by the new feature mentioned by Stuart.
Do you mean to say that this:
user=> (defnk f [a b :c 1 :d 2] [a b c d])
#'user/f
user=> (f 3 4 :d 7)
[3 4 1 7]
is deprecated in favor of this:
user=> (defn g [a b & {:keys [c d] :or {
Another one using for
(defn col-widths [arr] (for [i (range (count arr))] (apply max (map #(nth %
i) arr
On Thu, Apr 8, 2010 at 1:55 PM, John Sanda wrote:
> Thanks for the explanation. I did see in the docs that the map function can
> take multiple collections, but I guess I did not quite u
Thanks for the explanation. I did see in the docs that the map function can
take multiple collections, but I guess I did not quite understand it. Your
explanation really helps illustrate how it works. My Java version of this is
probably around 30 lines with several branches/execution paths and vari
If I got you right this time, if you
(apply interleave [[1 2 3] [2 5 1] [4 2 6]])
you will get,
(1 2 4 2 5 2 3 1 6)
then if you partition by 3,
(partition 3 (apply interleave [[1 2 3] [2 5 1] [4 2 6]]))
you get,
((1 2 4) (2 5 2) (3 1 6))
then as before applying max,
(map #(apply max %)
On Apr 8, 1:13 pm, John Sanda wrote:
> [
> [1 2 3]
> [2 5 1]
> [4 2 6]
> ]
>
> I am comparing the values in each of the columns, so the result should be [4
> 5 6] where the first element represents the largest value in the first
> column, the second element represents the largest value in th
Hi,
I setup my emacs/swank-clojure/clojure without using elpa. I could run
slime/swank-clojure and evaluate an expression just fine, but when I
try to compile with C-c C-k, it give me this error.
Wrong number of args passed to: basic$eval--2073$compile-file-for-
emacs
[Thrown class jav
That is actually not what I want. Consider the vector a table where each
element which is itself a vector a row. And each element of a nested vector
is a cell where its index indicates its column. Writing it as follows may
make it more clear,
[
[1 2 3]
[2 5 1]
[4 2 6]
]
I am comparing the v
If you just want max in each group you can use,
(map #(apply max %) [[1 2 3] [2 5 1] [4 2 6]])
this will give you,
(3 5 6)
Regards,
--
Nurullah Akkaya
http://nakkaya.com
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send
Hi,
I am just getting started with Clojure and with functional programming for
matter. I decided that a good exercise would be for to try and port some
Java code that I recently wrote. In the Java code I had a 2-D array which
basically represents a table of values, and to keep things simple assume
In my own code I only avoid the convenience of destructuring in the
rare tight loops such as calculations intended to drive animations.
I've found it to have little effect elsewhere on program performance.
As an aside I personally prefer non positional keyword arguments. I
find positional ones qui
You can easily code positional keyword parameters yourself. It takes
only a few minutes for a basic version. Here's an admittedly not very
pretty example:
http://gist.github.com/360145
-Per
On Thu, Apr 8, 2010 at 9:13 PM, Sophie wrote:
> On Apr 7, 7:56 am, David Nolen wrote:
>> The runtime cos
On Apr 7, 12:37 pm, Armando Blancas wrote:
> in other languages they'd be annotations and maybe perceived
> as redundant, e.g. a call like: (circle x y radius) is readable
Ah, but what about:
(circle year population income)
vs.
(circle :x year :y population :r income)
> In Smtalltalk a single-ar
On Apr 7, 7:56 am, David Nolen wrote:
> The runtime cost of destructuring is not worth getting worked up
> about. It's easy to check this yourself with (time ...)
Results below:
user=> (defn fk [& {:keys [a b c]}] (+ a b c))
user=> (defn fp [a b c] (+ a b c))
user=> (time (dotimes [_ 100]
Indeed, and in the absence of single stepping (manual or automatic),
some simple trace macros can be very useful. Here's what I use right
now:
http://gist.github.com/360102
-Per
On Thu, Apr 8, 2010 at 8:38 PM, Sean Devlin wrote:
> The REPL is you best friend whenever you have a question like th
The REPL is you best friend whenever you have a question like this.
It's often useful to execute the offending form step by step, to see
what the result of each computation is.
Love the REPL.
Sean
On Apr 7, 8:45 pm, Per Vognsen wrote:
> The second case is equivalent to (into [] [{:a 1 :b 2}]).
On 08/04/2010, at 9:09 PM, Jarkko Oranen wrote:
>
>> Hopefully you can see that this syntax falls out of the direct construction
>> of maven Model object, unmediated by intermediate syntax or data
>> structuring. So there's a good reason for the way it looks.
>>
>
> Right. Thanks for the tho
On Thursday 08 April 2010 13:33:43 Alex Osborne wrote:
Hi Alex,
> > To get swank-clojure.jar I need to check out the project from github
> > and use "lein jar" to generate the jar, right? Or is it possible to
> > download a ready-made jar?
>
> You can just download it by hand from Clojars if yo
> Hopefully you can see that this syntax falls out of the direct construction
> of maven Model object, unmediated by intermediate syntax or data structuring.
> So there's a good reason for the way it looks.
>
Right. Thanks for the thorough explanation. It's not so bad if you
quote the vectors i
Tassilo Horn writes:
> To get swank-clojure.jar I need to check out the project from github and
> use "lein jar" to generate the jar, right? Or is it possible to
> download a ready-made jar?
You can just download it by hand from Clojars if you like:
http://clojars.org/repo/swank-clojure/swank-
>If you have any idea or inkling why swank-clojure wasn't able to
>automatically download the jars please let me know; I'd like to get it
>fixed.
Seems that it didn't download swank-clojure.jar because I already had
a .clojure folder.
--
You received this message because you are subscribed to th
>> It will only download anything if ~/.swank-clojure and ~/.clojure
>> don't exist.
>
> Ah, then that's my problem. I already have a ~/.clojure/ directory with
> a user.clj, the leiningen jar, and some additional jars, but not
> swank-clojure.jar. ~/.swank-clojure doesn't exist, though.
>
That
On Thursday 08 April 2010 12:28:07 Alex Osborne wrote:
Hi Alex,
> > To me, all this stuff seems to magical, for example that
> > swank-clojure downloads the required clojure/contrib jars (at least
> > the comment in the el-file says so). How do I know what version it
> > will fetch? How does it
Tassilo Horn writes:
> To me, all this stuff seems to magical, for example that swank-clojure
> downloads the required clojure/contrib jars (at least the comment in the
> el-file says so). How do I know what version it will fetch? How does
> it know when to update those jars?
It will only down
On Thursday 08 April 2010 12:08:37 Pelayo Ramón wrote:
Hi!
> > M-x slime RET
> >
> > I only get this error:
> >
> > ,
> > | Clojure 1.1.0
> > | user=> java.io.FileNotFoundException: Could not locate
> > swank/swank__init.class or swank/swank.clj on classpath: (NO_SOURCE_FILE:0)
> > | user=
> M-x slime RET
>
> I only get this error:
>
> ,
> | Clojure 1.1.0
> | user=> java.io.FileNotFoundException: Could not locate
> swank/swank__init.class or swank/swank.clj on classpath: (NO_SOURCE_FILE:0)
> | user=> user=> java.lang.ClassNotFoundException: swank.swank
> (NO_SOURCE_FILE:0)
>
On 08/04/2010, at 5:45 PM, Jarkko Oranen wrote:
> Looks cool. This should help the XML-allergic :)
>
> Though, is there a reason why all symbol arguments to defmodel have to
> be quoted? It looks rather unpleasant. Seems like you should be able
> to fix that by changing the body of defmaven to
>
On Thursday 08 April 2010 07:08:43 Phil Hagelberg wrote:
Hi Phil,
> Both those options sound like an awful lot of work. I'm curious as to
> what advantages there are to this method over the original
> installation instructions.
To me, all this stuff seems to magical, for example that swank-cloj
Looks cool. This should help the XML-allergic :)
Though, is there a reason why all symbol arguments to defmodel have to
be quoted? It looks rather unpleasant. Seems like you should be able
to fix that by changing the body of defmaven to
`(reset! *MODEL* (Model ~@(for [a args] `(quote ~a
Ano
49 matches
Mail list logo