0

Let's say I have a protocol like this:

(defprotocol X
  (y [this z]))

How do I write documentation targeted only for function y?

The normal way for doing this would be:

(defn y
  "Some documentation"
  [])

But if I do:

(defprotocol X
  (y
    "Some documentation" 
    [this z]))

I get the following exception:

java.lang.IllegalArgumentException: Parameter declaration missing

So how do I add this kind of documentation?

2 Answers 2

4

You can find examples of a protocol on clojuredocs :

(defprotocol Fly
  "A simple protocol for flying"
  (fly [this] "Method to fly"))

Alternatively bang your REPL or look at the source :

;method signatures

(bar [this a b] \"bar docs\")
(baz [this a] [this a b] [this a b c] \"baz docs\"))
Sign up to request clarification or add additional context in comments.

Comments

3
(defprotocol X
  (y [this z] "Some documentation"))

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.