development release version 9.0 2

Started by Lutz, November 20, 2006, 11:50:59 AM

Previous topic - Next topic

Lutz

• HTTP mode now working on Win32

• other bugfixes and additions



For files and changes notes see



http://newlisp.org/downloads/development/">http://newlisp.org/downloads/development/



Lutz

newdep

#1
Thanks Lutz,



I actualy dont know any other programming language

 that has this much "useful!" variation on functions ..



..great enhancements again on lists ....;-)





Norman.
-- (define? (Cornflakes))

cormullion

#2
(explode lst 2) gives us the 'pair' function, I presume? Clever to place it there - sort of like a cluster bomb... :-)

rickyboy

#3
Lutz,



I just built 9.0.2 on Linux and the end of 'qa-dot' says:
TESTING FINISHED WITH ERRORS:

>>>> pipe failed nil

Should I worry?  --Ricky
(λx. x x) (λx. x x)

Fanda

#4
I also have a question:



When using 'mat':

> (mat * '((1 2) (3 4)) 2)

((2 4) (6 8))



I would like to exchange operators to something else using 'op':



'op' is a function:

> (set 'op +)

+ <40B246>

> (mat op '((1 2) (3 4)) 2)

illegal parameter type in function mat : '((1 2) (3 4))



'op' is a symbol:

> (set 'op '+)

+

> (mat op '((1 2) (3 4)) 2)

illegal parameter type in function mat : '((1 2) (3 4))



How does 'mat' work with + - * and / ???



Thanks, Fanda



PS: New 'explode' on lists is great!

Fanda

#5
... I found the way, but I wish it was easier:


(set 'op '+) => +
(eval (list 'mat op ''((1 2) (3 4)) 2)) => ((3 4) (5 6))
(eval (list mat op ''((1 2) (3 4)) 2)) => ((3 4) (5 6))

(set 'op '*) => *
(eval (list mat op ''((1 2) (3 4)) 2)) => ((2 4) (6 8))

(set 'op '/) => /
(eval (list mat op ''((1 2) (3 4)) 2)) => ((0.5 1) (1.5 2))


And here is the reason, why I needed it :-)
(define-macro (vec op u v)
  (setq u (list (eval u)))

  (setq v (eval v))
  (unless (number? v)
    (setq v (list v)))

  (first (eval (list mat op 'u 'v))))


(vec + '(1 2) '(3 4)) => (4 6)
(vec * '(1 2) '(3 4)) => (3 8)
(vec - '(1 2) '(3 4)) => (-2 -2)
(vec / '(1 2) '(3 4)) => (0.3333333333 0.5)

(vec + '(1 2) 5) => (6 7)


Fanda

Lutz

#6
There is an easier way:


(define (vec op u v) (map op u v))

(vec + '(1 2) '(3 4)) => (4 6)


Lutz

rickyboy

#7
Quote from: "Lutz"There is an easier way:


(define (vec op u v) (map op u v))

(vec + '(1 2) '(3 4)) => (4 6)


This might be even better:
(define vec map)
Then there would be no intervening 'lambda' in calls to 'vec'.  --Rick
(λx. x x) (λx. x x)

Lutz

#8
Quote
I just built 9.0.2 on Linux and the end of 'qa-dot' says:

Code:

TESTING FINISHED WITH ERRORS:



>>>> pipe failed nil



Should I worry? --Rick


Don't worry. I just rechecked Debian 3.1 and Fedora FC2 and they are both fine. Probably the timing was too short. Try again or change (sleep 1000) to (sleep 2000) in function 'test-pipe'.


Quote(define vec map)


Yes this is the best, they really do both the same thing.



Lutz