version of racket i use does not allow me to use internal definitions using 
(R5RS) language 

like this for example
(define (read-command)
  (set! com '( '() ))
  (set! wl (read-as-list))
  (define ret1 (list->string wl))
  (commRead)
  ret1
 )

says not allowed in rxpression context: (define ret1 (list->string wl))

what can i do as a replacement?


similar situation here:

(define repl
 (lambda()
 (display "\nUofL>")
 (define inp (read-command))
 (define lengtha (length com))
      (cond
        ((equal? inp "CLEAR")(set! lista '())(repl))
        ((equal? inp "REV")(set! lista (cdr lista))(set! lista (rev 
lista))(repl))
        ((equal? inp "STACK")(set! lista (cdr lista))(display lista)(repl))
        ((equal? inp "SWAP")(set! lista (cdr lista))(set! lista (append (list 
(cadr lista)) (list (car lista)) (cddr lista)))(repl))
        ((equal? (car lista) "EXIT") (display "Bye.")(set! lista (cdr lista)))
        ((equal? inp "DROP")(set! lista (cddr lista))(repl))
        ((equal? (car lista) "POP")
         (set! lista (cdr lista))
         (cond
           ((null? lista)(display "Empty Stack")(repl))
           ((string->number (car lista))(set! pop (car lista))(set! lista (cdr 
lista))(repl) )
           ((search (car lista) sym symval)
            (cond
              ((null? (cdr lista)) (set! lista (cdr lista))
              (display "Empty Stack") (repl))
              (else
               (addsym (car lista) (cadr lista))
               (set! pop (cadr lista))
               (set! lista (cddr lista))
               (repl))))
           
           (else 
            (set! lista (cdr lista))
            (display "Var not declared")(repl))))
       
        ((equal? inp "SAVE")
         (set! lista (cdr lista))
         (cond
           ((equal? pop "")(display "Can't SAVE null"))
           (else  (set! lista (append (list pop) lista))(set! pop "")))
         (repl))
        ((equal? inp "DUP")(set! lista (cdr lista))(set! lista (append (list 
(car lista)) lista))(repl))
        ((equal? (op? (car lista)) ".")(set! lista (cdr lista))
        (cond
          ((equal? lengtha 1)(if (null? lista) (display "Empty Stack") (display 
(car lista)))(repl))
          (else (displayn (- lengtha 1))(repl))))
        ((string->number (car lista))
         (cond
           ((null? (cdr lista))(repl))
           ((op? (cadr lista))(repl))
           (else (set! lista (cleanup-eval lista))(repl))))
        ((equal? (car lista) "define")
         (set! lista (cdr lista))
         (set! sym (append (list (car lista)) sym))
         (set! lista (cdr lista))
         (cond
           ((string->number (car lista))
            (set! symval (append (list (string->number (car lista))) symval)))
           (else
            (set! symval (append (list (car lista)) symval))))
            
           
         (set! lista (cdr lista))
         (repl) )
        (else
         (cond
           ((search (car lista) sym symval)(set! lista (append (list (cadr 
res)) (cdr lista)))
           (if (number? (car lista)) (set! lista (append (list(number->string 
(car lista)))))))
           (else
            (display (car lista))(set! lista (cdr lista))))))
            (repl))))
         

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

Reply via email to