Justin Meiners
Justin Meiners

Reputation: 11113

declaring constraint/polymorphic types in Common Lisp

In Haskell (and chicken scheme) you can declare constrained types, for example map :: (a -> b) -> [a] -> [b] declares that map will take a list containing the type of the function input, and return a list containing the function output. Is the same possible in common lisp function declarations? Could I do something analogous like this:

(declaim (ftype (function (function (a) b)
                          (list a))
                (list b)
                map))

"you can't do that" would be a satisfactory answer :)

Upvotes: 1

Views: 215

Answers (1)

Svante
Svante

Reputation: 51501

Not in a single type declaration. We don't have type variables.

Upvotes: 2

Related Questions