I want to work with default values. For this I use:
[& nr]
This gives the value null to nr. So far so good.
But I want to propagate the value, because I want to fill the default at a
higher level.
I have:
(defn test-lucky-numbers-all
"Test all lucky number performance"
[& nr]
(printf "all: %s\n\n" nr)
(time
(do (test-lucky-numbers-first nr)
and:
(defn test-lucky-numbers-first
"Performance test of lucky numbers (first)"
[& nr]
(printf "first: %s\n\n" nr)
When I do:
(test-lucky-numbers-all)
The first prints:
all: null
but the second prints:
first: (nil)
And when I do:
(test-lucky-numbers-all 1)
The first prints:
all: (1)
and the second prints:
first: ((1))
What is happening here and what can I do about it?
I could write a general function to translate the nil, but I was wondering
if there is a better option.
--
Cecil Westerhof
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.