Displaying a string while using cond in Lisp -
i'm starting off lisp , need help. technically homework, gave try , getting wanted:
(defun speed (kmp)     (cond ((> kmp 100) "fast")             ((< kmp  40) "slow")          (t           "average")))   however, if run program displays "average" instead of average (without quotes).
how can display string without quotes?
you can use symbols instead of strings:
(defun speed (kmp)     (cond ((> kmp 100) 'fast)             ((< kmp  40) 'slow)          (t           'average)))   symbols uppercased default, internally fast fast.
you can write symbol in case , characters using escaping vertical bars:
|the speeed fast!|   above valid symbol in common lisp , stored internally write case preserved.
Comments
Post a Comment