newLISP stable release 10.6.2

Started by Lutz, January 19, 2015, 04:52:59 PM

Previous topic - Next topic

TedWalther

#15
Lutz, fix for the website:



In the manual section for the "replace" function, you have this:



(set 'str "ZZZZZxZZZZyy")     → "ZZZZZxZZZZyy"
(replace "[x|y]" str "PP" 0)  → "ZZZZZPPZZZZPPPP"
str                           → "ZZZZZPPZZZZPPPP"


The regex [x|y] should be (x|y).  Although your example works, the use of the pipe '|' character is an idiom that goes with parens (), not needed inside a character class [].



I made the following function for printing strings so newLisp can read them back in:



(define (nl-esc a) (replace {(\|")} a (string {} $it) 0))


For reasons I didn't have time to investigate too deeply, when I put the '' and '"' characters inside a character class, only the first substitution was made.  Sometimes.
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence.  Nine months later, they left with a baby named newLISP.  The women of the ivory towers wept and wailed.  \"Abomination!\" they cried.

Lutz

#16
Thanks Walther, now corrected: http://www.newlisp.org/downloads/newlisp_manual.html#replace">http://www.newlisp.org/downloads/newlis ... ml#replace">http://www.newlisp.org/downloads/newlisp_manual.html#replace

TedWalther

#17
Another: in the Manual, for "union", the link to "intersect" is broken, it should be #intersect, not #interset
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence.  Nine months later, they left with a baby named newLISP.  The women of the ivory towers wept and wailed.  \"Abomination!\" they cried.

Lutz

#18
Thanks Ted:  http://www.newlisp.org/downloads/newlisp_manual.html#union">http://www.newlisp.org/downloads/newlis ... html#union">http://www.newlisp.org/downloads/newlisp_manual.html#union

TedWalther

#19
Lutz, I found a segfault in 10.6.2.  It happens on Mac OS and on Debian Linux, 64bit Intel platform.  Any ideas?  I need tracebacks for debugging, so this is my attempt at it.  Once it is working, I'll disable the println statements in it, and a function can do its own (println $stack) to show its own traceback.  Much less verbose than the (trace) function provided already.



The segfault happens when I actually call the define-traced macro.  At the moment, it looks like the segfault happens inside the expand function.



(define-macro (define-traced)
  (if (list? (args 0))
    (eval (expand
      '(define call-pattern
          (if (and $stack (list? $stack))
            (push call-pattern $stack)
            (setq $stack (list call-pattern)))
          (println $stack " -> ")
          (set 'rval call-body)
          (pop $stack)
          (println $stack " <- ")
          rval)
      '((call-pattern (args 0)) (call-body (cons 'begin (rest (args)))))
      true))
    (eval (expand '(define var-name var-value) '((var-name (args 0)) (var-value (args 1))) true))
  )
)


(define-traced (foo a b) (println a " says hi to " b) (bar a b))
(define-traced (bar a b) (println b " blushes at " a) (baz a b))
(define-traced (baz a b) (println a " and " b " shake hands."))
(println "foo: " foo)
(foo "John" "Tracy")

Cavemen in bearskins invaded the ivory towers of Artificial Intelligence.  Nine months later, they left with a baby named newLISP.  The women of the ivory towers wept and wailed.  \"Abomination!\" they cried.

Lutz

#20
Fixed here: http://www.newlisp.org/downloads/development/inprogress/">http://www.newlisp.org/downloads/develo ... nprogress/">http://www.newlisp.org/downloads/development/inprogress/