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

Topics - alex

#1
Our friend Maurizio ask interesting question (http://newlispfanclub.alh.net/forum/viewtopic.php?f=16&t=4119">http://newlispfanclub.alh.net/forum/vie ... =16&t=4119">http://newlispfanclub.alh.net/forum/viewtopic.php?f=16&t=4119)

The question is interesting for me too.

I read Lutz answer, but it is not enough for Windows-OS.

If I have no installed JavaVM(it can be a lot of reason), how I can run newlisp-edit.lsp?

If You have answer, tell, please :-)
#2
For Windows 2000 and more You can add ONLY ONE short string before newLISP text.

Example:

file HelloWorld.cmd contain

@newlisp.exe %0 %* & goto :EOF
# begin newlisp-program
(println "Hello World!")
(exit)
# end newlisp-program
:-)



Correction 2012.02.21

First string must be
@newlisp.exe "%~f0" %* & goto :EOF

Such variant allow run HelloWorld.cmd from command line without extention ".cmd", and fix problem, when full path to HelloWorld.cmd contain spaces.
#3
newLISP and the O.S. / Exploit?
August 04, 2011, 09:55:37 AM
(define (test) (test1))
(define (my-error-handler)    
      (println "error # " (error-text (error-number)) " has occurredn"))
(error-event 'my-error-handler)
(test)

OS = Windows7 x64

newlisp = v.10.3.2



newlisp window closed without messages, but I have Windows messge about error.
#4
newLISP and the O.S. / Problem with (parse-date)
June 26, 2008, 02:03:18 AM
I use example from manual, but it not work!
newLISP v.9.3.17 on Win32 IPv4, execute 'newlisp -h' for more info.

> (parse-date "2007.1.3" "%Y.%m.%d")

ERR: invalid function : (parse-date "2007.1.3" "%Y.%m.%d")
>
#5
Anything else we might add? / packed-newlisp
December 29, 2007, 08:35:31 PM
If You feel, that file newlisp.exe

is very big for Your floppy/flash disk

(because of Your program is big too ;-)),

You can pack it by UPX.



Use
Quote
  upx.exe -oNL.exe newlisp.exe

newlisp.exe size is 207360

NL.exe      size is  82432



HAPPY NEW YEAR!

:-)
#6
Excuse me for bad English :( ,



I want give to my user possibility enter regular expresson.



How can I check, that the expression is right?



example:

> (set 'test ".?")
".?"
> (regex test "abcde")
("a" 0 1)
> (set 'test "?")
"?"
> (regex test "abcde")

regular expression in function regex : "offset 0 nothing to repeat:"
>


I want know about

  is the "test" right regular expression

before I use (regex)
#7
I have two files:

;; _test.lsp
(println (main-args))
(exit)

and

;; lsp2exe.lsp
(load "link.lsp")
(link "newlisp.exe" "_test.exe" "_test.lsp")
(exit)

and I have input/output:

S:tempnewlispbin>newlisp lsp2exe.lsp

S:tempnewlispbin>newlisp _test.lsp 1 2 3 4 5
("newlisp" "_test.lsp" "1" "2" "3" "4" "5")

S:tempnewlispbin>_test.exe 1 2 3 4 5
("_test.exe" "1" "2" "3" "4" "5")

S:tempnewlispbin>


Such difference is not good(IMHO)...



Your opinion?
#8
newLISP and the O.S. / Usage (semaphore)
August 25, 2006, 09:05:04 PM
How can I use (semaphore) in Win?

Can anibody give example?
#9
newLISP and the O.S. / Error in (replace)?
July 19, 2006, 12:57:32 PM
Microsoft Windows XP [Версия 5.1.2600]
(С) Корпорация Майкрософт, 1985-2001.

c:newlisp>newlisp
newLISP v.8.7.10 on Win32 MinGW, execute 'newlisp -h' for more info.

>  (replace "(.{1})" (dup "0" 500)  "1" 0)
"1111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111"
>  (replace "(.{1})" (dup "0" 500000000)  "1" 0)

c:newlisp>
#10
Anything else we might add? / (import) and (load)
July 08, 2006, 12:21:03 AM
Why such difference?

We can "import" only one function, but we can "load" library.

Why we can't "import/load" full library?
#11
newLISP and the O.S. / a=b(mod c)
June 19, 2006, 02:00:57 PM
I knew from my scool, that

1=1(mod 5)

6=1(mod 5)

-1=4(mod 5)

-3=2(mod 5)

and result MUST BE POSITIV !



Why in newlisp

(% -3 5) => -3

and

(mod -2 5) => -2

??
#12
Anything else we might add? / (pretty-int)
March 29, 2006, 09:31:16 AM
(pretty-int)

I wrote useful function(IMHO)
;; Transform integer to special string format(see example)
;;
;; syntax: (pretty-int num)
;; syntax: (pretty-int num delimiter)
;;
;; Example:
;;   (pretty-int 20482048) -> "20 482 048"
;;   (pretty-int 1234567890 "'") -> "1'234'567'890"
;;
(define (pretty-int num delimiter)
  (unless delimiter (setq delimiter " "))
  (trim (reverse (replace {(d{3})} (reverse (string num)) (append $1 delimiter) 0)) delimiter)
)
Can anybody propose more simple or useful variant?
#13
Anything else we might add? / (+) and (inc)
March 21, 2006, 04:03:50 AM
(+) and (inc)
newLISP v.8.8.0 on Win32 MinGW, execute 'newlisp -h' for more info.

> (setq num 2147483646)
2147483646
> (+ num 5)
-2147483645
> (inc 'num 5)
2147483651
>

Why?
#14
# About Code_Snippets:(cwd)

It can be shorter, I think:
(define (cwd) (first (exec (if (= (& 0xF (last (sys-info))) 6) "cd" "pwd"))))
[/code]
#15
newLISP newS / #offtopic: any-year.03.08 - woman day
March 08, 2006, 08:18:20 AM

#It is the simplest example of object program:
(println
[text]
I have (You must choose object!):
  1.cat
  2.dog
  3.mother
  4.wife
  5.girl-friend
[/text]
)
(read-line)
(println
[text]
Ha-Haaaaaaaaaaaa
You are winner!
You can kiss Your object!!!!!
(as addon, may be)
Press any key to continue...
[/text]
)
(read-line)
(exit)

:-)
#16
newLISP Graphics & Sound / Minimalistic IDE :-)
February 20, 2006, 05:56:43 AM

# It is example of minimalistic IDE
# (Integrated Development Environment)
# for newlisp and, may be, not only :-)
#
# You can choose Your own app-file and  
# Your own editor and define Your own
# (compile-run) function.
#
# After You save app-file in editor
# (hit Crtl-s in "notepad" for example),
# function (compile-run) compile
# and run Your application app-file. :-)
#
(set 'app-file "test.lsp")
(set 'editor "notepad")
(define (compile-run) (! (append "start newlisp " app-file)))

(println "Press Ctrl-Break to stop IDE")
(! (append "start " editor " " app-file))
(set 'filetime (nth 6 (file-info app-file)))
(while true
  (set 'newfiletime (nth 6 (file-info app-file)))
  (if (> newfiletime filetime) (compile-run))
  (set 'filetime newfiletime)
  (sleep 1000)
)
(exit)

It may be useful for small projects (IMHO) :-)
#17
newLISP in the real world / Lots of memory
February 17, 2006, 09:44:16 AM
I have archive:

E:dictenrufull>7za l enrufull.dic.dos.7z
7-Zip (A) 4.20  Copyright (c) 1999-2005 Igor Pavlov  2005-05-30
Listing archive: enrufull.dic.dos.7z

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------
2006-02-15 19:15:18 ....A     37193160     10484024  enrufull.dic.dos
------------------- ----- ------------ ------------  ------------
                              37193160     10484024  1 files

I try unpack it into memory:

(setq my-dict (exec "7za e -so E:\dict\enrufull\enrufull.dic.dos.7z"))
(read-line)  # "pause"

and in point "pause" my newlisp-program get more then 70 Mb of RAM

It is lots of memory(IMHO)

How I can avoid the problem?
#18
newLISP and the O.S. / "\n" and "\r"
February 02, 2006, 11:40:30 AM
I use WindowsXP and have simple program in file test.lsp:
(print "nnnnn")
(exit)
I run cmd.exe and execute command
newlisp test.lsp > test.txt
Then I see, that size of file test.txt is 10 and it contain

"nrnrnrnrnr"

It is normal?
#19
What are reasons, that (context) is switch?

Why (context) is not standart lisp function?

Why we use

(context 'BLA-BLA-BLA)
  ..............
(context 'MAIN)

against

(context 'BLA-BLA-BLA
  ....................
)

?
#20
Whither newLISP? / Unexpected error
December 14, 2005, 10:40:10 PM
Unexpected error. See below:
Quote
G:>newlisp



newLISP v.8.7.2 on Win32 MinGW, execute 'newlisp -h' for more info.



> (setq zzz:aaa 1)

1

> (context? zzz)

true

> (exit)



G:>newlisp

newLISP v.8.7.2 on Win32 MinGW, execute 'newlisp -h' for more info.



> (context? zzz)

nil

> (setq zzz:aaa 1)



context expected in function setq : zzz



>

It is not normal, I think.