On 2/24/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>  (define nth (lambda (n xs) (if (= n 0)(head xs)(nth (- n 1) (tail xs)))))

>  nth n (x:xs) = if n == 0 then x else nth (n-1) xs

I'm guessing it's some kind of lisp variant?

(define nth (lambda (n xs) (cond ((consp xs) (if (= n 0) (head xs)
(nth (- n 1) (tail xs)))) (t nil)))

-- 
Taral <[EMAIL PROTECTED]>
"Please let me know if there's any further trouble I can give you."
    -- Unknown
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to