In the documentation for 'explode', ...
; omit last chunk if too short
(explode '(a b c d e f g h) 2 true) → ((a b) (c d) (e f))
should be:
; omit last chunk if too short
(explode '(a b c d e f g) 2 true) → ((a b) (c d) (e f))
In newlisp_index.html,
plese add "explode" to "List processing, flow control and integer arithmetic".
And,
pretty-print
(pretty-print 90 "t") → (90 "t")
(pretty-print 90 "t") → (90 "t" "%1.10g")
(pretty-print 100) → (100 "t")
(pretty-print 100) → (100 "t" "%1.10g")
The first example reports the default settings of 80 for the maximum line length and a TAB character for indenting.
The first example reports the default settings of 80 for the maximum line length and a space character for indenting.
The second example changes the line length to 90 and the indent to a TAB character.
Isn't the second example necessary ?
print
xhh where hh is a hexadecimal ASCII code between 00 and FF
Unless undocumented, I hope to add this or a more appropriate representation.
pv
The future value num-pmt is assumed to be 0.0 if omitted. If payment is at the end of the period,
The future value num-fv is assumed to be 0.0 if omitted. If payment is at the end of the period,
read-expr
read-expr parses the first expressions it finds in str-source and an returns the translated expression without evaluating it.
read-expr parses the first expressions it finds in str-source and returns the translated expression without evaluating it.
Maybe.
read-utf8
The fucntion returns and integer value which can be converted to a displayable UTF-8 character string using the char function.
The fucntion returns integer value which can be converted to a displayable UTF-8 character string using the char function.
Maybe.
ref
By default, ref checks if expressions are equal. With func-compare, more complex comparison functions can be defined.
The comparison function can be a previously defined function.
Note that the comparison function always takes two arguments,
even if only the second argument is used
inside the function.
From ref-all.
Aren't these necessary ?
ref-all
(as in the example using long?).
(as in the example using is-long?).
send
This way the non-blocking message function can be made blocking until it succeeds:
This way, the non-blocking message function can be made blocking until it succeeds:
Maybe.
After sending the three messages the statement:
After sending the three messages, the statement:
Maybe.
(set 'finished true))
(set 'finished true)
set-ref-all
When evaluating (foo data), the list in db:db will be passed by reference and <tt>set-ref-all</tt> will make the changes on the original, not on a copy of db:db.
When evaluating (foo db), the list in db:db will be passed by reference and <tt>set-ref-all</tt> will make the changes on the original, not on a copy of db:db.
sgn
nil is returned.
If exp-2 is not specified, nil is returned with zero and,
if exp-3 is not specified, nil is returned with positive number.
Or more appropriate representations.
share
the return value will be any constant or expression (since v.10.1.0)
written into the memory previously.
The return value will be any constant or expression (since v.10.1.0)
written into the memory previously.
Maybe.
spawn
The example also shows how code written for the Cilk API will work under Win32, too, with spawn simply working as a set and sync just returning an empty list.
The example also shows how code written for the Cilk API will work under Win32, too, with spawn simply working as a set and sync just returning an empty list or true.
Maybe.
sys-info
Eight integers report the following status:
Ten integers report the following status:
Maybe unless eight means 8-bits integer.
timer
Option 3 is a combination of both called profiling time.
Option 2 is a combination of both called profiling time.
This can be used to program timelines or schedules.
This can be used to program time lines or schedules.
or
This can be used to program timeliness or schedules.
Maybe.
true?
Since version 9.1, true? behaves like if and rejects the empty list ()
Since version 9.1, true? behaves like if and rejects the empty list ().
until
Evaluates the condition in exp-condition body.
Evaluates the condition in exp-condition.
write-char
(while (set 'chr (read-file in-file))
(while (set 'chr (read-char in-file))
xml-parse
As the database in example.xml only contains data, we can suppress whitespace and comments with option (+ 1 3):
As the database in example.xml only contains data, we can suppress whitespace and comments with option (+ 1 4):
or
As the database in example.xml only contains data, we can suppress whitespace, empty attribute and comments with option (+ 1 2 4):
Using xml-type-tags to suppress all XML-type tags-along with the option numbers 1, 4, 8, and 16-SXML formatted output can be generated:
Using xml-type-tags to suppress all XML-type tags-along with the option numbers 1, 2, 4, 8, and 16-SXML formatted output can be generated:
(xml-parse (read-file "example.xml") (+ 1 2 8) MAIN xml-callback)
(set 'example-xml (read-file "example.xml"))
(xml-parse example-xml (+ 1 2 8) MAIN xml-callback)
Maybe, or new xml-callback.
Some in the above-writing may be unnecessary.
By the way,
I finished a Japanese translation of the "4.Functions in alphabetical order" of the "Function Reference", but v.10.1.7.
It is possible to download it from the following URL.
http://cid-23a9a25e1aec3626.skydrive.live.com/self.aspx/%E5%85%AC%E9%96%8B/newlisp%5E_manual-10107.zip
Next, I will try to translate the current version.
1. Syntax of symbol variables and numbers
Symbols for variable names
Numbers
As described above, scientific notation starts with a floating point number
As described below, scientific notation starts with a floating point number
Maybe.
Thank you very much Johu, an updated revision 5 is online here:
http://www.newlisp.org/downloads/newlisp_manual.html
ps: I also have linked your blog from this page: http://www.newlisp.org/index.cgi?Code_Contributions and hope I got the title right?
Thank you very much, Lutz.
My blog title is OK, but a link is the following:
//http://johu02.spaces.live.com/?_c11_BlogPart_BlogPart=blogview&_c=BlogPart&partqs=cat%3dLISP
This is the part of lisp in my blog.
Quote from: "Lutz"
Thank you very much Johu, an updated revision 5 is online here:
http://www.newlisp.org/downloads/newlisp_manual.html
The xhtml parsing routine (per the post below) now fails...
http://newlispfanclub.alh.net/forum/viewtopic.php?p=17931#p17931
==========
newLISP REPL - (Read Execute Print Loop). Press Ctrl-Z to exit.
newLISP v.10.2.1 on Win32 IPv4, execute 'newlisp -h' for more info.
> (xml-type-tags nil nil nil nil)
(nil nil nil nil)
> (ref-all '(h1 *) (xml-parse (read-file "./newlisp_manual.html") 15) match true)
ERR: list expected : nil
>
-- xytroxon
(xml-error)
;-> ("closing tag doesn't match" 572782)
I think the current version no longer "validates"... But it could be anything... :(
repaired now:
http://www.newlisp.org/downloads/newlisp_manual.html
On Mac OS X, to find these things, use:
tidy -utf8 -xml newlisp_manual.html > /dev/null
After three hours, I think I narrowed it down to two sections...
> needs to be changed to >
An evaluated context (no quote) can be given as an argument:
> (context 'FOO)
FOO
FOO> (context MAIN)
MAIN
> (set 'old FOO)
FOO
> (context 'BAR)
BAR
BAR> (context MAIN:old)
FOO
FOO>
And -> needs to be changed to ->
Running above example produces the following output:
pid:53181->47 pid:53180->61 pid:53179->75 pid:53178->39 pid:53177->3
pid:53181->59 pid:53180->12 pid:53179->20 pid:53178->77 pid:53177->47
pid:53181->6 pid:53180->56 pid:53179->96 pid:53178->78 pid:53177->18
-- xytroxon
The manual entry for "sync" should not precede "sym". It should follow the entry for "symbols".
John
In newlisp_index.html
Floating point math and special functions
<a href="newlisp_manual.html#gammaln" target="body">atan</a>
<a href="newlisp_manual.html#gammaln" target="body">gammaln</a>
There are not array, array-list, uuid.
Array functions
There is not slice.
Input/output and file operations
There is not current-line.
Reflection and customization
There is not last-error
System functions
There is not catch.
newLISP internals API
There is not read-expr.
I compared newlisp_index.html with "Functions in groups" in newlisp_manual.htm
And,
"Functions in groups" in newlisp_manual.htm
Floating point math and special functions
There is not tan.
Pattern matching
There are not ref, ref-all.
System functions
There are not callback, read-expr, sym.
Thanks Johnd and Johu, a new version rev-9 is online:
http://www.newlisp.org/downloads/manual_frame.html
3. Functions in groups
List processing, flow control and integer arithmetic
There are not if-not and pop-assoc.
do-until
repeats evaluation of an expression until the condition is met
repeats evaluation of a block of statements until the condition is met
do-while
repeats evaluation of an expression while the condition is true
repeats evaluation of a block of statements while the condition is true
self
Acccesses the target object inside a FOOP method
Accesses the target object inside a FOOP method
unless
evaluates an expression conditionally
evaluates a block of statements conditionally
while
repeats evaluation of an expression while the condition is true
repeats evaluation of a block of statements while the condition is true
String and conversion functions
There are not dostring and find-all in newlisp_index.html.
member
finds a list or string member
finds a member of a list or string
(from List processing, flow control and integer arithmetic)
name
returns the name of a symbol or its context as a string
This function is deprecated, use term instead
Or delete?
Pattern matching
<a name="pattern"></a>
<h3>Pattern matching</h3>
<table border="0" cellpadding="1" width="95%" align="center" summary="Time and date functions">
<table border="0" cellpadding="1" width="95%" align="center" summary="Pattern matching">
Input/output and file operations
read-utf8
reads UTF-8 character from a file
reads an UTF-8 character from a file
Maybe.
Reflection
term
returns the term part of a symbol or its context as a string
returns the term part of a symbol without the context prefix as a string
4. Functions in alphabetical order
--
Without the optional argument in num-2,
Without the optional argument in num,
<<, >>
When int-1 is the only argument << and >> shift by one bit.
When int-1 is the only argument, << and >> shift by one bit.
Maybe.
I have one question.
4. Functions in alphabetical order
+, -, *, / ,%
Quote
For floating point values that evaluate to NaN (Not a Number), both +INF and -INF are treated as 0 (zero).
I think that this sentence means the following:
> (sqrt -1)
nan
> (+ (sqrt -1))
0
> (mul 1e308 10)
inf
> (+ (mul 1e308 10))
9223372036854775807
> (mul -1e308 10)
-inf
> (+ (mul -1e308 10))
9223372036854775807
Is it right ?
Yes, this is how NaN and +/- Inf and mixing with integer arithmetic should behave. The rules are outlined in this file:
http://www.newlisp.org/syntax.cgi?code/qa-float.lsp.txt
also in the source distribution at newlisp-x.x.x/qa-specific-test/qa-float
... but I see negative Inf is not treated correctly on Win32 but fine on UNIX and not tested in qa-float.
ps: this is fixed for Win32 in v.10.2.4
I have some suggestion.
+, -, *, / ,%
For floating point values that evaluate to <tt>NaN</tt> (Not a Number),
both <tt>+INF</tt> and <tt>-INF</tt> are treated as <tt>0</tt> (zero).
Floating point values that evaluate to NaN is treated as <tt>0</tt> (zero),
and both <tt>+INF</tt> and <tt>-INF</tt> are treated as the maximum (<tt>9,223,372,036,854,775,807</tt>) integer values.
Because the misunderstanding may be carused.
case
The result of the last match is returned as the result for the entire case expression.
The result of the last expression in body is returned as the result for the entire case expression.
I think that "the last match" may cause a misunderstanding.
char
The empty string or a binary zero character return nil, but (char 0) will return " 00".
The empty string return nil, but (char nil) will return " 00".
Because (char " 00") return 0 (zero).
Given an integer argument, char returns a string containing the ASCII character with value int.
Given an integer argument, char returns a string containing either the ASCII character with value int or the character escaped with a (backslash) for a three-digit ASCII number.
It might be unnecessary.
Thanks Johu.
Note, that the integer conversion of -Inf will return the max negative integer starting 10.2.4 on Win32. On other OS, this was already the case.
There will be a new development release (source only) this weekend v.10.2.4.
clean
(with the list option).
(with the list mode).
from difference.
intersect
In the second syntax,
In the second syntax, intersect works in list mode.
from difference.
difine-macro
A third possibility is to refer to passed parameters using args:
A second possibility is to refer to passed parameters using args:
maybe.
<a href="#dolust">dolist</a> as a break condition
<a href="#dolist">dolist</a> as a break condition
delete
This mode can be used to delete namespace hashes and in object systems,
This mode can be used to delete namespace hashes in object systems,
maybe.
and bug ?
newLISP v.10.2.1 on Win32 IPv4, execute 'newlisp -h' for more info.
> (set 'lst '(a b aVar c d))
(a b aVar c d)
> (delete 'aVar true)
true
> lst
(a b nil c d)
>
also Linux-version.
det
If the matrix is singular and float-pivot is not specified nil is returned.
If the matrix is singular and float-pivot is not specified, nil is returned.
maybe.
device
int is an I/O device number,
int-handle is an I/O device number,
Thanks Johu, I will take care of this in the next development release.
ps: as of now back on US Eastern Time.
constant !
(constant sym-1 exp-1 [sym-2 exp-2 ... ]) => (constant sym-1 [exp1 [sym-2 [exp-2 ... ]]])
because (constant 'x), (constant 'x 1 'y), ... are allowed ...
---
find
Find an expression in a list
If the first argument is a string, a regular expression option can be specified with int-regex-option and optionally an int-offset parameter.
If the first argument is a string, a regular expression option can be specified with int-regex-option parameter.
Because,
Quote
syntax: (find exp-key list [func-compare | int-regex-option])
first
In the second syntax,
In the third syntax,
Maybe.
format
The w represents the width field. Data is right-aligned, except when preceded by a minus sign, in which case it is left-aligned. When preceded by a zero, the unused space is filled with leading zeroes. The width field is optional and serves all data types.
The p represents the precision number of decimals (floating point only) or strings and is separated from the width field by a period. Precision is optional. If preceded by a + (plus sign), positive numbers are displayed with a +. When using the precision field on strings, the number of characters displayed is limited to the number in p.
The w represents the width field. Data is right-aligned, except when preceded by a minus sign, in which case it is left-aligned. If preceded by a + (plus sign), positive numbers are displayed with a +. When preceded by a zero, the unused space is filled with leading zeroes. The width field is optional and serves all data types.
The p represents the precision number of decimals (floating point only) or strings and is separated from the width field by a period. Precision is optional. When using the precision field on strings, the number of characters displayed is limited to the number in p.
inf?
See also A to check is a floating point number is valid.
See also A to check if a floating point number is valid.
let
See also letn for an incremental or nested form of let.
See also letn for an incremental or nested form of let and local for initializing to nil.
Maybe, better ?
letex
This functions combines let and expand to expand local variables into an expression before evaluating it.
This function combines let and expand to expand local variables into an expression before evaluating it.
But, I saw sometimes "This functions" in other web sites.
This writing may be used commonly ?
map
Arguments missing in other argument lists cause an error message.
Arguments missing in other argument lists are assumed nil or the empty list ().
Becasue,
newLISP v.10.2.1 on Win32 IPv4, execute 'newlisp -h' for more info.
> (map (fn (x y z) (list $idx x y z)) '(a b c) '(1 2) '(A B C D E))
((0 a 1 A) (1 b 2 B) (2 c nil nil))
> (map list '(a b c) '(1 2) '(A B C D E))
((a 1 A) (b 2 B) (c))
>
Thanks Johu.
Last time, I made a mistake in inf?.
inf?
See also NaN? to check is a floating point number is valid.
See also NaN? to check if a floating point number is valid.
And, this time.
now
Am optional list-index in int-index makes now return a specific member in the result list.
An optional list-index in int-index makes now return a specific member in the result list.
The resolution of the microsecond field
depends on the operating system and platform. On some platforms,
the last three digits of the <tt>microseconds</tt> field are always
<tt>0</tt> (zero).
The resolution of the <tt>microsecond</tt> field
depends on the operating system and platform. On some platforms,
the last three digits of the <tt>microsecond</tt> field are always
<tt>0</tt> (zero).
parse-date
The function parse-date returns the number of seconds passed since January 1, 1900.
The function parse-date returns the number of seconds passed since January 1, 1970 from December 14, 1901 until January 19, 2038.
Because,
newLISP v.10.2.1 on Linux IPv4 UTF-8, execute 'newlisp -h' for more info.
> (parse-date "2007.1.3" "%Y.%m.%d")
1167782400
> (parse-date "January 10, 07" "%B %d, %y")
1168387200
> (parse-date "1970.1.1" "%Y.%m.%d")
0
> (parse-date "1900.1.1" "%Y.%m.%d")
2085892096
> (parse-date "1901.12.13" "%Y.%m.%d")
2147408896
> (parse-date "1901.12.14" "%Y.%m.%d")
-2147472000
> (parse-date "2038.1.19" "%Y.%m.%d")
2147472000
> (parse-date "2038.1.20" "%Y.%m.%d")
-2147408896
>
Probably,
the function parse-date returns a signed 32-bit long number,
But the function date-value returns an unsigned 32-bit long number.
So, it can be used until February 6, 2106.
Quote
> (date-value 2106 2 6)
4294944000
> (date-value 2106 2 7)
63104
>
Thanks Johu, changes are online in rev-15:
http://www.newlisp.org/downloads/newlisp_manual.html
In the manual;
Quote
member
syntax: (member exp list)
syntax: (member str str-key [num-option])
Shouldn't this be:
Quote
syntax: (member str-key str [num-option])
Because the format is actually;
(member "f" "a b c d e f")
Where "f" is the key to search for and "a b c d e f" is the string.
Or, does str-key mean something different in this case?
Thanks Kanen, the correction is online in rev. 16 of the manual:
http://www.newlisp.org/downloads/newlisp_manual.html
Contents
User Manual
...
15. Contexts
* Symbol creation in contexts
* Creating contexts -> anchor not found
Change <a href="#scope_context">
To <a href="#creating_contexts">
=====================
Spelling:
acccesses - accesses
addtionally - additionally
comforms - conforms
datatype - data type
insteead - instead
notaion - notation
obkject - object
parameteri -parameter
parsig - parsing
pont - point
-- xytroxon
Thanks Xytroxon, changes are onlinein rev. 17
http://www.newlisp.org/downloads/newlisp_manual.html
write
If int-size is not specified, all data in sym-buffer or str-buffer is written.
If int-size is not specified, all data in str-buffer is written.
or
syntax: (write int-file str-buffer|sym-buffer [int-size])
syntax: (write str str-buffer|sym-buffer [int-size])
write-line
When the string argument is omitted write-line writes the contents of the last read-line to int-file
When the string argument is omitted write-line writes the contents of the last read-line to int-file.
Predefined variables and functions.
Two of them are used as namespace templates, one two write platform independent code.
Two of them are used as namespace templates, one to write platform independent code.
See the chapter Hash functions and dictionaries foe details.
See the chapter Hash functions and dictionaries for details.
By the way,
I finished to translate the section of Function Reference in newLISP User Manual into Japanese.
//http://cid-23a9a25e1aec3626.skydrive.live.com/self.aspx/.Public/newlisp%5E_manual-10201.zip
This version is v.10.2.1 rev 17.
Thank you very much Johu! You have done a great work with this, and the Japanese translation will help, to make newLISP more popular in Japan.
I would like to put the bilingual Japanese version of the function reference (without the "Users Manual") on the documentation section on newlisp.org. How would you translate the title "newLISP Function Reference" into Japanese?
ps: the corrections will go online later today.
Spelling (again ;p)
Acccesses - Accesses
Addtionally - Additionally
Insteead - Instead
I have posted these words (several times) before (in lowercase), we must of had a case sensitively mismatch ;p)
----------
For each function definition you have: <h2><span class="function">
There are two more places:
<div class="license">
<a name="GNUFDL"></a>
<center>
<h2><span class="function">GNU Free Documentation License</span></h2>
-------------------
<a name="GNUGPL"></a>
<center>
<h2><span class="function">GNU GENERAL PUBLIC LICENSE</span></h2>
--------------
Could you change these to:
<h2><span class="any name besides function">GNU...
(Or a shorter, smarter name ;P)
This change would be helpful in parsing the xhtml to be able to extract all "functions" without including what should be "license" sections...
-- xytroxon
Thanks Xytroxon, new versions online here for 10.2.1:
http://www.newlisp.org/downloads/newlisp_manual.html
and here for 10.2.6:
http://www.newlisp.org/downloads/development/newlisp_manual.html
Thanks Lutz.
I think that "newLISP Function Reference" is "newLISP 関数リファレンス" in Japanese.
I thought that the title may be acceptable in English.
Actually, my translation didn't translate the title (i.e. <h1>, <h2> or <h3> tags) or some description of tables.
If necessary, I will translate these.
And I updated the Japanese translation into rev 18.
//http://cid-23a9a25e1aec3626.skydrive.live.com/self.aspx/.Public/newlisp%5E_manual-10201.zip
Thanks Johu.
newLISP 関数リファレンス (Japanese translation of the Function Reference) is now online here:
http://www.newlisp.org/newlisp_reference-10201-jp.html
and also referenced from the documentation page:
http://www.newlisp.org/index.cgi?Documentation
Thank you very much, Lutz.
And I updated the Japanese translation into rev 19 with some correcting.
//http://cid-23a9a25e1aec3626.skydrive.live.com/self.aspx/.Public/newlisp%5E_manual-10201.zip
Thanks Johu, updated here:
http://www.newlisp.org/newlisp_reference-10201-jp.html
Code Patterms
17. Semaphores, shared memory
Allthough controlling processes
should be
Although controlling processes
-- xytroxon