Recent posts

#71
newLISP and the O.S. / Re: Build newLISP for win10 64...
Last post by IVShilov - November 12, 2023, 10:59:24 PM
Maybe in 2019 it was so simple,but in 2023 it is not :)
TDM have no ls, rm utilities, so I cannot do a "./configure" or "make clean".
MSYS have, but it not appropriate for building.

Can somebody explain step by step what I have to do to build newlisp from souce?

First: install TDM-GCC, ok, what next?
#72
newLISP and the O.S. / Re: Windows clipboard
Last post by cameyo - November 07, 2023, 06:29:32 AM
Thanks!
#73
newLISP and the O.S. / Re: Windows clipboard
Last post by Yael - November 07, 2023, 02:12:09 AM
As an example, in a Windows *.bat file use this:

echo "%var%" | clip.exe
pasteclipboard.exe
yournewlispfile.exe

The file yournewlispfile.exe is your newlisp compiled file, which must include these commands:

(set 'option (exec "pasteclipboard.exe"))
(set 'myvar(parse (option 0)))

I know it is a dirty way of doing things, but honestly after struggling with dll's import I failed miserably.

#74
newLISP and the O.S. / Re: Windows clipboard
Last post by Yael - November 07, 2023, 02:01:55 AM
I am now attaching a zipped file with the pasteclipboard.exe here:
#75
newLISP in the real world / Does (reset) restores the top-...
Last post by IVShilov - November 07, 2023, 12:06:07 AM
Info from manual :

reset restores the top-level variable environment using the saved variable environments on the stack.

But I can't "restores the top-level variable environment using the saved variable environments on the stack" using it:

newLISP v.10.7.5 64-bit on Windows IPv4/6 UTF-8 libffi, options: newlisp -h

> (crc32 (string (symbols)))
3617620833
> (prompt-event (fn () (string (args 0) ":" (crc32 (string (symbols))) " > ")))
$prompt-event
MAIN:1539437814 > (delete 'a)
true
MAIN:1539437814 > a
nil
MAIN:2595764761 > ## state change: 2595764761
MAIN:2595764761 > (ref "a" (map term (symbols)))
(49)
MAIN:2595764761 > ## sym a exists
MAIN:2595764761 > (delete 'a)
true
MAIN:1539437814 > ## we come back in 1539437814
MAIN:1539437814 > (ref "a" (map term (symbols)))
nil
MAIN:1539437814 > ## no sym a in MAIN
MAIN:1539437814 >

MAIN:1539437814 > a
nil
MAIN:2595764761 > ## sym a exist again but now we try to clean a context MAIN by reset
MAIN:2595764761 > ## newlisp manual: " reset restores the top-level variable environment using the saved variable environments on the stack. "
MAIN:2595764761 > (reset)
MAIN:2595764761 > (ref "a" (map term (symbols)))
(49)
MAIN:2595764761 > ## sym a exists
MAIN:2595764761 >

Bug or feature?
#76
newLISP and the O.S. / Re: Windows clipboard
Last post by cameyo - 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.
#77
newLISP and the O.S. / Re: Windows clipboard
Last post by Yael - November 05, 2023, 02:41:18 AM
I use a call to pasteclipboard.exe to read from the clipboard. Here, an example:

(set 'option (exec "pasteclipboard.exe"))
(set 'optid (parse (option 0)))
(when (= (join optid) "0") (myfunction))
.
.
.

To put something on the clipboard I call clip.exe (all of this under Windows OS)
#78
newLISP in the real world / Re: Reading keyboard input
Last post by IVShilov - October 26, 2023, 10:56:31 AM
Another bug on this way: timer and read-key can't used together
(setq c nil interval 0,001)
(define (output)
    (if c
        (begin
          (print (char c))
          (setq c nil)
          ))
    (timer 'output interval)
    )
(output)
In console:
      > (setq c 100)
      100
      > d

      > (setq c (read-key))
      13
      0 > ## a context "0" ???

      0 > (context)
      MAIN
      >
#79
newLISP in the real world / Re: Reading keyboard input
Last post by IVShilov - October 26, 2023, 10:44:47 AM
AutoHotKey? Can't even imagine this.

Enchanced REPL is like a emacs/readline but for one string:
 - autocompletion by TAB:
     - functions using (filter lambda? (symbols)) 
     - args using (type) and function definitions
 - swapping two elements in line by C-t|C-M-t
 - highlight substrings using xterm esc-sequences and ConEmu's interface
and so on.
For example, look at ipython.
#80
newLISP in the real world / Re: Reading keyboard input
Last post by cameyo - 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.