newLISPtm v.9.0.0 Release Notes Otober 15th, 2006

64-bit integer arithmetic

All integer calculations using the integer operators +,-,*,/ and bit operations using >>,<<,~,^ are now performed using 64-bit integers. File positioning on files opened with open are now full 64 bit. Functions like dotimes, for, sequence and factor can now operate on a wider range of integers.

Better support for array data type

The functions append, first, last, rest, slice previously only working on lists now can also work on arrays. The matrix operations multiply, invert and transpose now also work on arrays.

Distributed computing

The newLISP server mode started with newlisp -c -d <port> or the UNIX utilities inetd and xinetd and newlisp -c now can answer simple HTTP GET and PUT requests. The functions read-file, write-file, append-file, load and save now have a HTTP mode where a URL can be given for a file name. This way these functions can be used to access files on remote server nodes in a distributed computing environment.



New or changed functionality

Description

version

newlisp -c,
newlisp -c -d <port>

Command line modes with the -c option now understand simple HTTP GET and PUT requests. This means that get-url and put-url can be used on newLISP server nodes started with these command line options.

8.9.1

load,
save

Now can load and save newLISP code and data from and to remote newLISP or other httpd servers specifying URLs in the file specification. Not yet available for Win32 server nodes.

8.9.1

find-all

finds all regex-patterns in a string and returns a list of matching strings:

(find-all {\d+} "asdf2kjh44hgfhgf890") => ("2" "44" "890")
(find-all {(new)(lisp)} "newLISPisNEWLISP" (append $2 $1) 1) => ("LISPnew" "LISPNEW")

8.9.2

format

Parameters after the format string can now also be given as a list:

(format "%d %s" '(123 "hello")) <same as> (format "%d %s" 123 "hello")


define,
define-macro

Function and macro definitions can now take defaults for parameters:

(define (foo (a 1) (b 2)) (list a b))
(foo) => (1 2)
(foo 3) => (3 2)
(foo 3 4) => (3 4)

8.9.3

newlisp -C

The new mode with -C (capital C) forces the command line prompt in Editors like Emacs which communicate to other LISPs via pipes.

8.9.4

starts-with,
ends-with

These functions now can take regular expressions when specifying an options number. The old nil option for case insensitivity is translated into the regex option 1 for compatibility with older code. The nil option will be eliminated in the future.

(starts-with "this is useful" "this|that" 1) => true

8.9.4

<<, >>

(<< num) works like (<< num 1) and (>> num) works like (>> num 1)

8.9.4

div

(div num) works like (div 1 num)

8.9.4

uuid

Type 1 and type 4 Universal Unique ID as of RFC 4122 specification can now be created

8.9.6

+,-,/,*,<<,>>,~
import, pack

All arithmetic and bit operations on integers are now 64-bit.
import and pack still take 32-bit integers by taking only the 32 least significant bits and 32-bit entities are returned from imported functions. To pack 64-but numbers use:

(pack "ldld" int64 (>> int64 32)) ; for little endian CPU architectures
(pack "ldld" (>> int64 32) int64) ; for big endian architectures


In float->integer conversions floats out of range oveflow to 64-bit min/max integers:

-9223372036854775808, 9223372036854775807 and 18446744073709551615 for unsigned

8.9.7

format

The format function has new 64-bit formats, these are different on UNIX, Win32 and Tru64:

"%lld", "%llu" "%llx" ; on UNIX
"%I64d", "%I64u", "%I64x" ; on Windows

Using 32-bit format strings on 640-bit numbers will truncate numbers on UINIX and Win32 to 32 bit.

Tru63 uses the same format specifies as used for 32-bit integers.

Format now recognizes the scientific e and E floating point format options.

8.9.7

LFS

Large file system support (LFS) has been extended to 64 bits (before 48 bits).

8.9.7

(for
(<var> <from> <to> <step>)...)

Has floating point type in <var> only if <step> is specified, else <var> is integer. Formerly <var> was always floating point type.

8.9.7

(sequence <from> <to> <step>)

Produces floating point numbers only when <step> is specified, else generates integer type numbers, before always floats.

8.9.7

(dotimes (i N)...)

Always produces integers in i, before floats.

8.9.7

net-close

When using with optional true parameter (net-close sock true) shutdown() functionality is suppressed before the socket close. Without the extra parameter net-close always will shutdown without waiting for pending transmissions.

8.9.7

gcd

New function for greatest common divisor of a group of numbers: (gcd x y ...)

8.9.7

pow

(pow x) now defaults to (pow x 2)

8.9.7

read-file,
append-file,
write-file

Now can take URLs for the file specifications. Internally they use the functions get-url and put-url to access files via remote newLISP server nodes or other remote httpd servers. Not yet available on Win32 newLISP server nodes.

8.9.8

net-eval

Now also evaluates node parameters inside the node list. Before, constants where required for host name, port and command string to evaluate.

A new additional syntax for just one remote node: (net-eval host port cmd)

8.9.8

share

On UNIX a shared memory address obtained with share can now be unmapped using:

(share nil <address>)

8.9.8

invert,
multiply,
transpose

Matrix operations now can be performed on the array data type.

8.9.9

det

The new function det returns the determinant of a matrix.

8.9.9

append,
first,
last,
rest,
slice

These list operations and their implicit indexing forms now also can be performed on arrays.

8.9.10

local

Works like let but initializes parameters to nil: (local (x y z) ...)

8.9.13

swap

This function has an additional syntax to swap the contents of two variables/symbols.

8.9.14

...”

Additionally to specifying characters in a quoted string with a decimal code, a hex code can be used, i.e.: “AB+” equivalent to decimal “\065\066\043” equivalent to hex “\x41\x42\x2b”.

8.9.15

ref-all

Works similar to ref but returns a list of index vectors for all references of an expression

(ref-all 'a '(a b c (d a f (a h a)) (k a (m n a) (x))))
=> ((0) (3 1) (3 3 0) (3 3 2) (4 1) (4 2 2))

8.9.15

Added Files and Other Changes



newlispdoc

This newLISP documentation utility parses specially commented newLISP source files to generate autmatically HTML formatted documentation.


Code Patterns in newLISP

This is the renamed "Design Patterns in newLIS"P document reworked for version 9.0 and with an additional chapter for distributed computing.


Bug Fixes



rand

In list mode returned one element too much.

8.9.1

zero?

Was broken for floats with fractional parts

8.9.1

read-key

Did not work on SUSE Linux

8.9.2

set-nth,
nth-set

Using these functions an empty lists could corrupt the empty list.

8.9.5

replace-assoc

when replacing the first element in an association list with replace-assoc and an error occurred when evaluating the replacement expression, a segfault occurred.

8.9.7

timer

(timer even 0) did not stop the timer on Win32

8.9.10

join

On wrong data type (list of strings required) would go in infinite loop, now gives error message.

8.9.15


The versions newLISP 8.9.1 to newLISP 8.8.14 where released as development versions.

Critical Changes, which may break compatibility to previous releases.

Most users have reported very little problems when moving from 32-bit to 64-bit arithmetic in newLISP. Most code will run without any changes necessary. In any case the following points should be reviewed in existing code:

All operations involving integer arithmetic should be reviewed as they have changed from 32-but t0 64-but precision. The data type in loop variables in dotimes and for and the data type of numbers generated in sequence have changed. In all casesi, only when a step size is specified, the data type is float, else 64-bit integers are generated. These changes are consistent with inc and dec, which always behaved this way.

When float to integer conversion takes place, as required by some functions, then the oveflow values are now 64-bit integers instead of 32-bit integers, this may cause different results in some cases.

The functions starts-with and ends-with, when used with the nil option, will now take take the nil as option number 1 for case insensitivity. This also means, that key strings are interpreted as regular expressions patterns rather than raw strings, when using the old nil option. The old nil option should be replaced with the option number 1 and key strings should be reviewed for characters interpreted different in regex patterns.


§