Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add user manual documentation #3

Open
tmccombs opened this issue Apr 26, 2015 · 6 comments
Open

add user manual documentation #3

tmccombs opened this issue Apr 26, 2015 · 6 comments

Comments

@tmccombs
Copy link

This looks like a really interesting library, and I like the interface passing style. However, I can't find any user documentation. The article referenced in the README does a good job of explaining interface passing style, but not how to actually use this library. I would like some documentation and examples of how to actually use lisp-interface-library, and what data structures are available.

@fare
Copy link
Owner

fare commented Apr 27, 2015

Can you give an example example of use? A case where you would like the thing explained? A program where you would like to use one of the data structures? A template for the document?

@tmccombs
Copy link
Author

For example: how would I create an AVL tree with non-numeric keys? Or is there a generic way to iterate over collections? is there an equivalent to cl:map that uses interfaces? etc.

@fare
Copy link
Owner

fare commented Apr 28, 2015

Example:

(asdf:make "lil")
(in-package :interface)
(define-interface <string-map> (<avl-tree>)
  ((key-interface :allocation :class :initform <string> :reader key-interface))
  (:abstract)) ;; must be pure or stateful!
(in-package :pure)
(define-interface <string-map> (<avl-tree> interface:<string-map>)
  ()
  (:singleton))

Another way:

(in-package :pure)
(define-interface <parametric-avl-tree>
  ((key-interface :type <order>
    :reader key-interface :initarg :key-interface)
   (value-interface :type <type>
    :reader value-interface :initarg :value-interface))
 (:parametric (key-interface &optional (value-interface <any>))
    (make-interface :key-interface key-interface :value-interface value-interface)))

(defparameter <string-avl-tree> (parametric-avl-tree interface:<string>))

Presumably, the parametric-avl-tree ought to be predefined in tree.lisp.

To iterate over collections, enjoy the fact that <collection> inherits from <for-each>, and pure:<fount> or stateful:<fount>

@fare
Copy link
Owner

fare commented Apr 28, 2015

If I give you all recipes, can you push a manual?

@fare
Copy link
Owner

fare commented Apr 28, 2015

I pushed support for <string-map>, including tests. Tests in test/ are a good place to look for examples.

@guicho271828
Copy link
Collaborator

Well, to me, at least some browsable catalogue, rather than fully-fledged documentation, is enough to make this library more useful. Imagine there is no http://en.cppreference.com/w/cpp and alike and the only thing we have is the source code of C++ STL, which is definitely terrible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants