Advertisement
Guest User

Untitled

a guest
Mar 15th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. (defgeneric foobar (arg0 arg1))
  2.  
  3. (defmethod foobar (arg0 arg1)
  4. (format t "0~%"))
  5.  
  6. (defmethod foobar (arg0 (arg1 string))
  7. (format t "1~%"))
  8.  
  9. (defmethod foobar ((arg0 number) (arg1 string))
  10. (format t "2~%"))
  11.  
  12. (defmethod foobar ((arg0 string) (arg1 number))
  13. (format t "3~%"))
  14.  
  15. CL-USER> (foobar 0 0)
  16. 0
  17. NIL
  18. CL-USER> (foobar :thing "hi")
  19. 1
  20. NIL
  21. CL-USER> (foobar 0 "hi")
  22. 2
  23. NIL
  24. CL-USER> (foobar "hi" 12)
  25. 3
  26. NIL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement