What is wrong in this program:
(setq x (read))
(define y x)
(if (eql y 1) (write "1"))
(else (write "2"))
?
(setq x (read))
(define y x)
(if (eql y 1) (write "1"))
(else (write "2"))
?
Discuss and learn Lisp programming of all dialects
This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.
3 posts · 1154 views
(let*((x (read)) (y x)) ;LET for local variables, LET* is the variant where the order matters. (y is pretty pointless)
(if (eql y 1) (write "1") ;Note that print is more usually used for stuff like this.
(write "2")))Note that (read) tries to read from T, it needs user input!