newLISP Fan Club

Forum => newLISP newS => Topic started by: Lutz on March 01, 2010, 04:45:03 AM

Title: Manual and release notes for upcoming 10.2.0
Post by: Lutz on March 01, 2010, 04:45:03 AM
The manual and release notes for upcoming version 10.2.0 of newLISP have been updated here:



http://www.newlisp.org/downloads/development/latest/



If anybody wants to make corrections (including better wording), there are not many days left before release.
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: johu on March 01, 2010, 06:02:49 AM
<<, >>



(>> 0x800000000000000 1)

(>> 0x8000000000000000 1)



define



 Expressions in exp-default are evaluated in the function's current environment.



(define-macro (foo (a 10) (b (div a 2)))

(define (foo (a 10) (b (div a 2)))



for



If no step size is specified, 1.0 is assumed.

If no step size is specified, 1 is assumed.





fv



If payment is at the end of the period, int-type is 0 (zero); for payment at the end of each period, int-type is 1. If num-type is omitted, payment at the end of each period is assumed.



If payment is at the end of the period, int-type is 0 (zero); for payment at the end of each period, int-type is 1. If num-type is omitted, payment at the end of the period is assumed.



because
> (fv (div 0.07 12) 1 775.3 -100000 0)
99808.03333
> (fv (div 0.07 12) 1 775.3 -100000 1)
99803.51075
> (fv (div 0.07 12) 1 775.3 -100000)
99808.03333


int



If str is invalid, int returns nil as a default value if not otherwise specified.

If exp is invalid, int returns nil as a default value if not otherwise specified.



maybe.



Sorry, I ended the translation up to I, yet.
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: xytroxon on March 01, 2010, 09:08:14 AM
The last lines of the newLISP manual function definitions:



======



inc



Use the ++ function for incrementing numbers in integer mode.



----------



dec



Use the inc function to increment numbers.



======



Need to be changed to something like:



======



inc



Use the ++ function for incrementing numbers in integer mode.

Use the dec function to decrement numbers.



----------



dec



Use the -- function for decrementing numbers in integer mode.

Use the inc function to increment numbers.



======



(And if it's not too much trouble ;p)



You added ++ and -- to the +, -, *, /, % table entry

in:



Function Reference



   1. Syntax of symbol variables and numbers

   2. Data types and names in the reference

   3. Functions in groups

          * List processing, flow control, and integer arithmetic



Now the table entry is:



+, ++, -, --, *, /, %   integer arithetic



Besides looking messy ;p)



When deconstructing the single newLISP manual html file into individual html pages, the ++ and -- sections are not reachable by scrolling down from +, ++, -, --, *, /, %.



Could you change the table to:



+, -, *, /, %   integer arithmetic

++   incremet integer number

--   decrement integer number



-- xytroxon
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: Lutz on March 02, 2010, 04:48:57 AM
Many thanks to Johu and Xytroxon for the corrections. Updated versions of the documents can be found here:



http://www.newlisp.org/downloads/development/latest/
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: johu on March 05, 2010, 09:08:46 PM
Thank you Lutz.



and,



mat



Using the second syntax, all cells in matrix-A are multiplied with a scalar in number:



Using the second syntax, all cells in matrix-A are operated with a scalar in number:



maybe.



I ended the translation up to M.
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: johu on March 11, 2010, 12:49:46 AM
Sorry, I have not ended the translation up to N, yet.



net-interface



This function has only usage on multihoned servers

This function has only usage on multihomed servers



An interface address can be defined as either and IP address or a name.

An interface address can be defined as either IP address or a name.



maybe and also,



Socket TCP/IP and UDP network API



net-eval    Sets the default interface IP address on multihoned computers.

net-interface    Sets the default interface IP address on multihomed computers.
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: Lutz on March 11, 2010, 04:43:15 AM
Thanks for your help,  Johu. Release will be next week, so everything coming in until Monday or Tuesday, will be in the distribution packages. But I always post revisions with corrections for the on-line manual between releases too.
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: xytroxon on March 13, 2010, 04:05:35 PM
newLISP manual spelling errors:



addtionally -> additionally

arithmetik -> arithmetic

beginnig -> beginning

charcaters -> characters

comforms -> conforms

comminicate -> communicate

directoy -> directory

Erros -> errors

errror -> errors

espressions -> expressions

exspired -> expired

fucntion -> function

imformation -> information

implementarion -> implementation

insteead -> instead

interacive -> interactive

libraryi -> library

specific matric operations  -> specific matrix operations

mssage -> message

nsufficient -> insufficient

occurrance -> occurrence

Ofset -> Offset

othet -> other

previusly -> previously

recognizabe -> recognizable

routinesi -> routines

succesfully -> successfully

in thr sender -> in the sender

Whe the prefix -> When the prefix

woth -> with



-- xytroxon
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: Lutz on March 13, 2010, 06:38:51 PM
Thanks Xytroxon, updated here:



http://www.newlisp.org/downloads/development/latest/newlisp_manual.html
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: johu on March 13, 2010, 11:45:50 PM
not



If exp evaluates to nil, then true is returned; otherwise, nil is returned.

If exp evaluates to nil or the empty list (), then true is returned; otherwise, nil is returned.



Next time, I will post in a new topic.
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: xytroxon on March 14, 2010, 12:42:42 PM
Spelling errors in Code Patterns  10.1.12  02-23-2010



allthough -> although

chracter -> character

controlls -> controls

conventsions -> conventions

distibuted -> distributed

fucntion -> function

libararies -> libraries

mesaging ->messaging

messsages -> messages

mulitple -> multiple

persisten -> persistent

shapters -> chapters

sring -> string

sruct mystruct -> struct mystruct

transfomed -> transformed



-- xytroxon
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: Lutz on March 15, 2010, 05:18:49 AM
Many thanks again to Johu and Xytroxon for the latest corrections. You can find files in the usual downloads/development/latest/  -location. Please try to post pending corrections until March 16th, 12:00 UTC.
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: johu on March 16, 2010, 01:43:56 AM
pack



See also the address, get-int, get-long get-char, get-string, and unpack  functions.

See also the address, get-int, get-long, get-char, get-string, and unpack  functions.



parse



If >str-data is specified, there is no limitation on the length of tokens.

If str-break is specified, there is no limitation on the length of tokens.



Instead of { and } (left and right curly brackets), quotes can be used to limit the pattern.

Instead of { and } (left and right curly brackets), double quotes can be used to limit the pattern.





And,

Are the following the same ?

I think that fv's sentence is better.



fv



If payment is at the end of the period, int-type is 0 (zero) or int-type  is omitted; for payment at the beginning of each period, int-type is 1.



nper



If payment is at the end of the period, int-type is 0; else it is 1. If int-type is omitted, 0 is assumed.



pmt



When paying at the end of each period, num-type is 0 (zero); otherwise,it is 1. If omitted, int-type is assumed to be 0 (zero) for payment at the end of a period.

When paying at the end of each period, int-type is 0 (zero); otherwise,it is 1. If omitted, int-type is assumed to be 0 (zero) for payment at the end of a period.



pv

If payment is at the end of each period, 0 (zero) is assumed for int-type; otherwise, 1 is assumed.
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: m35 on March 19, 2010, 10:42:07 PM
search
QuoteIf int-options is mot specified
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: kukma on March 23, 2010, 05:43:08 AM
Lutz,



can you post the link to the odt file when the documentation becomes stable.

I want to compile it to a CHM file as you suggested.



Here I have CHM files belonging to the previous version 10.1.x ,

namely

    codepatterns  and

    introduction-to-newlisp from Wikibooks

Would you prefer me to update them first?



Also I was working on a compiled help file containing the GTK+ Reference Manual for GTK+ 2.18.9 .

The good thing will be to use the reference as contextsensitive help in editors.



Do you and others like them separately or all in one file?



Regards,

Michael
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: Lutz on March 23, 2010, 09:16:52 AM
Here is the latest version in OpenOffice ODT format:



http://www.newlisp.org/newlisp_manual-10201.odt



The PDF and HTML versions have been updated too.



Ps: I would keep different formats in different files.
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: cormullion on March 23, 2010, 11:19:34 AM
Sorry to have missed out on the editing this time round! Thanks to everyone for making theh newLISP manual (even) better!



In some spare moments I've been thinking about ebooks and electronic docs. I've been using the newlisp manual as a real-world example. One thing I tried was this:


(set 'f (read-file {/usr/share/doc/newlisp/newlisp_manual.html}))
(xml-type-tags nil nil nil)
(set 'xf (xml-parse f 15))


Yes, it doesn't work. But that's just because the manual is in HTML Transitional.  I ran the HTML source through BBEdit's version of Tidy - converting it to XHTML. It appears to make little difference to the 'user experience' in a  browser - a lot of changes to BR tags and so on, but not much else.



But now that code above works, and produces SXML of the source:


(html ((xmlns "http://www.w3.org/1999/xhtml")) (head (meta ((http-equiv "content-type")
     (content "text/html; charset=utf-8")))
   (meta ((name "author") (content "Lutz Mueller")))
   (meta ((name "keywords") (content "newLISP Lisp SCHEME programming language manual reference Artificial Intelligence AI NUEVATEC")))
   (meta ((name "description") (content "newLISP Users Manual and Reference")))
...
(a ((name "shell") (id "shell")))
   (h2 (span ((class "function")) "!"))
   (h4 "syntax: (! " (em "str-shell-command") ")")
   (p "Executes the command in " (em "str-command") " by shelling out to the operating system and executing. This function returns a different value depending on the host operating system.")
   (pre "n(! "vi")  n(! "ls -ltr")n")
...


Yes it looks crazy (but better than HTML), but I can't help thinking that this format might be useful, because you can easily use newLISP on it. For example:


(set 'xr (ref-all 'h4 xf))
(dolist (r xr)  (println (rest (xf (chop r)))))


gives a list of all syntax definitions, suitable for producing a quick reference guide...



A few questions arise: what are the problems with distributing the manual in XHTML rather than HTML, such that a trip through Tidy wouldn't be necessary? Also, how could you go about outputting the SXML structure to other formats, such as plain old HTML? It kind of looks to me like it could be executable, somehow, if there were definitions for the major tags... And another possibility - could this format be the basis for some kind of newLISP-oriented text editor?



Just a few thoughts... :)
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: tomtoo on March 23, 2010, 02:41:44 PM
peanut gallery here.  all of that sounds very cool and useful to me. :-)
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: Lutz on March 23, 2010, 05:14:30 PM
This is a great idea. If you can send me an XHTML translation of the current rev-2 manual from:



http://www.newlisp.org/downloads/newlisp_manual.html



and I can try if it works with my PDF conversion.
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: Lutz on March 24, 2010, 06:39:18 AM
In the end I succeded to do the XHTML conversion myself, and its online now:



http://www.newlisp.org/downloads/newlisp_manual.html



it can be parsed using:


(xml-type-tags nil nil nil nil)
(xml-parse (read-file "newlisp_manual.html") 15)


and you can do this:


> (ref-all '(h1 *) (xml-parse (read-file "./newlisp_manual.html") 15) match true)
((h1 "Contents") (h1 "newLISP Users Manual") (h1 "newLISP Function Reference"))
>


The 'true' flag at the end of 'ref/ref-all' was introduced in 10.1.7 to return the content instead of the index-vector.
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: cormullion on March 24, 2010, 11:21:06 AM
Cool - I was going to do it when I got back today but you beat me to it.  I think Tidy is freely available, even though BBEdit costs money...



I can see how you'd scan the SXML for analysis:


(define Tags:Tags)

(define (count-tags expr)
 (cond
   ((list? (first expr))
      (count-tags (first expr))
      (dolist (s (rest expr)) (count-tags s)))
   ((symbol? (first expr))
      (dolist (s (rest expr))
            (count-tags s))
      (set 'key (string (first expr)))    
      (if (Tags key)
          (Tags key (inc (Tags key)))
          (Tags key 1))
      )
   )
)

(count-tags xf)

(println (Tags))
  (
    ("a" 2298)
    ("align" 47)
    ("alink" 1)
    ("b" 150)
    ("bgcolor" 1)
    ("blockquote" 21)
    ("body"  1)  
    ("border" 20)  
    ("br" 1079)  
    ("cellpadding" 20)  
    ("center" 42)  
    ("class" 2031)  
    ("color" 29)  
...




But presumably it's possible to actually execute the SXML list directly, provided that there are suitable functions already define for each symbol/tag...? How would I do that?
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: cormullion on March 28, 2010, 07:08:01 AM
I tried to work out how to make such an SXML list can be an expression that can be directly evaluated.  The problem is with the double-parenthesized expressions. For example, this is OK:


(p "Built-in and user-defined functions are suitable for " (u "both") " types of arguments, but when passing context names, data will be passed by reference.")
   (p "Quoted symbols can also be used to pass data by reference, but this method has disadvantages:")


because user-defined functions can be defined that output some representation of paragraph and underlined text. But I can't make these work:


(a ((href "#load")) "load")

because of the double parentheses?
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: Lutz on March 28, 2010, 07:28:26 AM
You need to add the SXML attribute tag '@' via option 16


(xml-type-tags  nil nil nil nil)
(xml-parse "<a href='#thelink'>a Link</a>" 31)

=> ((a (@ (href "#thelink")) "a Link"))


Now the '@' could be defined as processing the s-expressions follwing it. Basically it would work like a 'begin'.
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: cormullion on March 28, 2010, 09:58:15 AM
Yes - that works, thanks! Although now I've got even further into the jungle:



First I had to redefine the built-in symbols that also appear in the SXML, but then:


(set-ref-all 'div xf '_div)
(set-ref-all 'name xf '_name)
(set-ref-all '@ xf '_@)

(define (_@) (begin (args)))

(map
    (fn (f)
      (letex
        ((fn-name (sym (string f))))
        (define (fn-name a)
           (string a))))
    (map first (Tags)))

(println (apply eval xf))


it gives a stack overflow error... Nested too much? I didn't think so. I think I'm close to a solution but ...
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: kosh on March 29, 2010, 03:52:51 PM
In newlisp_manual.html, some lines that have a unbalanced double quotes(") are found.



Please see diff file below:


--- newlisp_manual-10.2.1-rev2.orig.html Tue Mar 30 02:59:58 2010
+++ newlisp_manual-10.2.1-rev2.html Tue Mar 30 03:12:13 2010
@@ -2099,7 +2099,7 @@
 
 ; strings
 
-(set 's "NewLISP)
+(set 's "NewLISP")
 
 (setf (s 0) "n") <span class='arw'>&rarr;</span> "n"
 
@@ -2590,7 +2590,7 @@
 </pre>
 
 <p>The <a href="#symbols">symbols</a> function is used to show all symbols
-belonging to a context"</p>
+belonging to a "context"</p>
 
 <pre>
 (symbols FOO) <span class='arw'>&rarr;</span> (FOO:func FOO:var FOO:x FOO:y FOO:z)
@@ -2896,7 +2896,7 @@
 ;; Variables used throughout this namespace
 
 (define db:handle)
-(define db:host "http://localhost)
+(define db:host "http://localhost")
 
 ;; Constants
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: Lutz on March 30, 2010, 01:40:45 PM
Thanks to Kosh and Sammo (in a different thread) for the latest manual corrections, online since yesterday:



http://www.newlisp.org/downloads/newlisp_manual.html
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: cormullion on March 31, 2010, 12:17:07 PM
What could be the cause of this error?


ERR: call or result stack overflow : args<3670>
called from user defined function br
called from user defined function h4
called from user defined function body
called from user defined function html


Is it that the list is too deeply nested, or that the list is too long?



sys-info reports this at the beginning:



(78309 268435456 501 8 0 2048 0 56523 10110 131)



and this just before the  overflow:



(86380 268435456 501 8 0 2048 0 56523 10110 131)



but I can't see where a 'call stack' would be exceeded...?



Setting a value with the -s switch doesn't appear to change these figures:
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: Lutz on March 31, 2010, 12:26:14 PM
Currently on a trip with internet on a phone only. Will look into it on Friday.
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: Lutz on April 01, 2010, 08:38:04 AM
I assume you have the body tag defined as a 'begin' operation. The 'begin' function is limited to 4096 expressions, but you could use either 'lambda/fn' or 'dolist' to evaluate longer lists of expressions:


(apply (append (fn ()) long-list-of-expressions))

; or

(dolist (ex long-list-of-expressions)
    (eval x))
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: cormullion on April 01, 2010, 10:54:02 AM
Hi Lutz - thanks for the idea. But I think the problem may be elsewhere. Sorry about my code, it's not the best, but I'm just hacking to see if this is a valid path for a project.... Can't see where I've gone wrong. (And sorry about the wrong thread, too...:)



This code expects the manual to be in XHTML format...


(set 'f (read-file {/usr/share/doc/newlisp/newlisp_manual.html}))
(xml-type-tags nil nil nil)
(set 'xf (xml-parse f 31))

(set-ref-all 'div xf '_div)
(set-ref-all 'name xf '_name)
(set-ref-all '@ xf '_@)

(define (_@)
    (dolist (ex (args))
        (eval ex)))

(dolist (tag '(html a align alink b bgcolor blockquote
body border br cellpadding center class color
content em font h1 h2 h3 h4 head hr href
http-equiv i id li link media meta ol p
pre size span style summary table td text
th title tr tt type u ul valign vlink
width xmlns _div _name))
    (letex
       ((f-name (sym (string tag))))
       (define (f-name) (string  "{"  (join (args) "n")  "}"))))

(println (eval xf))

ERR: call or result stack overflow : dolist<E5E3>
called from user defined function _@
called from user defined function span
called from user defined function pre
called from user defined function body
called from user defined function html

Title: Re: Manual and release notes for upcoming 10.2.0
Post by: Lutz on April 02, 2010, 07:06:15 AM
Put 'println' statements at the beginning of both 'dolist' loops (tag and _@) and see what is going on. This will show you the path of execution and the reason for the overflow message. Note that only callstack depth is reflected in 'sys-info' and only before the error occurs. The error itself will cause a stack cleanup. The result stack cannot be traced with 'sys-info'.



The other possibility would be:


(debug (eval xf))

to see what is happening.
Title: Re: Manual and release notes for upcoming 10.2.0
Post by: cormullion on April 02, 2010, 09:35:54 AM
Thanks, Lutz. Which is the call stack depth - (sys-info 4) (= "Environment stack level")? This is nearly always 0, and occasionally 1.



It says this just before the call or result stack overflow



(86755 268435456 449 10 0 2048 0 60948 10201 131)



I've gone through with the debugger - just can't work out what I should be looking for. The code is simple, but fails after about 21000 function calls.