lilawood
lilawood

Reputation: 373

Predicates Common Lisp

Do you know where can I get the source of a predicate in Common Lisp? (The content of the predicate, if you prefer.) For example, source code of setq, string= etc.

Thanks !

Upvotes: 9

Views: 1006

Answers (3)

Elias Mårtenson
Elias Mårtenson

Reputation: 3885

For at least SBCL, SLIME can look up the definitions by pressing "M-.", however you need to have compiled SBCL from source for this to work, as the path to the source definitions are embedded in the binary, and if you use a binary distribution you are probably not going to have the source files in the same location.

Upvotes: 1

Terje Norderhaug
Terje Norderhaug

Reputation: 3689

Common Lisp development environments typically provide a way to look up definitions in the file with the source code.

Alternatively, FUNCTION-LAMBDA-EXPRESSION might be able to recover the source of a predicate and other functions, if the Lisp environment has been configured to save the definitions.

You can also search in the lisp files of open source lisp implementations. For example, in Clozure CL setq is defined in the compiler/nx1.lisp file of the distribution. A tip is to place a space in the front of the search word to bypass matches like (setq.

Upvotes: 4

mtraven
mtraven

Reputation: 179

SETQ is not a predicate. It is not even a function, which is why you couldn't find it through the IDE. STRING= is a predicate and a function, so works better.

Do you mean "primitive?" for "predicate"?

Upvotes: 0

Related Questions