Manual Notes 10.2.1

Started by Sammo, March 29, 2010, 09:57:27 AM

Previous topic - Next topic

Sammo

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))

johu

#1
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">http://cid-23a9a25e1aec3626.skydrive.li ... -10107.zip">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.

johu

#2
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.

Lutz

#3
Thank you very much Johu, an updated revision 5 is online here:



http://www.newlisp.org/downloads/newlisp_manual.html">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">http://www.newlisp.org/index.cgi?Code_Contributions and hope I got the title right?

johu

#4
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">//http://johu02.spaces.live.com/?_c11_BlogPart_BlogPart=blogview&_c=BlogPart&partqs=cat%3dLISP





This is the part of lisp in my blog.

xytroxon

#5
Quote from: "Lutz"Thank you very much Johu, an updated revision 5 is online here:



http://www.newlisp.org/downloads/newlisp_manual.html">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">http://newlispfanclub.alh.net/forum/vie ... 931#p17931">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
\"Many computers can print only capital letters, so we shall not use lowercase letters.\"

-- Let\'s Talk Lisp (c) 1976

cormullion

#6
(xml-error)
;-> ("closing tag doesn't match" 572782)


I think the current version no longer "validates"... But it could be anything... :(

Lutz

#7
repaired now:



http://www.newlisp.org/downloads/newlisp_manual.html">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

xytroxon

#8
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
\"Many computers can print only capital letters, so we shall not use lowercase letters.\"

-- Let\'s Talk Lisp (c) 1976

johnd

#9
The manual entry for "sync" should not precede "sym".  It should follow the entry for "symbols".



John

johu

#10
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.

Lutz

#11
Thanks Johnd and Johu, a new version rev-9 is online:



http://www.newlisp.org/downloads/manual_frame.html">http://www.newlisp.org/downloads/manual_frame.html

johu

#12
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.

johu

#13
I have one question.



4. Functions in alphabetical order

+, -, *, / ,%
QuoteFor 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 ?

Lutz

#14
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">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