Merge branch 'master' into wip-manual-2
authorNeil Jerram <neil@ossau.uklinux.net>
Sat, 10 Apr 2010 12:32:42 +0000 (13:32 +0100)
committerNeil Jerram <neil@ossau.uklinux.net>
Sat, 10 Apr 2010 12:32:42 +0000 (13:32 +0100)
Conflicts:

doc/ref/api-procedures.texi
doc/ref/misc-modules.texi

(Caused by me removing `@page' from a couple of sections that have been modified
by others.)

16 files changed:
1  2 
doc/ref/Makefile.am
doc/ref/api-compound.texi
doc/ref/api-control.texi
doc/ref/api-data.texi
doc/ref/api-debug.texi
doc/ref/api-evaluation.texi
doc/ref/api-i18n.texi
doc/ref/api-io.texi
doc/ref/api-modules.texi
doc/ref/api-options.texi
doc/ref/api-procedures.texi
doc/ref/guile.texi
doc/ref/intro.texi
doc/ref/libguile-concepts.texi
doc/ref/misc-modules.texi
doc/ref/srfi-modules.texi

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -4,8 -4,9 +4,8 @@@
  @c   Free Software Foundation, Inc.
  @c See the file guile.texi for copying conditions.
  
- @node Procedures and Macros
- @section Procedures and Macros
 -@page
+ @node Procedures
+ @section Procedures
  
  @menu
  * Lambda::                      Basic procedure creation using lambda.
Simple merge
Simple merge
Simple merge
@@@ -59,6 -60,68 +59,67 @@@ Print within the given @var{columns}.  
  @end deffn
  
  
 -@page
+ @cindex truncated printing
+ Also exported by the @code{(ice-9 pretty-print)} module is
+ @code{truncated-print}, a procedure to print Scheme datums, truncating
+ the output to a certain number of characters. This is useful when you
+ need to present an arbitrary datum to the user, but you only have one
+ line in which to do so.
+ @lisp
+ (define exp '(a b #(c d e) f . g))
+ (truncated-print exp #:width 10) (newline)
+ @print{} (a b . #)
+ (truncated-print exp #:width 15) (newline)
+ @print{} (a b # f . g)
+ (truncated-print exp #:width 18) (newline)
+ @print{} (a b #(c ...) . #)
+ (truncated-print exp #:width 20) (newline)
+ @print{} (a b #(c d e) f . g)
+ (truncated-print "The quick brown fox" #:width 20) (newline)
+ @print{} "The quick brown..."
+ (truncated-print (current-module) #:width 20) (newline)
+ @print{} #<directory (gui...>
+ @end lisp
+ @code{truncated-print} will not output a trailing newline. If an expression does
+ not fit in the given width, it will be truncated -- possibly
+ ellipsized@footnote{On Unicode-capable ports, the ellipsis is represented by
+ character `HORIZONTAL ELLIPSIS' (U+2026), otherwise it is represented by three
+ dots.}, or in the worst case, displayed as @nicode{#}.
+ @deffn {Scheme Procedure} truncated-print obj [port] [keyword-options]
+ Print @var{obj}, truncating the output, if necessary, to make it fit
+ into @var{width} characters. By default, @var{x} will be printed using
+ @code{write}, though that behavior can be overriden via the
+ @var{display?} keyword argument.
+ The default behaviour is to print depth-first, meaning that the entire
+ remaining width will be available to each sub-expressoin of @var{x} --
+ e.g., if @var{x} is a vector, each member of @var{x}. One can attempt to
+ ``ration'' the available width, trying to allocate it equally to each
+ sub-expression, via the @var{breadth-first?} keyword argument.
+ The further @var{keyword-options} are keywords and parameters as
+ follows,
+ @table @asis
+ @item @nicode{#:display?} @var{flag}
+ If @var{flag} is true then print using @code{display}.  The default is
+ @code{#f} which means use @code{write} style.  (@pxref{Writing})
+ @item @nicode{#:width} @var{columns}
+ Print within the given @var{columns}.  The default is 79.
+ @item @nicode{#:breadth-first?} @var{flag}
+ If @var{flag} is true, then allocate the available width breadth-first
+ among elements of a compound data structure (list, vector, pair,
+ etc.). The default is @code{#f} which means that any element is
+ allowed to consume all of the available width.
+ @end table
+ @end deffn
  @node Formatted Output
  @section Formatted Output
  @cindex formatted output
Simple merge