In the book "Programming Clojure" (p2_0, pdf, page 185) "Adding
Validation to Refs" there is this code:
(def validate-message-list (partial every? #(and (:sender %) (:text
%
This works fine as a validator, but when I try the code directly - not
as a validator - it returns false. I also tested
idate-message-list
(partial every? #(and (:sender %) (:text %
(def messages (ref [] :validator validate-message-list))
(defn add-message [msg]
(dosync (alter messages conj msg)))
(add-message (struct message "mm" "first message"))
On Jun 23, 12:58 pm, Stuart Hall
So the validation takes place after "alter messages conj msg" in the
add-message function?
On Jun 24, 4:48 pm, Meikel Brandmeyer wrote:
> Hi,
>
> alter calls conj on [] (which is kept as a vector) since it is the
> initial content of the messages ref. So the content of messages is a
> seqab
I really like Clojure, but as a complete n00b on Lisp languages, it is
frustrating that I many times have to hunt high and low for
documentation on basic stuff.
Recently I saw a code snippet that showed that reduce takes an
optional initial value, something I didn't know. When I see something
new,
? Because we're lazy.
On Jun 29, 2:17 pm, Meikel Brandmeyer wrote:
> Hi,
>
> On Jun 29, 11:55 am, michele wrote:
>
> > Well, to my surprise and frustration, I haven't found any place which
> > documents that reduce takes an optional initial value.
>
Mother's invention is a lazy necessity, I think.
On Jun 29, 9:46 pm, Meikel Brandmeyer wrote:
> Hi,
>
> Am 29.06.2010 um 19:11 schrieb michele:
>
> > Meikel, idiots are nice people too, so don't feel bad. But seriously,
> > why do you think we work this har
ORIGINAL
(defn update-positions [snake apple]
(dosync
(if (eats? @snake @apple)
(do (ref-set apple (create-apple))
(alter snake move :grow))
(alter snake move)))
nil)
WITHOUT do
(defn update-positions [snake apple]
(dosync
(if (eats? @snake @apple)
((ref-se
Wouldn't that make it easier to keep track of them.
Example:
(defn myfn-a [a b]
(if (zero? b)
a
(recur
(afn (bfn (...)) a)
(dec b
(defn myfn-b [a b]
(if (zero? b)
a
(recur
(afn (bfn (...)) a)
(dec b)
)
)
)
--
You received this message becau
Thanks everyone for the your answers (and the internal debates). I
will not put closing parenthesis on new lines. Even though the editor
helps me with the parenthesis, there have been situations - while
editing inside functions - that I had to count them. Here is an idea
(by Harold A.), I will try:
Being the one who asked the question and satisfied with the answers, I
agree. I never expected a question like this, about one of the oldest
programming languages, to generate so many responses and discussions.
Funny...
On Aug 29, 9:46 pm, lprefonta...@softaddicts.ca wrote:
> My rough estimate
It's not really the Emacs tools that are a problem, but the huge
amount of web pages trying - with good intentions - to help you
installing the Emacs-Clojure stack, but usually lacking some important
detail. It feels like playing a jig-saw puzzle without being able to
look at the picture on the box
I have tried to find a solution to this problem, but to no avail.
According to https://github.com/technomancy/swank-clojure:
USAGE
The simplest way is to just jack-in from an existing project using
Leiningen:
Install clojure-mode either from Marmalade or from git.
lein plugin install swank-clojur
Have you tried this one?
https://github.com/technomancy/swank-clojure
On May 22, 10:53 am, dokondr wrote:
> Hello,
> I am trying to install Clojure tools on Mac OS X according to the
> instructions:
> "Clojure, Swank, and Leiningen with Emacs on
> Linux"http://riddell.us/ClojureSwankLeininge
And this one
https://github.com/technomancy/leiningen/
On May 22, 10:53 am, dokondr wrote:
> Hello,
> I am trying to install Clojure tools on Mac OS X according to the
> instructions:
> "Clojure, Swank, and Leiningen with Emacs on
> Linux"http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.
ATH")))
>
>
>
>
>
>
>
>
>
> On Sun, May 22, 2011 at 2:17 PM, michele wrote:
> > I have tried to find a solution to this problem, but to no avail.
>
> > According tohttps://github.com/technomancy/swank-clojure:
>
> > USAGE
> > The simples
Well, there are intelligent beings with the ability to make decisions
entering the traffic junction, not exactly the same as with the STM.
On Oct 16, 11:07 am, Sam Aaron wrote:
> This might be slightly off the wall, but I recently watched a tiny
> documentary about an experimental congestion
better
metaphor.
On 17 Okt, 15:07, Sam Aaron wrote:
> On 17 Oct 2010, at 8.54 am, michele wrote:
>
>
>
> > Well, there are intelligent beings with the ability to make decisions
> > entering the traffic junction, not exactly the same as with the STM.
>
> Of course, a
he sense
that I do not know of any other macro system working in the same way.
Michele Simionato
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to
On Jun 26, 9:53 am, Michele Simionato
wrote:
> I want to asset the status of Clojure
> macros with respect to hygiene.
Some further experiment:
$ clj
Clojure 1.1.0-alpha-SNAPSHOT
user=> (def x 42)
#'user/x
user=> (defmacro m[] 'x)
#'user/m
user=> (m)
42
user=>
On Jun 26, 3:51 pm, Rich Hickey wrote:
> By using quote, and not syntax-quote, you have written an
> intentionally capturing macro
Acc, I missed that. I have read the documentation of syntax-quote now:
""
For Symbols, syntax-quote resolves the symbol in the current context,
yielding a fully-qu
On Aug 14, 2:47 am, Chas Emerick wrote:
> On Aug 13, 2009, at 8:29 PM, Scott wrote:
>
> > A single "super quoted" string reader would avoid this problem.
> > Instead of defining a new read syntax like:
>
> > #my-syntax(your DSL goes between here and here)
>
> > Clojure could provide a general pu
21 matches
Mail list logo