Racket: Conditional Statements Not Matching String Equality in ToDo-List Programm

43 Views Asked by At

Problem Description:

I'm working on a simple to-do list in Racket to better familiarize myself with the language, but I'm running into an issue where the conditional statements don't match string equality correctly.

Code:

(define (todo)
  (define lst (call-with-input-file "todo.txt"
                (lambda (des)
                  (read des))))
  (display "Choose between these options:\nShow List,\nAdd ToDo,\nRemove ToDo,\nClear List\n")
  (define action (string-downcase (string-trim (read-line))))
  (cond
    [(eq? action "show list") (display lst)]))

Expected Behavior:

I expect the program to output lst when action matches the string show list.

Actual Behavior:

The program consistently outputs nothing even when action matches show list.

Thank you!

0

There are 0 best solutions below