here is the final version of the implementation.
http://gist.github.com/313558
again, any thought would be great.
Aviad.
On 22 February 2010 22:11, Aviad Reich avi@gmail.com wrote:
I don't mean to signal the end of this thread, but I just wanted to thank
you all for you replies.
I will
I define a function foo in which it calls an auxiliary function bar,
which is not yet defined, and a compiler exception is raised claiming
unable to resolve symbol bar.
Is there a way that I can define the functions in any order I want,
without taking care of defining the auxiliary function
not yet.
But you can just declare the function, before implementing it:
(declare bar)
(defn foo [] (bar hello))
(defn bar [man] (println hello man))
Be aware that if you need to typehint bar, you'll also need to type
hint the bar declaration, so that the compilation of foo can use this
Hi,
On Feb 25, 11:24 am, reynard atsan...@gmail.com wrote:
I define a function foo in which it calls an auxiliary function bar,
which is not yet defined, and a compiler exception is raised claiming
unable to resolve symbol bar.
Is there a way that I can define the functions in any order I
Parallel to proxy, clojure-clr adds a gen-delegate. Example code is
in
http://github.com/richhickey/clojure-clr/blob/master/Clojure/Clojure.Source/clojure/samples/celsius.clj
Specifically, for adding an EventHandler:
(.add_Click button
(gen-delegate EventHandler [sender args]
(let [c
I am getting the following exception while trying to use clojure.zip
user= (use '[clojure.zip :as zip])
java.lang.IllegalStateException: next already refers to:
#'clojure.core/next in namespace: user (NO_SOURCE_FILE:0)
What I am I missing?
--
You received this message because you are
Hi all,
I'm not sure if this is the right place to raise this. I am new to
clojure and was going through the docs for namespaces here:
http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/ns
In the example there it implies that the way to import functions into
your namespace
I'm trying to prn a large data structure to a file so I can later read
it back in, like so -
(defn write-nick-sets [file-name obj]
(binding [*out* (java.io.FileWriter. file-name)]
(prn obj)))
obj here is a map with a string as its key and another map as its
value. The nested map has a
(declare bar)
--
Freedom's just another word for nothing left to lose
--
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
Hi,
I have a small improvement.
The function / called with only argument returns the inverse, so you
can define g-mean and h-mean more shortly:
(defn g-mean [coll]
(expt (reduce * coll) (/ (count coll
(defn h-mean [coll] ;; Michael Kohl's function
(/ (count coll) (reduce + (map /
Hmm... what versions of Clojure (and other libs) are you using?
Sean
On Feb 24, 2:59 pm, Amitava Shee amitava.s...@gmail.com wrote:
I am getting the following exception while trying to use clojure.zip
user= (use '[clojure.zip :as zip])
java.lang.IllegalStateException: next already refers
Hi,
On Feb 24, 10:17 pm, j1n3l0 nelo.ony...@googlemail.com wrote:
(ns foo
(:use some.lib))
This works find for me.
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
Hi,
On Feb 25, 4:17 am, NovusTiro novust...@gmail.com wrote:
I'm trying to prn a large data structure to a file so I can later read
it back in, like so -
(defn write-nick-sets [file-name obj]
(binding [*out* (java.io.FileWriter. file-name)]
(prn obj)))
obj here is a map with a
What Clojure version are you using?
On Feb 24, 4:17 pm, j1n3l0 nelo.ony...@googlemail.com wrote:
Hi all,
I'm not sure if this is the right place to raise this. I am new to
clojure and was going through the docs for namespaces here:
Hi,
On Feb 24, 8:59 pm, Amitava Shee amitava.s...@gmail.com wrote:
I am getting the following exception while trying to use clojure.zip
user= (use '[clojure.zip :as zip])
java.lang.IllegalStateException: next already refers to:
#'clojure.core/next in namespace: user (NO_SOURCE_FILE:0)
Try including [*print-dup* true] in the binding;
(defn write-nick-sets [file-name obj]]
(with-open [w (FileWriter. (File. file-name))]
(binding [*out* w *print-dup* true] (prn obj
You can read it back with;
(defn rec-load
Load a clojure form from file
[#^File file]
(with-open [r
Use require instead of use:
(require '[clojure.zip :as zip])
Tobias
On Wed, Feb 24, 2010 at 8:59 PM, Amitava Shee amitava.s...@gmail.comwrote:
I am getting the following exception while trying to use clojure.zip
user= (use '[clojure.zip :as zip])
java.lang.IllegalStateException: next
thanks!
On 25 February 2010 15:28, fra francesco.str...@gmail.com wrote:
Hi,
I have a small improvement.
The function / called with only argument returns the inverse, so you
can define g-mean and h-mean more shortly:
(defn g-mean [coll]
(expt (reduce * coll) (/ (count coll
(defn
Just a quick announcement for any musical Clojurians out there. I've
pushed midi-clj for simple MIDI communication, and osc-clj for
communicating with new school instruments via Open Sound Control.
Both were developed for project Overtone, but they might be useful for
other projects.
Get them
The name of your library
clodiuno
Library home page URL
http://nakkaya.com/clodiuno.markdown
Your name
Nurullah Akkaya
Category (db, web, UI, parsing etc)
Physical Computing
License
Beerware Revision 42
A one-paragraph description. Include 3rd party dependencies if any.
Clodiuno
Hi all
In new issue of Russian FP journal (http://fprog.ru/) was published an
article about Clojure (http://fprog.ru/2010/issue4/alex-ott-clojure/ -
HTML, and http://fprog.ru/2010/issue4/ - different PDF sizes).
This is introduction-level article, that could be used as basis for
studying
On Thu, Feb 25, 2010 at 4:41 PM, Jeff Rose ros...@gmail.com wrote:
Just a quick announcement for any musical Clojurians out there. I've
pushed midi-clj for simple MIDI communication, and osc-clj for
communicating with new school instruments via Open Sound Control.
Both were developed for
On Feb 25, 12:17 am, joshua-choi rbysam...@gmail.com wrote:
When it comes to distinguishing certain types of symbols from other
things, should one use prefixes or suffixes?
Whichever makes more sense, of course. :)
Example: naming tests with clojure.test/deftest. If you distinguish
your
Hello Joshua,
I don't think there is an official standard in Clojure, at least not
yet. For a source of inspiration, you may be interested in this
thread, in case you haven't found it yourself yet:
http://groups.google.com/group/clojure-dev/browse_thread/thread/d090b5599909497c
Personally, I
Luckily there are already good Java libraries for doing all three of
these: jlayer, jorvis and jflac. We will probably integrate these in
with Overtone eventually, but for now we just use wav files for
samples.
-Jeff
On Feb 25, 8:53 pm, Anders Rune Jensen anders.rune.jen...@gmail.com
wrote:
On
Hi,
I wrote some code, put it in a file, and now want to load that file.
Here is the code I wrote, sqrs.clj:
(use '[clojure.contrib.generic.math-functions :only (sqr)])
(defn square-of-sum [coll]
adds up collection of numbers and then squares it
(sqr (reduce + coll)))
On Feb 25, 2010, at 8:21 PM, Glen Rubin wrote:
whenever I try (load-file sqrs.clj) i get a no source file exception.
Does (load-file sqrs.clj) work?
--Steve
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
Installed vimclojure-2.1.2 on Windows XP SP3. Have dual-core machine
and 4GB of RAM. In VimRepl
(println Hello World) takes about 10 seconds. Is this expected? Any
suggestions how to speed this up?
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To
One of my least favorite things about common lisp was the degree of
nesting it required for sequential variable definitions. For common
code like this:
(let (a vala)
(b valb)
... do something with a b...
(let (c (fn a b))
(d (fn a b))
... do something with a, b, c,
Thank you - this really helped. To Sean's question - I am using 1.1.0
Just to solidify my understanding, can this be done in the default
namespace (of user)?
-Amitava
On Feb 25, 9:50 am, Meikel Brandmeyer m...@kotka.de wrote:
Hi,
On Feb 24, 8:59 pm, Amitava Shee amitava.s...@gmail.com wrote:
Please forgive my mistake. I missed out a set of parentheses in there.
It should be something like this:
(ns foo
(:use (some.lib)))
There are othe scenarios of different use cases:
;; see link for example
http://github.com/technomancy/leiningen/blob/master/src/lancet.clj
(ns foo
(:use
On Thu, 25 Feb 2010 16:28:05 -0800 (PST)
kuniklo milese...@gmail.com wrote:
One of my least favorite things about common lisp was the degree of
nesting it required for sequential variable definitions. For common
code like this:
(let (a vala)
(b valb)
... do something with a
Yeah, I don’t really like the underscores either. But I have to work
with the set of currently allowed non-alphanumeric symbol characters
(*, +, !, -, _, and ?, according to clojure.org/reader).
There’s actually two different questions here—I’d love for other
people to bring in their input.
I
I think using a naming convention isn't a good idea, especially when
you have a rich macro system like Clojure. I'm actually going to be
talking about using a reference to handle things like this in my next
episode. For now, you can take a look at my definference macro here:
Could you explain more what you mean? For instance, how are macros
related to these questions? This just has to do with informal naming
conventions, in the same matter as *e or *print-dup*. Are you talking
about that it’s possible for naming conventions to interfere with
macros that interpret
You can also do stuff in the middle of a let;
(let [a vala
b valb
_ (do-something-with a b)
c (some-fn a b)
d (some-fn a b)
_ (do-something a b c d)
e (fn ...)
f (fn )]
(and-whatever-else))
Here _ is just some arbitrary unused variable.
Note that
Ah, yes, it is a. (The only thing that I anticipate a computer would
use this for is different syntax highlighting. Actually, can any
Clojure editors change symbols’ colors based on if they match a
pattern like *a*?)
Because Daniel Warner and Jarkko Oranen both said they think
underscores are
Ah, case a is simpler, and I retract my macro suggestions.
As to you question about editors, I know that it's possible to adapt
emacs clojure-mode the change colors based on a regex. That's how it
knows to color something pink for a fn in clojure.core, and green
for a fn in the standard library
I notice there have been no checkins to ClojureCLR in the last month
and a half. Is something big in the works? Is absolutely nothing in
the works? :-)
If I check out and build the latest sources, how will it compare in
terms of functionality to the Clojure main branch? In particular,
does it
On Feb 25, 7:50 pm, Adrian Cuthbertson adrian.cuthbert...@gmail.com
wrote:
You can also do stuff in the middle of a let;
(let [a vala
b valb
_ (do-something-with a b)
c (some-fn a b)
d (some-fn a b)
_ (do-something a b c d)
e (fn ...)
f (fn
Hi,
On Feb 25, 4:46 pm, Vitaly Peressada vit...@ufairsoft.com wrote:
Installed vimclojure-2.1.2 on Windows XP SP3. Have dual-core machine
and 4GB of RAM. In VimRepl
(println Hello World) takes about 10 seconds. Is this expected?
No. Vim shells out to another process. This is the only real
Hi,
On Feb 25, 4:19 pm, Amitava Shee amitava.s...@gmail.com wrote:
Just to solidify my understanding, can this be done in the default
namespace (of user)?
Yes. Instead of (ns foo.bar (:require [clojure.zip :as zip])) when
setting up the foo.bar namespace you can just use require in the user
On 26 Feb 2010, at 02:21, Glen Rubin wrote:
Here is the code I wrote, sqrs.clj:
(use '[clojure.contrib.generic.math-functions :only (sqr)])
(defn square-of-sum [coll]
adds up collection of numbers and then squares it
(sqr (reduce + coll)))
A different point: if you can
Hi,
2010/2/25 Meikel Brandmeyer m...@kotka.de
Hi,
On Feb 25, 11:24 am, reynard atsan...@gmail.com wrote:
I define a function foo in which it calls an auxiliary function bar,
which is not yet defined, and a compiler exception is raised claiming
unable to resolve symbol bar.
Is there
44 matches
Mail list logo