Lime
Lime

Reputation: 13532

+ Vector Common Lisp

I can seem to figure out why the following command outputs the following

(vector + 1 2)
(vector + 1 2)
=> #((VECTOR + 1 2) 1 2)

Where am I setting +?

Upvotes: 2

Views: 258

Answers (1)

sds
sds

Reputation: 60014

You are not setting it, the REPL sets the following variable after evaluating each form you give it:

  • + - the last form
  • - - the current form
  • / - the last form's values as a list
  • * - the last form's primary value ((car /))

This is somewhat similar to the history facility of most modern Unix shells.

PS. An important aspect of your problem is that Common Lisp is Lisp-2, so the symbol + names both a variable and a function.

Upvotes: 8

Related Questions