Skip to content

Instantly share code, notes, and snippets.

@taras-sereda
Last active March 18, 2017 12:01
Show Gist options
  • Save taras-sereda/9d30fb5e4e8e02860bc697f88e89c927 to your computer and use it in GitHub Desktop.
Save taras-sereda/9d30fb5e4e8e02860bc697f88e89c927 to your computer and use it in GitHub Desktop.
#!/usr/bin/env sbcl --script
(defun atoi_itoa (input_str)
(write-to-string (parse-integer input_str :radix 10) :base 10)
)
(defvar erroneous_data "-$%A123")
(print
(handler-case
(progn
(print (atoi_itoa "-123"))
(print (atoi_itoa "123"))
(print (atoi_itoa "0"))
(print "Test function on erroneous input and handle exception")
(print (atoi_itoa erroneous_data))
) (error ()
(format nil "Cannot process provided input: ~A" erroneous_data))
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment