Clojure Functional Assignments

Context

Suppose I have the ICursor, IFoo, IBar protocols, then I can have a function named:

(defn IFoo->IBar [foo] ... )

Now suppose I have a function that takes two arguments

x: ICursor
y: IFoo

and output an object of type IBar.

Now, is there a standard way to indicate this in a function name? For example, none of the following works:

(defn ICursor,IFoo->IBar [x y] ...)

because "," is considered as space

(defn (ICursor, IFoo)->IBar [x y] ... )

because () is considered as a function application.

(defn [ICursor, IFoo]->IBar [x y] ... )

because [] is considered as a vector.

Question

Is there a standard way to encode protocol types in a function name?

Thank!

+3
source share
1 answer

, , . , clojure .

- : (defn ICursor->IFoo->IBar [x y] ...), , ICursor IFoo IBar, - , , , , , :), , .

+5

All Articles