On Sun, Apr 10, 2016 at 1:29 PM, Joan Martin <joanmar1...@gmail.com> wrote: > Hello, > I try to write a programme (a game), where I use lots of mutable lists (named > environment).Something like this: > (define environment > (mcons (mcons (mcons 1 (mcons (mcons 2(mcons 5(mcons 8 '())))'() )) > (mcons (mcons 2 (mcons (mcons 1(mcons 3(mcons 10 '()))) '() )) > ...... > '() )) > It should represent a 2D dekadedron. > And for easy manipulation I wrote a procedure: select-room and set-symbol. > > (define select-room (lambda (number rooms) > (let loop ((l (mcar rooms))) > (if (not (null? l)) > (if (= (mcar(mcar l)) number) > (mcar l) > (loop (mcdr l)) )))))
In Racket this doesn't even compile. So I assume you must be using some other programming language. Anyway, what does this function return when (null? l) ? If you had used Racket, it would have shown you immediately where's the problem. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.