Recent posts

#31
newLISP in the real world / Re: Lint and/or code formattin...
Last post by dukester - February 15, 2024, 01:08:18 PM
Thx ...
#32
newLISP in the real world / Re: Lint and/or code formattin...
Last post by itistoday - February 15, 2024, 10:16:31 AM
I normally use Parinfer
#33
newLISP in the real world / Lint and/or code formatting pr...
Last post by dukester - February 15, 2024, 06:28:46 AM
Is there one hiding somewhere? I searched this Forum and the Home site w/o any luck.
#34
newLISP in the real world / Re: sub bug?
Last post by cameyo - January 17, 2024, 06:24:00 AM
From the newLISP manual:
QuotenewLISP has two types of basic arithmetic operators: integer (+ - * /) and floating point (add sub mul div).
The arithmetic functions convert their arguments into types compatible with the function's own type: integer function arguments into integers, floating point function arguments into floating points.
#35
newLISP in the real world / Re: sub bug?
Last post by cameyo - January 14, 2024, 08:44:30 AM
Some test:

(format "%.20f" (sub 9999999999999999 9999999999999998))
=> "2.00000000000000000000" (error)

(format "%.20f" (sub 999999999999999  999999999999998))
=> "1.00000000000000000000" (ok)

(format "%.20f" (sub 8888888888888889 8888888888888888))
=> "1.00000000000000000000" (ok)

(format "%.20f" (sub 1000000000000000 999999999999999))
=> "1.00000000000000000000" (ok)

(format "%.20f" (sub 10000000000000000 9999999999999999))
=> "0.00000000000000000000" (error)


(format "%.20f" (sub 10000000000000000 1))
=> "10000000000000000.00000000000000000000"

(format "%.20f" (sub 10000000000000000 2))
=> "9999999999999998.00000000000000000000"

(format "%.20f" (sub 10000000000000000 3))
=> "9999999999999996.00000000000000000000"

(format "%.20f" (sub 10000000000000000 4))
=> "9999999999999996.00000000000000000000"

(format "%.20f" (sub 10000000000000000 5))
=> "9999999999999996.00000000000000000000"

(format "%.20f" (sub 10000000000000000 6))
=> "9999999999999994.00000000000000000000"


In C++:
#include <iostream>

using namespace std;

int main()
{
    cout<<(1e16 - 1) << endl;
    cout<<(10000000000000000 - 1);
    return 0;
}
=> 1e+16
=> 9999999999999999
#36
newLISP in the real world / sub bug?
Last post by vashushpanov - January 11, 2024, 07:12:11 PM
> (sub 9999999999999999,0 9999999999999998,0)
=> 2
> (- 9999999999999999 9999999999999998)
=> 1
#37
newLISP in the real world / Re: rotate bug?
Last post by cameyo - January 09, 2024, 09:47:22 AM
Thanks!!
#38
newLISP in the real world / Re: rotate bug?
Last post by vashushpanov - January 09, 2024, 01:50:57 AM
in file nl-liststr.c replace string
if (length <= 1 || count == 0 || length == labs(count))
to
if (length <= 1 || count == 0 || length == labs(count) || count % length == 0)

and recompile NewLisp
#39
newLISP in the real world / rotate bug?
Last post by cameyo - December 19, 2023, 05:23:26 AM
Maybe a bug of "rotate" when negative rotations and absolute rotations multiple of length of list.

(rotate '("1" "A" "B" "2") 8)
;-> ("1" "A" "B" "2")
(rotate '("1" "A" "B" "2") -8)
;-> ("1") ;ERROR
(rotate '("1" "A" "B" "2") 12)
;-> ("1" "A" "B" "2")
(rotate '("1" "A" "B" "2") -12)
;-> ("1") ;ERROR

Workaround:
(rotate lst (- (% r (length lst))))
(rotate '("1" "A" "B" "2") (- (% 12 4)))
;-> ("1" "A" "B" "2")
(rotate '("1" "A" "B" "2") (- (% 8 4)))
;-> ("1" "A" "B" "2")

#40
newLISP in the real world / Reverse lowercase to uppercase...
Last post by cameyo - December 18, 2023, 10:58:19 AM
Given a string, how to reverse lowercase to uppercase and vice versa with a "regex"?