mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
102 lines
3.2 KiB
Plaintext
102 lines
3.2 KiB
Plaintext
NAME
|
|
null - null value
|
|
|
|
SYNOPSIS
|
|
null([v_1, v_2,...])
|
|
|
|
TYPES
|
|
v_1, v_2,... any
|
|
return null
|
|
|
|
DESCRIPTION
|
|
After evaluating in order any arguments it may have, null(...)
|
|
returns the null value. This is a particular value, different from
|
|
all other types; it is the only value v for which isnull(v) returns
|
|
TRUE. The null value tests as FALSE in conditions, and normally
|
|
delivers no output in print statements, except that when a list or
|
|
matrix is printed, null elements are printed as "NULL".
|
|
|
|
A few builtin functions may return the null value, e.g.
|
|
printf(...) returns the null value; if L = list(), then both
|
|
pop(L) and remove(L) return the null value; when successful,
|
|
file-handling functions like fclose(fs), fflush(fs), fputs(fs, ...)
|
|
return the null value when successful (when they fail they return an
|
|
error-value). User-defined functions where execution ends
|
|
without a "return" statement or with "return ;" return the null
|
|
value.
|
|
|
|
Missing expressions in argument lists are assigned the null value.
|
|
For example, after
|
|
define f(a,b,c) = ...
|
|
calling
|
|
f(1,2)
|
|
is as if c == null(). Similarly, f(1,,2) is as if b == null().
|
|
(Note that this does not occur in initialization lists; missing
|
|
expressions there indicate no change.)
|
|
|
|
The null value may be used as an argument in some operations, e.g.
|
|
if v == null(), then for any x, x + v returns x.
|
|
|
|
When calc is used interactively, a function that returns the null value
|
|
causes no printed output and does not change the "oldvalue". Thus,
|
|
null(config("mode", "frac")) may be used to change the output mode
|
|
without printing the current mode or changing the stored oldvalue.
|
|
|
|
EXAMPLE
|
|
; L = list(-1,0,1,2);
|
|
; while (!isnull(x = pop(L)) print x,; print
|
|
-1 0 1 2
|
|
|
|
; printf("%d %d %d\n", 2, , 3);
|
|
2 3
|
|
|
|
; L = list(,1,,2,)
|
|
; print L
|
|
|
|
list (5 elements, 5 nonzero):
|
|
[[0]] = NULL
|
|
[[1]] = 1
|
|
[[2]] = NULL
|
|
[[3]] = 2
|
|
[[4]] = NULL
|
|
|
|
; a = 27
|
|
; null(pi = pi(1e-1000))
|
|
; .
|
|
27
|
|
|
|
LIMITS
|
|
The number of arguments is not to exceed 1024.
|
|
|
|
LINK LIBRARY
|
|
none
|
|
|
|
SEE ALSO
|
|
isnull, test
|
|
|
|
## Copyright (C) 1999-2006 Landon Curt Noll
|
|
##
|
|
## Calc is open software; you can redistribute it and/or modify it under
|
|
## the terms of the version 2.1 of the GNU Lesser General Public License
|
|
## as published by the Free Software Foundation.
|
|
##
|
|
## Calc is distributed in the hope that it will be useful, but WITHOUT
|
|
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
|
## Public License for more details.
|
|
##
|
|
## A copy of version 2.1 of the GNU Lesser General Public License is
|
|
## distributed with calc under the filename COPYING-LGPL. You should have
|
|
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
|
##
|
|
## @(#) $Revision: 29.4 $
|
|
## @(#) $Id: null,v 29.4 2006/06/22 23:49:22 chongo Exp $
|
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/null,v $
|
|
##
|
|
## Under source code control: 1996/03/12 23:10:01
|
|
## File existed as early as: 1996
|
|
##
|
|
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
|
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|