Shane (veeman8) wrote in lisp,

COND system with Define.

Hey LISPers. I'm using Scheme. Please don't kill me.

I have a question that I can't seem to answer. Here's the code:

(define final '())

(cond (
(< frst scnd)
(define final (cons final frst))
(define final (cons final scnd))


This is what it's supposed to mean:
First, final is defined to null.
We have a condition statement. It states....

If first is less than second, define final by concatenating the variable first to the end of final
then, define final by concatenating the variable second to the end of final.

Of course, it gives me the following error:

define: not allowed in an expression context in: (define final (cons final first))

Any idea why, and how to fix it? :\

  • Post a new comment


    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.