Search found 21 matches

by psilwen
Fri Jun 01, 2018 2:20 pm
Forum: newLISP in the real world
Topic: unless bug?
Replies: 1
Views: 1337

unless bug?

syntax: (unless exp-condition body) The statements in body are only evaluated if exp-condition evaluates to nil or the empty list (). The result of the last expression in body is returned or nil or the empty list () if body was not executed. newLISP v.10.7.3 32-bit on Windows IPv4/6 UTF-8 libffi, o...
by psilwen
Thu Nov 09, 2017 11:21 am
Forum: newLISP in the real world
Topic: It makes me a bit confused
Replies: 1
Views: 1106

It makes me a bit confused

Code: Select all

> (struct 'A "char*")
A
> (pack A "HELLO")
"\176\154d\000"
> (unpack A (pack A "HELLO"))
("HELLO")
> (setq a (pack A "HELLO"))
"0\154d\000"
> (unpack A a)
("\006") ; <------------
> (setq b "HELLO")
"HELLO"
> (setq a (pack A b))
"p\154d\000"
> (unpack A a)
("HELLO")
by psilwen
Wed Sep 13, 2017 5:55 am
Forum: newLISP in the real world
Topic: Why is the behavior of "trim" function so strange?
Replies: 11
Views: 3188

Re: Why is the behavior of "trim" function so strange?

trim still has bug.

Code: Select all

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

> (setq str "\xbb\xe1")
"会"
> (length (trim str))
2
> (length (trim str "\000"))
5
> (setq str "\xce\xaa\xca\xb2\xc3\xb4\xbb\xe1")
"为什么会"
> (length (trim str))
8
> (length (trim str "\000"))
11
by psilwen
Wed Aug 23, 2017 4:18 am
Forum: newLISP in the real world
Topic: Does struct support only up to 32 parameters?
Replies: 3
Views: 1493

Re: Does struct support only up to 32 parameters?

Thank you for the explanation. But the struct function used to deal with ordinary C structure is also very useful. In newLISP, we have two way to deal with C structure. The first way, with the struct , pack and unpack. The other way, without the struct, uses only pack and unpack. But the 'struct' ha...
by psilwen
Mon Aug 21, 2017 6:33 pm
Forum: newLISP in the real world
Topic: Does struct support only up to 32 parameters?
Replies: 3
Views: 1493

Does struct support only up to 32 parameters?

newLISP v.10.7.3 32-bit on Windows IPv4/6 libffi, options: newlisp -h ; 33 "char" (struct 'abc "char" "char" "char" "char" "char" "char" "char" "char" "char" "char" "char" "char" "char" "char" "char" "char" "char" "char" "char" "char" "char" "char" "char" "char" "char" "char" "char" "char" "char" "...
by psilwen
Fri Aug 18, 2017 6:09 pm
Forum: newLISP in the real world
Topic: Why is the behavior of "trim" function so strange?
Replies: 11
Views: 3188

Re: Why is the behavior of "trim" function so strange?

newLISP v.10.7.3
newLISP v.10.7.1
newLISP v.10.7.0
All have this issues.

Usually starting from 8, 16, 24, 32...., depending on the version.

But newLISP v.10.6.2,I tested from 1 to 65536, everything was fine.
by psilwen
Fri Aug 18, 2017 6:03 pm
Forum: newLISP in the real world
Topic: Why is the behavior of "trim" function so strange?
Replies: 11
Views: 3188

Re: Why is the behavior of "trim" function so strange?

newLISP v.10.7.3 32-bit on Windows IPv4/6 libffi, options: newlisp -h > (setq str (dup "\000" 8)) "\000\000\000\000\000\000\000\000" > (trim str) ERR: not enough memory in function trim > (setq str (dup "\000" 1)) "\000" > (trim str) "" > (setq str (dup "\000" 2)) "\000\000" > (trim str) "" > (setq...
by psilwen
Tue Aug 15, 2017 12:26 pm
Forum: newLISP in the real world
Topic: Why is the behavior of "trim" function so strange?
Replies: 11
Views: 3188

Why is the behavior of "trim" function so strange?

newLISP v.10.7.1 32-bit on Windows IPv4/6 UTF-8 libffi, options: newlisp -h > (setq str (dup "\000" 10)) "\000\000\000\000\000\000\000\000\000\000" > (trim str) "" > (setq str (dup "\000" 31)) "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\00 0\000\000\000\000\000\000...
by psilwen
Mon Aug 14, 2017 4:41 pm
Forum: newLISP in the real world
Topic: Is this newLISP's bug?
Replies: 4
Views: 1664

Re: Is this newLISP's bug?

I found the reason for the problem! The descriptions for the hWnd parameter of GetMessage: A handle to the window whose messages are to be retrieved. The window must belong to the current thread. If hWnd is NULL, GetMessage retrieves messages for any window that belongs to the current thread, and an...
by psilwen
Fri Aug 11, 2017 12:50 pm
Forum: newLISP in the real world
Topic: Is this newLISP's bug?
Replies: 4
Views: 1664

Is this newLISP's bug?

I created an edit window using following code: (define (import-list library flist) (dolist (fname flist) (import library (string fname)))) (define-macro (@setq %var %value) (set %var (eval %value)) (println %var " " (eval %var))) ; Constants (define IDC_TEXTBOX 1000) (define IDC_ARROW 0x7F00) (defin...
by psilwen
Tue Aug 01, 2017 3:03 pm
Forum: Whither newLISP?
Topic: why setf don't work?
Replies: 1
Views: 2358

why setf don't work?

newLISP v.10.7.1 32-bit on Windows IPv4/6 UTF-8 libffi, options: newlisp -h > (struct 'RECT "long" "long" "long" "long") RECT > (unpack RECT (pack RECT 1 2 3 4)) (1 2 3 4) > ((unpack RECT (pack RECT 1 2 3 4)) 0) 1 > (setf ((unpack RECT (pack RECT 1 2 3 4)) 0) 5) ERR: symbol is protected : RECT > (s...
by psilwen
Sat Oct 04, 2014 2:38 am
Forum: newLISP in the real world
Topic: bug? about float point number lexical analysis
Replies: 9
Views: 3757

Re: bug? about float point number lexical analysis

Are you suggesting that newLISP allow the user to enter a number of arbitrary length (as input) and then parse and store the internal representation of the number (as an exact representation of the input, i.e. arbitrarily large)? AFAIK, no programming language allows this. There are always limits. ...
by psilwen
Fri Oct 03, 2014 3:53 am
Forum: newLISP in the real world
Topic: bug? about float point number lexical analysis
Replies: 9
Views: 3757

Re: bug? about float point number lexical analysis

In version 10.6.2 up to 255 characters will be parsed in decimal numbers
This can not completely solve the problem.

Core of these issues is not the right way to parse.

When the number exceeds 255 characters, the same issue will appear again.
by psilwen
Fri Oct 03, 2014 2:10 am
Forum: newLISP in the real world
Topic: bug? about float point number lexical analysis
Replies: 9
Views: 3757

Re: bug? about float point number lexical analysis

only 32 characters are parsed for decimal number including a potential sign and the decimal point. > (length "1234567890123456789012345678901234567890.0") 42 > 1234567890123456789012345678901234567890.0 1.23456789012346e+039 0 It actually stops parsing at the first non-numeric department. The rest ...
by psilwen
Wed Oct 01, 2014 10:02 am
Forum: newLISP in the real world
Topic: bug? about float point number lexical analysis
Replies: 9
Views: 3757

bug? about float point number lexical analysis

I want convert big float point number to integer. > (int 999999999999999999999999999999999999999999.99) 9223372036854775807 I tried > (bigint 999999999999999999999999999999999999999999.99) 1000000000000000045259160000000000000000000L because of When converting from floating point, rounding errors oc...
by psilwen
Thu Aug 14, 2014 5:21 am
Forum: newLISP in the real world
Topic: (setq 'a 3), what does it mean?
Replies: 11
Views: 3915

Re: (setq 'a 3), what does it mean?

yes, sometimes some features of newlisp make me confusion. for instance, in-place modification (define (myinc) (inc 0)) (myinc) => 1 myinc = > (lambda () inc 1) (myinc) => 2 myinc => (lambda () inc 2) of course, this feature be really good. Just I've never seen in other languages. i am learning newl...
by psilwen
Tue Aug 12, 2014 6:00 pm
Forum: newLISP in the real world
Topic: (setq 'a 3), what does it mean?
Replies: 11
Views: 3915

(setq 'a 3), what does it mean?

(setq a 2) => 2
(setq 'a 3) => 3
(eval a) => 2
(eval 'a) => 2
(eval ''a) => a

(setq a 2) equivalent to (set 'a 2)
(setq 'a 3) equivalent to (set ''a 3)?
but result is:
(set ''a 3) =>
ERR: symbol expected in function set : ''a
by psilwen
Sun Jul 06, 2014 8:56 am
Forum: newLISP in the real world
Topic: how to remove all attribute-list in diference level of SXML?
Replies: 8
Views: 2831

Re: how to remove all attribute-list in diference level of S

(define (is-attr-list? THING) (and (list? THING) (= '@ (first THING)))) (define (deep-clean PREDICATE LIST) (if (not (list? LIST)) LIST (map (curry deep-clean PREDICATE) (clean PREDICATE LIST)))) > [cmd] (deep-clean is-attr-list? '("dl" (@ ("class" "codebox")) ("dt" "Code: " ("a" (@ ("href" "#") ("...
by psilwen
Sat Jul 05, 2014 12:51 pm
Forum: newLISP in the real world
Topic: how to remove all attribute-list in diference level of SXML?
Replies: 8
Views: 2831

Re: how to remove all attribute-list in diference level of S

Code: Select all

(find-all '(bananas *) data)
Very well!

This is exactly what I want! I didn't expect so simple.

Thanks for ryuo and ralph.ronnquist .

But how about to remove all attribute-list in different level of SXML?

This is more difficult, right?

What better way to do.
by psilwen
Sat Jul 05, 2014 4:22 am
Forum: newLISP in the real world
Topic: how to remove all attribute-list in diference level of SXML?
Replies: 8
Views: 2831

Re: how to remove all attribute-list in diference level of S

I waited three days, no one answered me. This forum is too deserted. okay, another question: (set 'data '((apples 123) (bananas 123 45) (bananas 123 678) (pears 7))) (assoc 'bananas data) gets (bananas 123 45) how to 'assoc' the second 'bananas' list? the question is, like this ( (li "listitem 1") (...
by psilwen
Thu Jul 03, 2014 5:39 am
Forum: newLISP in the real world
Topic: how to remove all attribute-list in diference level of SXML?
Replies: 8
Views: 2831

how to remove all attribute-list in diference level of SXML?

when a xml document has been converted to SXML, and how to remove all attribute-list of it? these attribute-lists inside diference level of SXML.