XLISP princ

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference

# princ

Type: | - | function (subr)
Source: | - | xlfio.c, xlprin.c

## Syntax

(princ expr [dest])
  expr - an expression
  dest - an optional destination, must be a file pointer or stream, default is *standard-output*
  returns - the expression

## Description

The 'princ' function prints the 'expr' to the specified 'destination'. The 'expr' is printed without a 'newline' character. If 'expr' is a string, it will not be printed with quotes around the string. The 'expr' is returned as the result. The 'destination' may be a file pointer or a stream. If there is no 'destination', *standard-output* is the default. The terpri function is used to terminate the print lines produced.

## Examples

    (princ 'a)                              ; prints A     without #\Newline
    (princ '(a b))                          ; prints (A B) without #\Newline
    (princ 99)                              ; prints 99    without #\Newline
    (princ "hi")                            ; prints hi    without #\Newline

    (setq f (open "f" :direction :output))  ; create file
    (princ "hi" f)                          ; returns "hi"
    (princ 727 f)                           ; returns 727
    (princ "ho" f)                          ; returns "ho"
    (close f)                               ; file contains hi727ho

Common Lisp: Common Lisp specifies that 'pprint' with a 'destination' of NIL will go to *standard-output*. XLISP does not send the output to *standard-output* with a 'destination' of NIL. Common Lisp also specifies that a 'destination' of T will be sent to *terminal-io*, which is not defined in XLISP by default. XLISP does not allow T as a valid argument for 'destination'.

See the princ function in the XLISP 2.0 manual.

Back to Top

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference