Ambiguous error message with lazy sequence.

2013-08-06 Thread Qiu Xiafei
I have a test.clj file like the following:

$ cat test.clj
(defn some-lazy-seq [n]
  (lazy-cat
 (concat n;; should be [n] here
 (some-lazy-seq (inc n)
(println (take 100 (some-lazy-seq 0)))

It's obviously wrong on line 3, the concat function shoud take a seq as
first argments.

But when i run this file, the error is reported on line 5, where the
function is invocated, but not on where it's ocurred. It's really hard to
locate the bug espacially in big project.

Any suggestions to avoid this kind of error message or better solutioins?

thanks!

-- 
-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Ambiguous error message with lazy sequence.

2013-08-06 Thread jiujiu xiang


在 2013年8月6日星期二UTC+8下午8时31分19秒,Qiu Xiafei写道:

 I have a test.clj file like the following:

 $ cat test.clj 
 (defn some-lazy-seq [n]
   (lazy-cat
  (concat n;; should be [n] here
  (some-lazy-seq (inc n)
 (println (take 100 (some-lazy-seq 0)))

 It's obviously wrong on line 3, the concat function shoud take a seq as 
 first argments.

 But when i run this file, the error is reported on line 5, where the 
 function is invocated, but not on where it's ocurred. It's really hard to 
 locate the bug espacially in big project.

 Any suggestions to avoid this kind of error message or better solutioins?

 thanks!


-- 
-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.