Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - cameyo

#1
Whither newLISP? / Strange behavior
April 19, 2024, 12:28:25 PM

(define (test a) (extend '() (sequence 1 a)))
(test 4)
;-> (1 2 3 4)
(test 4)
;-> (1 2 3 4 1 2 3 4)
(test 4)
;-> (1 2 3 4 1 2 3 4 1 2 3 4)
test
;-> (lambda (a) (extend '(1 2 3 4 1 2 3 4) (sequence 1 a)))
#2
newLISP in the real world / Re: sub bug?
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.
#3
newLISP in the real world / Re: sub bug?
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
#4
newLISP in the real world / Re: rotate bug?
January 09, 2024, 09:47:22 AM
Thanks!!
#5
newLISP in the real world / rotate bug?
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")

#6
Given a string, how to reverse lowercase to uppercase and vice versa with a "regex"?
#7
newLISP and the O.S. / Re: Build newLISP for win10 64bit
December 15, 2023, 07:11:18 AM
I've been busy a little longer...
But today I compiled newLISP 10.7.6
See instructions here:
https://github.com/cameyo42/newLISP-Note/blob/master/97-appendici.lsp#L3767
I only compiled the utf8-ffi version and did few tests.
Ciao
#8
newLISP and the O.S. / Re: Build newLISP for win10 64bit
November 20, 2023, 09:58:09 AM
Hello IVShilov,
I'm a little busy right now.
I'll try to compile newlisp 64 bit next week (I hope).
Ciao
#9
newLISP and the O.S. / Re: Windows clipboard
November 07, 2023, 06:29:32 AM
Thanks!
#10
newLISP and the O.S. / Re: Windows clipboard
November 06, 2023, 01:12:31 PM
Thanks.
I can use the "clip" command, but where is "pasteclipboard.exe" ?
I have found: "powershell get-clipboard" to get text from clipboard.
#11
newLISP in the real world / Re: Reading keyboard input
October 26, 2023, 07:37:53 AM
Sorry, I can't help you.
But what do you mean by "enhanced REPL"?
I use Notepad++ connected to a REPL via Autohotkey script.
Far more powerful than only REPL.
Thanks.
#12
newLISP in the real world / Re: Reading keyboard input
October 26, 2023, 04:28:10 AM
This works for me:

(define (keys)
  (local (k)
    (while (!= (setq k (read-key)) 13)
      (setq s (string k))
      (println s))))

(keys)
;-> 1   ; Ctrl-A
;-> 111 ; O
;-> 79  ; o
;-> 0
;-> 59  ; F1
;-> 0
;-> 60  ; F2
;-> 224
;-> 81  ; PageUp
;-> 224
;-> 72  ; Up
;-> 224
;-> 77  ; Right
;-> 224
;-> 80  ; Down
;-> 224
;-> 75  ; Left
#13
newLISP and the O.S. / Windows clipboard
October 09, 2023, 06:00:10 AM
Do you known a way to manage windows clipboard (cut, copy, paste)?
I have tried to use clipboard.dll with no luck.
Thanks.

cameyo
#14
newLISP in the real world / newLISP Note
June 03, 2023, 09:07:51 AM
newLISP Note
more than 2000 newLISP topics (Project euler, Rosetta code, Programmers Interview, ...)
cameyo
p.s. it's written in Italian (but not the code ;)) and I'm just an amateur :)
#15
newLISP newS / Re: newLISP Github?
May 26, 2023, 09:07:07 AM
Anyone hear from Lutz?
I hope someone continues the development of newlisp.
To attract new users I think it would be useful to be able to download compiled versions of the latest 10.7.6 release for the major operating systems.
cameyo
p.s. sorry for the bad english