Page 1 of 1

development release version 9.0 2

Posted: Mon Nov 20, 2006 7:50 pm
by Lutz
• HTTP mode now working on Win32
• other bugfixes and additions

For files and changes notes see

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

Lutz

Posted: Mon Nov 20, 2006 8:12 pm
by newdep
Thanks Lutz,

I actualy dont know any other programming language
that has this much "useful!" variation on functions ..

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


Norman.

Posted: Mon Nov 20, 2006 8:34 pm
by cormullion
(explode lst 2) gives us the 'pair' function, I presume? Clever to place it there - sort of like a cluster bomb... :-)

Posted: Tue Nov 21, 2006 2:53 am
by rickyboy
Lutz,

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

Code: Select all

TESTING FINISHED WITH ERRORS:

>>>> pipe failed nil
Should I worry? --Ricky

Posted: Tue Nov 21, 2006 4:31 am
by Fanda
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!

Posted: Tue Nov 21, 2006 5:27 am
by Fanda
... I found the way, but I wish it was easier:

Code: Select all

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

Code: Select all

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

Code: Select all

(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

Posted: Tue Nov 21, 2006 7:03 am
by Lutz
There is an easier way:

Code: Select all

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

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

Posted: Tue Nov 21, 2006 1:58 pm
by rickyboy
Lutz wrote:There is an easier way:

Code: Select all

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

(vec + '(1 2) '(3 4)) => (4 6)
This might be even better:

Code: Select all

(define vec map)
Then there would be no intervening 'lambda' in calls to 'vec'. --Rick

Posted: Tue Nov 21, 2006 5:01 pm
by Lutz
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'.
(define vec map)
Yes this is the best, they really do both the same thing.

Lutz