development release newLISP v.9.2.8

Started by Lutz, December 02, 2007, 04:40:50 AM

Previous topic - Next topic

Lutz

* get-url, post-url, put-url and delete-url have been extended and reworked



for files and changes notes see: http://newlisp.org/downloads/development/">http://newlisp.org/downloads/development/



Lutz

Jeremy Dunn

#1
I had three small changes as suggestions for the next release, they are:



1. I wrote a function to mimic the NOT function but differ in one important respect, it could take on multiple operators. it looks like this



(define-macro (n)
 (if (= true (args 0)) nil
     (nil? (args 0)) true
     (not (eval (if (= 1 (length (args))) (args 0) (args))))
 ))

Doing it this way enables you to write (n (= 2 3)) also in the form (n = 2 3) where the inner parentheses can now be eliminated. If there are multiple arguments the function assumes that the first argument is a boolean function that is to be applied to the rest of the arguments. That is a pretty safe assumption. This change wouldn't break code for the NOT function and enhance it slightly. This might seem trivial but the addition of a lot of small things often adds up and LISP is always about stretching an abstraction to its greatest limits wherever possible.



2. Include norming within the POW function. POW currently squares a single number as input. Let POW take a single list of numbers (a vector) and return the norm of the vector. So

(pow (1 2 3)) would return (sqrt (apply add (map mul L L))) or 3.741... This would combine all of the common squaring and powering operations under one roof.



3. The DIV function currently returns the inverse 1/X of a number X as in (div 3) -> 0.333 . The second most common division operation is to divide by 2. I would suggest handing this task over to the / operator so that (/ X) becomes the same as (div X 2). I know that this is not exactly ideal since the / operator is supposed to deal with integers only but DIV is already used up for defaults.