0

I would like to know whether or not it's possible to disable return values for specified functions. I am using compiler SBCL. I am asking this, because it takes a while to print the return value, and I don't even need it. Any ideas?

OK, it does the job:

(progn
  (...)
  t)

Also, thanks for *print-length*.

Pea Ce
  • 1
  • 1
  • 2
    possible duplicate of [How can I avoid the nil printed in the end?](http://stackoverflow.com/questions/17429729/how-can-i-avoid-the-nil-printed-in-the-end) – Rainer Joswig Jul 05 '13 at 17:37

2 Answers2

3

I find it useful to limit the amount of data printed to my reply by setting the *print-length* variable to a relatively low value in my lisp startup file, like so:

(setf *print-length* 20)

That way, I do not have to worry too much about functions that return a large number of elements.

hans23
  • 1,034
  • 7
  • 13
1

Using the function values it is possible to return zero (or several) values from a function. values returns all it's arguments. Thus a function having (values) as it's last form will not return anything, while a function ending with (values val1 val2 val3) will return three values. When calling a function returning several values, only the first one (the primary return value) is available in the normal way, while the other ones may be captured using e.g. multiple-value-bind See the section on Return Values in the Hyperspec for further details

If you want to limit the output from a function that you can not modify, you can call it like this:

(progn
   (function-returning-much-data)
   (values))
Terje D.
  • 6,250
  • 1
  • 22
  • 30