Lisp HUG Maillist Archive

Limitin function output length

Is there a way to limit the displayed function output length
when running the output in the command console?
I seem to remember there is. In most other Lisp's I have used
the output length is limited and ... is inserted if the output is very  
long.

I had a function loading a dictionary and returning the data structure.
When I wanted to test it I discovered to my dismay that the return was  
printing the
entire list.. (40 000 or so entries). This is a personal edition and it
ran out of heap and aborted the app. Later when running inspect I hit q:
and lo and behold the same thing happened :)

As you can see this behaviour is quite annoying.

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


Re: Limitin function output length

On 06 Nov 2005, at 23:18, John Thingstad wrote:

> Is there a way to limit the displayed function output length
> when running the output in the command console?
> I seem to remember there is. In most other Lisp's I have used
> the output length is limited and ... is inserted if the output is  
> very long.
>
> I had a function loading a dictionary and returning the data  
> structure.
> When I wanted to test it I discovered to my dismay that the return  
> was printing the
> entire list.. (40 000 or so entries). This is a personal edition  
> and it
> ran out of heap and aborted the app. Later when running inspect I  
> hit q:
> and lo and behold the same thing happened :)
>
> As you can see this behaviour is quite annoying.
>
> -- 
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Do you mean something like this ?

CL-USER 1 > *print-length*
NIL

CL-USER 2 > (setf *print-length* 10)
10

CL-USER 3 > (loop for i below 100 collect i)
(0 1 2 3 4 5 6 7 8 9 ...)

CL-USER 4 > (print *)

(0 1 2 3 4 5 6 7 8 9 ...)
(0 1 2 3 4 5 6 7 8 9 ...)

HTH,

Sven


Re: Limitin function output length

On 9286 day of my life John Thingstad wrote:
> Is there a way to limit the displayed function output length
> when running the output in the command console?

(setf *print-length* some-integer)
(setf *print-level*  some-other-integer)

-- 
Ivan Boldyrev

              "Assembly of Japanese bicycle require great peace of mind."


Updated at: 2020-12-10 08:50 UTC