Search found 44 matches

by lyl
Mon May 13, 2019 12:28 am
Forum: newLISP and the O.S.
Topic: Compile script to .exe with attached files
Replies: 8
Views: 9801

Re: Compile script to .exe with attached files

Thank you @HPW. My description in the post made my query not clear. I just modified it. Would you please have look at it?
by lyl
Sun May 12, 2019 1:16 pm
Forum: newLISP and the O.S.
Topic: Compile script to .exe with attached files
Replies: 8
Views: 9801

Compile script to .exe with attached files

Source code and the newLISP executable can be linked together to build a self-contained application by using the -x command line flag. My script file(named "0.lsp" in Windows sys) contains the following code at the begining: (load "1.lsp") (load "2.lsp") So in this condition how to use "newlisp -x"...
by lyl
Sat May 04, 2019 2:35 pm
Forum: newLISP and the O.S.
Topic: How to run a dos command in win7 console by newlisp
Replies: 2
Views: 3193

Re: How to run a dos command in win7 console by newlisp

Perfect explanation! I learn a lot. Many thanks!
by lyl
Fri May 03, 2019 11:51 am
Forum: newLISP and the O.S.
Topic: How to run a dos command in win7 console by newlisp
Replies: 2
Views: 3193

How to run a dos command in win7 console by newlisp

I want to run the dos command in win7 console by newlisp "exec" to clear secreen like this:

Code: Select all

(exec "cls")
but fails with a feedback ("\f").
Why? And how to deal with this?

PS: Also

Code: Select all

 (exec "color 0b") 
does not work.
by lyl
Sat Apr 27, 2019 11:07 pm
Forum: newLISP in the real world
Topic: difference result by eval in macro and in S-expr
Replies: 5
Views: 4976

difference result by eval in macro and in S-expr

I think the following two examples say the same thing, but they give different results, why?

Example No. 1:

Code: Select all

(define-macro (m lst)
  (eval lst))
(m '(+ 4 5)) ;; -> (+ 4 5)
Example No. 2:

Code: Select all

(eval '(+ 4 5)) ;; -> 9
by lyl
Thu Apr 25, 2019 8:00 am
Forum: newLISP in the real world
Topic: slice with negative "int-length"
Replies: 5
Views: 3966

Re: slice with negative "int-length"

@rickyboy Really really appreciate your works on my post and your valueable suggestions!!
by lyl
Wed Apr 24, 2019 2:06 pm
Forum: newLISP in the real world
Topic: slice with negative "int-length"
Replies: 5
Views: 3966

Re: slice with negative "int-length"

Thank you so much for your help @rickboy!! I learned a lot from you. Based on your idea, I construct "myslice" as below: (define (myslice xs idx (len (if (< idx 0) (- idx) (- (length xs) idx)))) (if (or (>= idx (length xs)) (< idx (- (length xs)))) (if (list? xs) '() (string? xs) "") (begin (setq id...
by lyl
Tue Apr 23, 2019 8:46 am
Forum: newLISP in the real world
Topic: slice with negative "int-length"
Replies: 5
Views: 3966

slice with negative "int-length"

I don't quite understand how the function slice works with negative "int-length" . The following example comes from the manual: (slice '(a b c d e f) 2 -2) → (c d) As explained in manual: If int-length is negative, slice will take the parameter as offset counting from the end and copy up to that off...
by lyl
Sun Apr 21, 2019 12:41 am
Forum: newLISP in the real world
Topic: Get a frame of lines from a table by filter
Replies: 1
Views: 3254

Get a frame of lines from a table by filter

I have a table like this: (setq lst '(("header1" "header2" "header3") ( "11" "12" "13") ("21" "22" "23") ("31" "32" "33") ("41" "42" "43" ))) I want to get some continueous lines e.g. from the first line to the third line by this: (filter (and (>= $idx 1) (<= $idx 3)) lst) ;; '(( "11" "12" "13") ("2...
by lyl
Sat Dec 22, 2018 12:43 pm
Forum: newLISP in the real world
Topic: anti-select elements of a list
Replies: 9
Views: 5911

Re: anti-select elements of a list

Many thanks all of you for these beautiful solutions!!
by lyl
Sat Dec 22, 2018 1:18 am
Forum: newLISP in the real world
Topic: anti-select elements of a list
Replies: 9
Views: 5911

Re: anti-select elements of a list

@fdb '(1 2) in my example means the position of elements in lst, not elements themselves. I think I give a poor example.
by lyl
Fri Dec 21, 2018 2:45 pm
Forum: newLISP in the real world
Topic: anti-select elements of a list
Replies: 9
Views: 5911

Re: anti-select elements of a list

Here is a solution (probably not the only one, nor the best) : newLISP v.10.7.5 64-bit on Linux IPv4/6 UTF-8 libffi, options: newlisp -h > (select '(0 1 2 3 4) (difference (index true? '(0 1 2 3 4)) '(1 2))) (0 3 4) > ;; maybe clearer: > (let (lst '(0 1 2 3 4)) (select lst (difference (index true? ...
by lyl
Fri Dec 21, 2018 3:08 am
Forum: newLISP in the real world
Topic: non-ascii characters in path?
Replies: 1
Views: 2649

non-ascii characters in path?

I have the following files in a directory: - newlisp.exe (newlisp v10.7.4(Win64-UTF8)) - main.lsp - 01-寻找当前目录下是否有所需文件.lsp In the main.lsp, the first line of code is: (load "01-寻找当前目录下是否有所需文件.lsp") When I run " newlisp main.lsp " in this directory of console, error message given: ERR: problem accessi...
by lyl
Fri Dec 21, 2018 2:18 am
Forum: newLISP in the real world
Topic: anti-select elements of a list
Replies: 9
Views: 5911

anti-select elements of a list

The function "select" can be used to select multi-elements of a list at one time, for example: (select '(0 1 2 3 4) '(1 2)) ->(1 2) Yet what I want is to get all elements other than those "selceted", that is to say, I want to obtain (0 3 4) from above example. I tried with the function "filter" like...
by lyl
Mon Dec 10, 2018 1:11 pm
Forum: newLISP in the real world
Topic: abbreviation of arguments in function
Replies: 4
Views: 3489

Re: abbreviation of arguments in function

cameyo wrote:

Code: Select all

(define (f converse-rate-list)
  (local (rate) (setq rate converse-rate-list))
)
I am almost sure that this is not what you are searching for... :-)
cameyo
I'd like to have a try this. Thank you.
by lyl
Mon Dec 10, 2018 1:08 pm
Forum: newLISP in the real world
Topic: abbreviation of arguments in function
Replies: 4
Views: 3489

Re: abbreviation of arguments in function

@rickyboy What? Newlisp has a elisp style? It's a supprise!
by lyl
Sun Dec 09, 2018 8:44 am
Forum: newLISP in the real world
Topic: abbreviation of arguments in function
Replies: 4
Views: 3489

abbreviation of arguments in function

To understand the meaning of function arguments, I give there arguments long names. However, it's so boring to use these long names in function body. I ttied like this: (define (f converse-rate-list (define rate converse-rate) ) body in which "rate" instead of converse-rate-list is use....) But it f...
by lyl
Fri Dec 07, 2018 1:22 am
Forum: newLISP in the real world
Topic: string evaculat in (if ...)
Replies: 2
Views: 2721

Re: string evaculat in (if ...)

@TedWalther
I'm very sorry. Now it does work and get the result I want.
I don't know why? Maybe I make some mistake?
newLISP-10.7.1 I use in Win7.
And many thanks for your prompt response!!
by lyl
Fri Dec 07, 2018 1:04 am
Forum: newLISP in the real world
Topic: string evaculat in (if ...)
Replies: 2
Views: 2721

string evaculat in (if ...)

Here is my code:

Code: Select all

(setq file-name-extension ".csv")
(if file-name-extension file-name-extension "")
I think the "if" expression should return a string ".csv", but I get nil.
Why is file-name-extension in the true part of the "if" expression not evaculated?