The simplest translation is to wrap a lazy-seq around the last line to
avoid the stack overflows.

On Sat, Jul 24, 2010 at 8:41 AM, nickikt <nick...@gmail.com> wrote:
> (defn scheme-remove-first [syb lst]
>  (if (empty? lst)
>    '()
>    (if (= (first lst) syb)
>      (rest lst)
>      (cons (first lst) (scheme-remove-first syb (rest lst))))))

becomes

(defn scheme-remove-first [syb lst]
 (if (empty? lst)
   '()
   (if (= (first lst) syb)
     (rest lst)
     (lazy-seq (cons (first lst) (scheme-remove-first syb (rest lst)))))))


Also, you can omit the ' in front of the () if you like.

-- 
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

Reply via email to