Advertisement
Guest User

Untitled

a guest
Jul 4th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. ;;; eio.el --- Support for creating Elisp exercises
  2.  
  3. ;; Author: Jason Lewis
  4. ;; Created: 5 June 2015
  5.  
  6. ;; This file is not part of GNU Emacs.
  7.  
  8. ;;; Commentary:
  9. ;;
  10. ;; Provides utility functions for stubbing elisp exercises
  11.  
  12. ;;; Code:
  13.  
  14. (defun stub-exercise (exercise)
  15. "Create the stub for EXERCISE."
  16. (let ((human-name (lisp-to-human exercise)))
  17. (concat ";;; " exercise ".el --- " human-name "Exercise (exercism)\n"
  18. "\n"
  19. ";;; Commentary:\n"
  20. "\n"
  21. ";;; Code:\n"
  22. "\n"
  23. "\n"
  24. "(provide '" exercise ")\n"
  25. ";;; " exercise ".el ends here")))
  26.  
  27. (defun stub-test (exercise)
  28. "Stubs the test for EXERCISE."
  29. (let ((human-name (lisp-to-human exercise)))
  30. (concat ";;; " exercise "-test.el --- " human-name "Test (exercism)\n"
  31. "\n"
  32. ";;; Commentary:\n"
  33. "\n"
  34. ";;; Code:\n"
  35. "(load-file \"" exercise ".el\")\n"
  36. "\n"
  37. "\n"
  38. "\n"
  39. "(provide '" exercise "-test)\n"
  40. ";;; " exercise ".el ends here")))
  41.  
  42.  
  43. (defun lisp-to-human (title)
  44. "Takes a kebab-case TITLE and humanizes it. E.g., hello-world -> Hello World."
  45. (mapconcat 'identity
  46. (mapcar #'capitalize
  47. (split-string title "-")) " "))
  48.  
  49. (provide 'eio)
  50. ;;; eio.el ends here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement