Advertisement
Guest User

Untitled

a guest
Jul 13th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 1.31 KB | None | 0 0
  1. (defmacro _ns (section_name &rest body)
  2.   "These namespaces do nothing but help me organise my code. It does not break definition locations."
  3.   ;; Here I should create a list by the name of each defun.
  4.  
  5.   ;; (tv (type section_name))
  6.   ;; (tv section_name)
  7.  
  8.   (defvar (str2sym (concat "_ns/" (sym2str section_name))) (mapcar
  9.                                                             (lambda (item)
  10.                                                               (if (eq 'defun (car item))
  11.                                                                   (car (cdr item))))
  12.                                                             body))
  13.  
  14.   `(progn ,@body))
  15.  
  16.  
  17. (_ns my-lists
  18.      (defun list-string-predicates ()
  19.        "List predicates that accept a string.")
  20.  
  21.      (defun list-symbol-predicates ()
  22.        "list predicates that accept a symbol."
  23.        )
  24.  
  25.      (defun list-number-predicates ()
  26.        "List predicates that accept a number."
  27.        )
  28.  
  29.      (defun apply-string-predicate ()
  30.        "This should convert the parameter to a string and then test it."
  31.        )
  32.  
  33.      (defun apply-symbol-predicate ()
  34.        "This should convert the parameter to a symbol and then test it.")
  35.  
  36.      (defun apply-number-predicate ()
  37.        "This should convert the parameter to a number and then test it."))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement