Shane (veeman8) wrote in lisp,
Shane
veeman8
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? :\

Thanks.
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

  • 10 comments