This stumped a few of us on #clojure, with a debate as to whether this is a
compiler error or has a legitimate explanation.
My initial examination:
https://www.refheap.com/96295
A more minimal example:
https://www.refheap.com/96296
What's going on?
Andrew
--
You received this message
The difference is how rest args are handled. From the recur documentation:
In particular, if the recursion point was the top of a variadic fn method,
there is no gathering of rest args - a single seq (or null) should be
passed.
So your two calls are not the same. f1 calls (recur x some-seq)
Hi,
I don't fully understand how to make real use of varargs and
destructuring. c.c.sql/create-table is defined as follows:
(create-table name specs)
Called as follows:
(c.c.sql/create-table
:tblname
[:cola :text NOT NULL PRIMARY KEY]
[:colb :number NOT NULL]
[:colc :blob NOT NULL)]
I
Hi mike,
Your problem is about to calling a function with a list of arguments,
which is independent of varargs. Take a look at the apply function.
It does what you're looking for.
Cheers
-Patrick
On Sep 14, 2:47 am, Michael Ossareh ossa...@gmail.com wrote:
Hi,
I don't fully understand how to
First, you could use destructuring to make your map function cleaner.
The following is exactly identical to your definition. It declares
that it will be passed one argument; because that argument is [...],
it will be a seq; it asks that the seq be split into y, the first
element, and z, a seq of
Alan and Patrick, thank you so much! I've come across apply in JS and
it really should have clicked for me!
So I have the following, and it works very well:
(defn make-tables
[connection schema]
(sql/with-connection connection
(doseq [[name specs] schema]
(try
Great. Looks shiny and idiomatic to me.
On Sep 14, 12:06 pm, Michael Ossareh ossa...@gmail.com wrote:
Alan and Patrick, thank you so much! I've come across apply in JS and
it really should have clicked for me!
So I have the following, and it works very well:
(defn make-tables
[connection
Hi,
Am 14.09.2010 um 23:01 schrieb Alan:
(defn make-tables
[connection schema]
(sql/with-connection connection
(doseq [[name specs] schema]
(try
(apply sql/create-table name specs)
(catch Exception e
(prn e))
You actually don't