Nice. Thanks Peter. I use the n, p and v navigations now, but always want to
do that vim / Ctrl-d thing, lol. I figure I just need to spend some time
getting used to emacs' navigation idioms. It's going to take a lot of doing
to pull me away from vim habits.
Tim
On Wed, Sep 14, 2011 at 8:50 PM,
You only need the do sequence in queue-copy-fetch but not in process-indexes
should be "You only need the dosync in queue-copy-fetch but not in
process-indexes."
Matt Hoyt
From: Matt Hoyt
To: "clojure@googlegroups.com"
Sent: Thursday, September 15, 2011 1:01
Map returns a lazy sequence, the list of values is not realized yet,
you need to consume the lazy seq to obtain the values.
You should use (doseq [f fetches-seq] (queue-copy-fetch f))) if you have only
side effects to generate and do
not care about reusing the values returned by queue-copy-fetch.
Map is lazy so it only gets called when you need something from the sequence.
To force it to be called you use doall so it would be (doall (map
queue-copy-fetch fetches-seq)).
You only need the do sequence in queue-copy-fetch but not in process-indexes.
Matt Hoyt
___
Thanks Jason,
I think some sort of priority queue may be the solution.
Thanks,
Sunil.
On Wed, Sep 14, 2011 at 12:39 AM, Jason Wolfe wrote:
> There is java.util.PriorityQueue, which is heap-based:
>
>
> http://download.oracle.com/javase/1,5.0/docs/api/java/util/PriorityQueue.html
>
> -Jason
>
>
Hi chouser,
Thanks for your response. but correct me if I am wrong.. wouldn't
sorted-set completely sort the complete collection without actually taking
into account that only the first few elements are needed?
Thanks,
Sunil.
On Tue, Sep 13, 2011 at 7:15 PM, Chouser wrote:
> On Tue, Sep 13, 201
I'm sure this is very straightforward but can someone enlighten me why
queue copy fetch is seemingly never called from within process-indexes
(the 'pre add' line is printed but the 'adding' debug line is never
printed). I've verified the correct contents of fetches-seq. For a
bonus point can I ask
On Wed, 14 Sep 2011 15:34:25 -0400, Denis Labaye
wrote:
I played with it a little bit, can't make the latest version (0.7) to
work, only the 0.5.
The current version will require you use (with-script-language
:pallet.stevedore.bash/bash …) to specify bash as the target language
So far
In emacs you can give a number to preface many commands, e.g. C-37 C-n will
perform "next line" 37 times, and C-37 C-p will perform "previous line" 37
times. You can setup keybindings for these as well, but I find the basic
navigation commands like C-v/M-v (up/down a page) and C-l (center curren
You can't easily prevent the loading of B unless it's in a separate
directory that isn't part of your classpath during testing.
You could define B-mock to load B and then redefine all the symbols.
-S
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
Hey Benjamin,
Thanks for the tips !! Have no fears about my passion for vim :)
I'm actually using vimclojure now, and it has fabulous command completions
for clojure functions, which I love. I did get the nailgun server setup, and
connected. But 1) there's a lot of gymnastics involved in getti
Far out - this is great stuff. Thanks guys.
Wrt to moving down (or up) a block, vim-style, what I mean is the following
(all functionality in 'Command Mode').
In Vim , you press *Ctrl-d* and *Ctrl-u* to go down and up a block
respectively. Depending on the size of your window, it moves the cursor
On Wed, Sep 14, 2011 at 9:43 AM, Aaron Bedra wrote:
> And the supporting ticket in JIRA
>
> http://dev.clojure.org/jira/browse/CLJ-31
Nice. Now I understand better why this was disabled.
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http:
On Wed, Sep 14, 2011 at 3:35 PM, Fogus wrote:
>> diagonals as neighbors. We don't think we take advantage of the
>> flexibility anywhere in the book, so perhaps your version would indeed
>> be better.
I meant to say "I" didn't think. Sorry, didn't mean to put words in
your mouth, Fogus.
> It w
It certainly helped :)
I played around with it last night after chouser's response and it all made
sense, thanks!
Cheers,
Leonardo Borges
www.leonardoborges.com
On 15/09/2011, at 1:39 AM, Sean Corfield wrote:
> On Wed, Sep 14, 2011 at 5:58 AM, Leonardo Borges
> wrote:
>> (defn neighbors
>>
Hi all,
I'm sending this on behalf of Jon Jagger, the Conference Chair. It is a great
conference.
ACCU is a non-profit organisation run by software enthusiasts for
software enthusiasts.
ACCU warmly invites you to propose a session for this leading software
development conference.
Call for Pr
On Wed, Sep 14, 2011 at 3:58 PM, octopusgrabbus
wrote:
> Alan:
>
> I may have misunderstood what I've read both in books, blogs, and the
> Clojure site, but it seems that writing recursive functions in the loop ..
> recur style is the preferred style. I also remember most of the texts
> currently
Hi,
2011/9/14 Alan Malloy
> You can prefer anything you want, but (a) to say that Clojure prefers
> loop/recur is nonsense, and (b) you can't make an incorrect algorithm
> work just by preferring it. Jeff is correct that your algorithm
> requires space for each level of the tree, and so cannot b
2011/9/14 Meikel Brandmeyer
> Hi,
>
> Am 14.09.2011 um 16:54 schrieb octopusgrabbus:
>
> > (defn skl
> > [tree]
> > (map skl (filter seq? tree)))
> >
>
> Is that what you want?
>
> (defn skl
> [tree]
> (loop [output []
> tree (seq tree)]
>(if tree
> (let [fst (first tree)
You could call the mock file B_mock.clj
then
(require '[B-mock :as B])
Jonathan
On Wed, Sep 14, 2011 at 5:19 PM, Brian Hurt wrote:
> Say I have two name spaces, A and B, with A depending on B. I want to test
> namespace A, replacing module B with a mock B for testing purposes-
> preferably wi
Alan:
I may have misunderstood what I've read both in books, blogs, and the
Clojure site, but it seems that writing recursive functions in the loop ..
recur style is the preferred style. I also remember most of the texts
currently out on Clojure say use the higher level sequence functions rath
Thanks. I'll have a look.
--
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 post.
To unsubscribe from this
Hi all,
With sign-off from Rich, I have pushed my defrecord work onto master.
Please try it out and let me know if you experience any issues.
Cheers,
Tom Hickey
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to cl
The Aparapi project was open sourced today take a look at
http://aparapi.googlecode.com. Although previous comments had listed
concerns with Aparapi code restrictions, it would be great to work
with developers of languages like Clojure to see what features of
Aparapi might be useful.
Gary
On S
> diagonals as neighbors. We don't think we take advantage of the
> flexibility anywhere in the book, so perhaps your version would indeed
> be better.
It was used again only briefly in section 11.2 to define the legal
moves that a king can make in chess, which of course includes
diagonals. :-)
Hi,
Thanks, I didn't knew this lib.
I played with it a little bit, can't make the latest version (0.7) to work,
only the 0.5.
So far it seems pretty cool. I am not sure yet how to unit test the "clojure
bash scripts" but the repl is much more confortable than the raw bash shell.
And by the way
You can prefer anything you want, but (a) to say that Clojure prefers
loop/recur is nonsense, and (b) you can't make an incorrect algorithm
work just by preferring it. Jeff is correct that your algorithm
requires space for each level of the tree, and so cannot be converted
into a constant-space alg
Hi,
Am 14.09.2011 um 16:54 schrieb octopusgrabbus:
> (defn skl
> [tree]
> (map skl (filter seq? tree)))
>
Is that what you want?
(defn skl
[tree]
(loop [output []
tree (seq tree)]
(if tree
(let [fst (first tree)]
(if (seq? fst)
(recur (conj output
On Wed, Sep 14, 2011 at 2:21 PM, Mark Rathwell wrote:
> The distinction is that you type hint function parameters to tell the
> compiler that this function parameter will always be of the specified
> type. You coerce something that may or may not be of a desired type,
> but is known to cleanly co
The distinction is that you type hint function parameters to tell the
compiler that this function parameter will always be of the specified
type. You coerce something that may or may not be of a desired type,
but is known to cleanly convert to that type.
So:
(defn add-two [^long x]
(+ x 2))
;=
I mean in Clojure 1.3 .
--
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 post.
To unsubscribe from this gr
Yeah it makes sense and is vaguely familiar now. I should have read the
changelog. In our case we have a with-channel macro that expands into a try
that I think could be moved up to a higher level and not be recuring across
a try.
Thanks,
Paul
--
You received this message because you are sub
What is the intended difference between type hinting like "^long" and
type coercing like "(long arg)"?
For example my gut feeling for this case is to use ^long but it is forbidden:
(loop [^long x 0]
...)
"Can't type hint a local with a primitive initializer"
So I use
(loop [x (long 0)]
...)
B
And the supporting ticket in JIRA
http://dev.clojure.org/jira/browse/CLJ-31
On 09/14/2011 12:05 PM, Sean Corfield wrote:
> On Wed, Sep 14, 2011 at 8:45 AM, Paul Stadig wrote:
>> This compiles fine in 1.2.1, but fails in 1.3.0-RC0
> Intentional removal:
>
> https://github.com/clojure/clojure/blob
Jeff:
loop .. recur syntax is Clojure's preferred method of recursion.
This is a routine to return the skeleton of a sequence, not its values.
cmn
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegr
On Sep 13, 2011, at 2:39 AM, jingguo wrote:
> I get a_message printed twice if I paste the code in a clojure REPL.
> But I save the code into a file called foo.clj and use "clj foo.clj"
> to run it. I get nothing in stdout. It seems that (printf "a_message
> \n")
> is not evaluated. Can anybody ex
On Wed, Sep 14, 2011 at 12:51 AM, finbeu wrote:
> Yes, if I understand it correctly, instead of db, I just use the pooled-db
> It would be good to have an example that connects the pooled db stuff with
> the normal db stuff.
Ah, that would make it clearer..
> (defn db-update-or-insert
> "Updat
On Wed, Sep 14, 2011 at 8:45 AM, Paul Stadig wrote:
> This compiles fine in 1.2.1, but fails in 1.3.0-RC0
Intentional removal:
https://github.com/clojure/clojure/blob/master/changes.txt
"1.3 Disallow recur across try"
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.
In general, you can't convert recursion into loops. Recursion has
stack frames, loops don't.
I can't really tell what you are trying to do here because your
example just walks the interior nodes of the expression tree, doing
nothing. Can you clarify with a more complete example?
--
You received
For unsupported behavior it seemed to work pretty well in our code :), but
perhaps it was just a timebomb. In our case it was several layers of macros
obscuring the recur across try.
I guess we'll have to figure out how to rewrite around it, when we get
around to picking up 1.3.
Paul
--
You
It was unsupported behavior in 1.2.1. Now you get error sooner.
David
On Wed, Sep 14, 2011 at 11:45 AM, Paul Stadig wrote:
> This compiles fine in 1.2.1, but fails in 1.3.0-RC0
>
> (defn foo [[bar & baz]]
> (try
> (if (seq baz)
> (if (= bar 99)
> (throw (Exception. "FAIL"))
This compiles fine in 1.2.1, but fails in 1.3.0-RC0
(defn foo [[bar & baz]]
(try
(if (seq baz)
(if (= bar 99)
(throw (Exception. "FAIL"))
(recur baz))
bar)
(catch Exception e
:fail)))
You get a compiler error: java.lang.UnsupportedOperationException: Ca
On Wed, Sep 14, 2011 at 5:58 AM, Leonardo Borges
wrote:
> (defn neighbors
> ([size yx] (neighbors [[-1 0] [1 0] [0 -1] [0 1]] size yx))
> ([deltas size yx]
> (filter (fn [new-yx]
> (every? #(< -1 % size) new-yx))
> (map #(map + yx %) deltas
>
> This syntax made me sc
Ah, got ya. Did not think of that :)
Thanks for the insight!
Cheers,
Leonardo Borges
www.leonardoborges.com
On Wed, Sep 14, 2011 at 11:29 PM, Chouser wrote:
> On Wed, Sep 14, 2011 at 8:58 AM, Leonardo Borges
> wrote:
>> Hi Guys,
>> I'm pretty new to clojure and to the list as well - this bei
Say I have two name spaces, A and B, with A depending on B. I want to test
namespace A, replacing module B with a mock B for testing purposes-
preferably without having to load B at all (B sucks in a bunch of stuff,
like dependencies on databases and external web sites and etc. that I don't
want t
I need help -- ideas, other places or examples to look at, etc -- in
converting this function
(defn skl
[tree]
(map skl (filter seq? tree)))
to loop .. recur syntax.
I've been testing it with
(def test_data1 '(1 (2 3) ( ) (( )) :a))
(def test_data2 '(1 2 (3 4) (5 ( 6 7 8
I'm trying
As far as I know, coming up with a solution for this under consideration.
David
On Wed, Sep 14, 2011 at 8:59 AM, Dave Sann wrote:
> Hi,
>
> I have been using clojure for personal projects for a while now. I am
> starting to work with clojurescript.
>
> I have a number of utilities and libraries
Indeed. Then clojure.core/rand-int should be improved I guess.
> The default case in `case' (what a sentence) is not paired like in
> `cond'. You want something like:
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email
According to http://clojars.org/compojure , the current line for
project.clj is just:
[compojure "0.6.5"]
On Tue, Sep 13, 2011 at 10:41 PM, deltag wrote:
> I have been dropped into a clojure project which was abandoned some time ago
> and now reactivated..So, I am picking up clojure and lein
Hi Nick,
*out* and *err* are already dynamic, which is what allows `binding` to work.
You can the root binding of any Var (even non-dynamic Vars) with `def` or
`alter-var-root`.
-Stuart Sierra
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To po
Hey,
I don't have a comment on how *out* and *err* are implemented, but
here's a solution for your particular problem. Runtime/exec returns a
java.lang.Process [1] object which has getInputStream and
getOutputStream methods corresponding to System/out and System/err of
the spawned process respecti
On Wed, Sep 14, 2011 at 8:58 AM, Leonardo Borges
wrote:
> Hi Guys,
> I'm pretty new to clojure and to the list as well - this being my 1st
> message - so hello everyone :)
> I'm going through the book The Joy of Clojure which, pardon the pun,
> I'm enJOYing a lot and stumbled upon this function to
I have a clojure program with which I would like all stdout and stderr
to be written to a file.
Of course there is Unix IO redirection but I am starting my program
from within another clojure program using "(.exec (Runtime/getRuntime)
clj-program-command env)" and that doesn't support IO redirecti
There are no new JARs being published at build.clojure.org. New releases
(both numbered and -SNAPSHOT) are being published to oss.sonatype.org.
-S
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegr
Hi,
I have been using clojure for personal projects for a while now. I am
starting to work with clojurescript.
I have a number of utilities and libraries that I use in clojure. I can port
much of these wholesale to clojurescript if I copy functions to cljs files.
Generally, my feeling is that
Hi Guys,
I'm pretty new to clojure and to the list as well - this being my 1st
message - so hello everyone :)
I'm going through the book The Joy of Clojure which, pardon the pun,
I'm enJOYing a lot and stumbled upon this function to find neighbors
of a location in a 2D matrix:
(defn neighbors
([
Hi Tim,
back when I started diving into Clojure I had the very same plan, teach
me Emacs to write Clojure.
Somewhere down the road I realized that I can have almost everything,
that I hoped to gain by picking up Emacs, in VIM too. VimClojure and
lein-vimclojure**, once set up, delivered everything
I have been dropped into a clojure project which was abandoned some time ago
and now reactivated..So, I am picking up clojure and lein simultaneously.
In every project.clj file, this compojure reference cannot be resolved. Is
there another reference that is more recent?
[org.clojars.stuarthallo
I write a simple macro and an invocation of the macro. Here is the
code:
(defmacro my-macro
[& body]
`(for [cur-date# ["2011-09-04" "2011-09-05"]]
(do ~@body)
)
)
(my-macro
(printf "a_message\n")
)
I get a_message printed twice if I paste the code in a clojure REPL.
But I save the co
ahh,... I see.
Thank you all - you've been very helpful.
Trevor
On Sep 14, 12:31 am, Stuart Campbell wrote:
> I knew there must be a nicer way to write that :)
>
> On 14 September 2011 16:22, Meikel Brandmeyer (kotarak) wrote:
>
>
>
>
>
>
>
> > Or:
>
> > (swap! user-queues update-in [k] (fnil
What a wonderful Clojure community!
My fund raising campaign to help me attend the Conj is already
half-complete.
For all of those who have already contributed, I'd like to thank you again!
Being part of such a supporting community fills me with joy and makes me
proud.
Please note I've created a
Sergey Didenko writes:
> Is this the intended behavior? Note the present/missing default clause
>
> user> (set! *warn-on-reflection* true)
> user> (case (rand-int 3) 0 :zero 1 :one 2 :two)
> Performance warning, NO_SOURCE_FILE:1 - case has int tests, but tested
> expression is not primitive.
> :t
It was tested with 1.2.1
Jonathan
On Wed, Sep 14, 2011 at 9:09 AM, Sergey Didenko wrote:
> Looks interesting. Did you use it with Clojure 1.3 or earlier?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to c
Is this the intended behavior? Note the present/missing default clause
user> (set! *warn-on-reflection* true)
user> (case (rand-int 3) 0 :zero 1 :one 2 :two)
Performance warning, NO_SOURCE_FILE:1 - case has int tests, but tested
expression is not primitive.
:two
user> (case (rand-int 3) 0 :zero 1
Apparently not: "1.3.0-master-SNAPSHOT/ 20-Dec-2010"
> there used to be http://build.clojure.org/snapshots, but I don't know
> whether it's still cared for.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@
On any platform, calling conventions are fictions enforced at the machine code
level by compilers :)
It's not specific to the JVM.
Luc P.
On Tue, 13 Sep 2011 19:33:54 -0700 (PDT)
Alan Malloy wrote:
> Varargs are a fiction of javac, and do not exist at the bytecode
> level. In real life, this m
Hi,
there used to be http://build.clojure.org/snapshots, but I don't know
whether it's still cared for.
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 f
I see, there is no "clojure-1.3.0-master-SNAPSHOT.jar" in maven and I
should use "1.3.0-RC0"
> I see, my lein - maven thinks that the latest
> clojure-1.3.0-master-SNAPSHOT.jar was built in January.
>
>> current master seems to disagree with you:
>> https://github.com/clojure/clojure/blob/master/
I see, my lein - maven thinks that the latest
clojure-1.3.0-master-SNAPSHOT.jar was built in January.
> current master seems to disagree with you:
> https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4222
--
You received this message because you are subscribed to the Googl
Hi,
current master seems to disagree with you:
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4222
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.c
Hi,
just a few follow-ups...
On Wednesday, September 14, 2011 4:13:47 AM UTC+2, frye wrote:
- ? howto list modes engaged
Aside from the already mentioned C-h m (aka M-x describe-mode) you will want
to use
* C-h k (M-x describe-key) followed by some keybinding to find out what that
keybi
Yes, if I understand it correctly, instead of db, I just use the pooled-db
It would be good to have an example that connects the pooled db stuff with
the normal db stuff.
(defn db-update-or-insert
"Updates or inserts a fruit"
[record]
(sql/with-connection pooled-db
(sql/update-or-inser
I should also mention that we have a cheat sheet too:
http://cloud.github.com/downloads/overtone/overtone/overtone-cheat-sheet.pdf
Thanks to Steve Tayon for such an excellent template.
Sam
---
http://sam.aaron.name
On 13 Sep 2011, at 00:03, Sam Aaron wrote:
> Hey everyone,
>
> I've just push
Despite of what written here: http://dev.clojure.org/display/doc/1.3
there is no two form assert in 1.3.0-master-SNAPHOT
--
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
Looks interesting. Did you use it with Clojure 1.3 or earlier?
--
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
On Wed, Sep 14, 2011 at 12:05 AM, Sergey Didenko
wrote:
> Also bear in mind that due to the functional nature of Clojure you can
> debug a lot of problems using tracing, like clojure.contrib.trace (for
> < 1.3)
Coming soon to 1.3! Luc Prefontaine has volunteered to maintain this
library as clojur
Also bear in mind that due to the functional nature of Clojure you can
debug a lot of problems using tracing, like clojure.contrib.trace (for
< 1.3), C-c C-t in Emacs, or this handy macro:
(defmacro dbg[x] `(let [x# ~x] (println "dbg:" '~x "=" x#) x#))
(func1 (func2 arg1) arg2) -> (dbg (func1 (db
77 matches
Mail list logo