Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

[ELITISM]

Name: Anonymous 2010-05-21 12:58

Post something only your language can do. My contribution: I double dare you to do that in your language. Probably takes a fucking parser! javadocs don't count cuz its crap.

(defun print-package-documentation (package)
  "Lists package external symbols and prints
   their documentation"
  (let ((doc-types '(compiler-macro function method-combination
             setf structure type variable))
    undocumented)
    (do-external-symbols (s package)
      (let ((docstrings (remove-if-not #'identity
                       (mapcar (lambda (doc-type)
                         (documentation s doc-type))
                           doc-types))))
    (if docstrings
        (format t "~A: ~%~{  ~A~%~}" s docstrings)
        (push s undocumented))))
    (when undocumented
      (format t "The following symbols are undocumented:~%~{~A~^, ~}~%"
          undocumented))))


E.g.:

m1cr0p3n1z> (print-package-documentation :cffi)
FOREIGN-STRING-ALLOC:
  Allocate a foreign string containing Lisp string STRING.
The string must be freed with FOREIGN-STRING-FREE.
FOREIGN-SLOT-POINTER:
  Return the address of SLOT-NAME in the structure at PTR.
MAKE-SHAREABLE-BYTE-VECTOR:
  Create a Lisp vector of SIZE bytes can passed to
WITH-POINTER-TO-VECTOR-DATA.

...

The following symbols are undocumented:
LISP-STRING-TO-FOREIGN, FREE-TRANSLATED-OBJECT, CALLBACK, INCF-POINTER, EXPAND-TO-FOREIGN, FREE-CONVERTED-OBJECT, TRANSLATE-FROM-FOREIGN, CONVERT-TO-FOREIGN, WITH-FOREIGN-OBJECTS, EXPAND-FROM-FOREIGN, FOREIGN-POINTER, LOAD-FOREIGN-LIBRARY-ERROR, GET-CALLBACK, FOREIGN-SYMBOL-POINTER, DEFCALLBACK, DEFINE-FOREIGN-TYPE, EXPAND-TO-FOREIGN-DYN, USE-FOREIGN-LIBRARY, CONVERT-FROM-FOREIGN, FOREIGN-FUNCALL-POINTER, TRANSLATE-TO-FOREIGN
NIL

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List