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

#166
I have the following problem:
; create two contexts (A1, A2)
> (context 'A1)
;-> A1
A1> (context MAIN)
;-> MAIN
> (context 'A2)
;-> A2
A2> (context MAIN)
;-> MAIN
; create a variable "a"
> (setq a 2)
;-> 2
> (context 'A1)
;-> A1
; context A1 do not see the variable "a"
A1> a
;-> nil
; context A1 do not see the variable "a"
A1> (context 'A2)
;-> A2
A2> a
;-> nil
A2> (context MAIN)
;-> MAIN
> a
;-> 2

; set variabile "a" to global
(global 'a)

; but A1 and A2 do not see the variable "a"
> (context 'A1)
;-> A1
A1> a
;-> nil
A1> (context 'A2)
;-> A2
A2> a
;-> nil

But this works (do not check variable value on contexts before globalize it:

A2> (context MAIN)
;-> MAIN
> (context 'B2)
;-> B2
B2> (context MAIN)
;-> MAIN
> (context 'B1)
;-> B1
B1> (context MAIN)
;-> MAIN
> (setq b 3)
;-> 3
> (global 'b)
;-> b
> (context B1)
;-> B1
B1> b
;-> 3
B1> a
;-> 2
B1> (context B2)
;-> B2
B2> b
;-> 3
B2> a
;-> 2
B2>

B2> (context MAIN)
MAIN
; the context A1 see only "b" ("a" is nil)
> (context A1)
A1
A1> a
nil
A1> b
3
A1>

; change variable value
A1> (context MAIN)
MAIN
> (setq a 10)
10
> a
10
> (context B1)
B1
B1> a
10
B1> (context A1)
A1
A1> a
nil
A1>

Why A1 and A2 do not see the variable "a" ?

what am i doing wrong?

Is there a rule to define global variables and contexts?
#167
newLISP in the real world / Italian notes on newlisp
April 19, 2019, 02:26:31 AM
I'm writing some newlisp notes (in italian language):

https://github.com/cameyo42/newLISP-Note">//https://github.com/cameyo42/newLISP-Note

It is a work in progress and I am a beginner.

Advice, suggestions and corrections are welcome.

cameyo
#168
newLISP in the real world / Re: let and letn
March 05, 2019, 03:27:08 AM
I get:
(1 2 3 (4 5 6 7) (nil nil nil nil))
with newLISP 10.7.5 and 10.7.4 on windows 10.

cameyo
#169
newLISP and the O.S. / Re: Build newLISP for win10 64bit
February 20, 2019, 08:42:52 AM
@HPW: Thanks. All windows test passed.

Only one drawback: the file libffi-6.dll must be registered or saved in the same folder of newlisp.exe. Why?

cameyo
#170
newLISP and the O.S. / Re: Build newLISP for win10 64bit
February 19, 2019, 09:25:48 AM
@Lutz: which version of libffi ?

I have tried with prebuilt binaries of libffi 3.0.13-2 and libffi 3.2.1 and both works (compile and build newLISP.exe and newLISP.dll).

How to test the result ? Is there a program/script to test newLISP build ?

Thanks

cameyo
#171
newLISP and the O.S. / Re: Build newLISP for win10 64bit
February 19, 2019, 05:41:34 AM
@Lutz: Thanks. I'll try it this night :-)

Regards,

cameyo
#172
newLISP and the O.S. / Re: Build newLISP for win10 64bit
February 18, 2019, 10:36:26 AM
Update:



The "makefile_mingw64dll_utf8" gives an error on this statement:
gcc -m64 -shared *.o -Wl,--kill-at -lws2_32 -o newlisp.dll
gcc.exe: error: *.o: Invalid argument

To solve this i have changed the statement:
$(CC) -m64 -shared $(OBJS) -Wl,--kill-at -lws2_32 -o newlisp.dll
Now, i have some problems to build the ffi version of newLISP.

For example using the file "makefile_mingw64_utf8_ffi" i got the following error:
C:/TDM-GC~1/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
cannot find -lffi
collect2.exe: error: ld returned 1 exit status

on this line:
$(CC) -m64 $(OBJS) -lws2_32 -lffi -o newlisp.exe
Maybe the -lffi option is wrong ?

Some help?



cameyo
#173
newLISP and the O.S. / Re: Build newLISP for win10 64bit
February 17, 2019, 04:27:29 AM
Download and install:  tdm64-gcc-5.1.0-2.exe

Download and unpack newlisp source code

Change folder to source code folder

Type: make -f makefile_xxxxx
I choose "makefile_mingw64_utf8" and then "makefile_mingw64dll_utf8" for "makefile_xxxxx"

After a few seconds i got my newlisp.exe and then newlisp.dll.



Thanks Lutz and HPW
#174
newLISP and the O.S. / Re: Build newLISP for win10 64bit
February 16, 2019, 07:53:14 AM
@HPW:

Thanks. I have already read that...

But reading it again had help me to understand :-)

Try with: http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/tdm64-gcc-5.1.0-2.exe/download">//http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/tdm64-gcc-5.1.0-2.exe/download



Have a nice day.
#175
newLISP and the O.S. / Build newLISP for win10 64bit
February 16, 2019, 06:37:28 AM
Which tools i need to build newLISP from source (windows 10 - 64 bit) ?

MinGW or mingw-w64 ?

Which version of gcc ?

Can someone point me on the right direction?

Thanks
#176
Whither newLISP? / Re: Retrieving the value of a symbol
February 11, 2019, 12:53:08 PM
You solve my question with:
(eval (sym {"name"})) -> 3
Thanks fdb :-)
#177
Whither newLISP? / Retrieving the value of a symbol
February 11, 2019, 10:33:07 AM
These expressions generate an error:
(set '"name") -> ERR: symbol expected in function set : '"name"
(set (quote "name") 3) -> ERR: symbol expected in function set : '"name"

But the following are valid (then "name" is a valid symbol):
(setf '"name" 3) -> 3
(setq "name" 3) -> 3

Now the problem: how to retrieve the value of the symbol "name"?
(println "name") -> name
(setq a "name")
(println a) -> "name"

Thanks
#178
newLISP and the O.S. / Windows 10 ANSI color
February 07, 2019, 03:22:02 AM
The console in Windows 10 support VT (Virtual Terminal) / ANSI escape sequences but it is disable by default.

To activate it:

in registry key [HKEY_CURRENT_USERConsole], create or set the VirtualTerminalLevel DWORD value to 1.

(or from cmd.exe : reg add HKCUConsole /v VirtualTerminalLevel /t REG_DWORD /d 1)

To deactivate it:

in registry key [HKEY_CURRENT_USERConsole], create or set the VirtualTerminalLevel DWORD value to 0.



You must open a new console window for changes to take effect.

For example use the ANSI color when debugging:
(trace-highlight "27[0;31m" "27[0;0m") ;red text color
(trace-highlight "27[0;7m" "27[0;0m")  ;negative

cameyo
#179
newLISP in the real world / Re: factor-group function
January 31, 2019, 08:47:03 AM
I forgot to add the inverse function:


(setq fg (factor-group 220))
;-> ((2 2) (5 1) (11 1))


(setq num-fg (apply * (map (lambda (x) (pow (first x) (last x))) fg)))
;-> 220


cameyo
#180
newLISP newS / Re: Ask info about newLISP
January 07, 2019, 10:55:33 PM
Thanks for info and for your work.



cameyo