Search found 136 matches

by hartrock
Fri Aug 14, 2015 8:41 am
Forum: Anything else we might add?
Topic: add function defined?
Replies: 4
Views: 7131

Re: add function defined?

Just started with using emacros (expansion macros) here a simple solution (with limitations): > (macro (defined? V) (sym V (context) nil)) (lambda-macro (V) (expand '(sym V (context) nil))) > (defined? "var") nil > var nil > (defined? "var") var > ; but: > (defined? "V") V > ; -> because it is used ...
by hartrock
Thu Aug 13, 2015 10:45 pm
Forum: Anything else we might add?
Topic: add function defined?
Replies: 4
Views: 7131

Re: add function defined?

> (defined? 'var) ; --> nil > (set 'var nil) > (defined? 'var) ; --> true > (delete 'var) > (defined? 'var) ; --> nil This would not work, because using the symbol 'var defines it before calling the function defined? . But there is: > ;; check for var 'var > (sym "var" (context) nil) nil > ;; -> no...
by hartrock
Thu Aug 13, 2015 9:32 am
Forum: newLISP in the real world
Topic: [bug][10.6.4] expansion macro rewrite fails -> workaround
Replies: 3
Views: 4612

Re: [bug][10.6.4] expansion macro rewrite does not work

But it works with: sr@free:~/newLISP$ newlisp newLISP v.10.6.4 64-bit on Linux IPv4/6 UTF-8 libffi, options: newlisp -h > (macro (double X) (+ X X)) (lambda-macro (X) (expand '(+ X X))) > (constant 'double (lambda-macro (X) (expand '(add X X)))) (lambda-macro (X) (expand '(add X X))) > double (lambd...
by hartrock
Thu Aug 13, 2015 1:47 am
Forum: newLISP in the real world
Topic: [bug][10.6.4] expansion macro rewrite fails -> workaround
Replies: 3
Views: 4612

[bug][10.6.4] expansion macro rewrite fails -> workaround

Tried after User Manual and Reference v.10.6.4: sr@free:~/newLISP$ newlisp newLISP v.10.6.4 64-bit on Linux IPv4/6 UTF-8 libffi, options: newlisp -h > (macro (double X) (+ X X)) (lambda-macro (X) (expand '(+ X X))) > (define double (lambda-macro (X) (expand '(add X X)))) ERR: symbol is protected in ...
by hartrock
Tue Aug 11, 2015 4:19 pm
Forum: newLISP in the real world
Topic: [fr] access to (main-args) ix of script just being executed
Replies: 0
Views: 4737

[fr] access to (main-args) ix of script just being executed

Currently there is the following for guessing, which could be the script currently being executed: (context sys) ;; ;; A (scriptpath), (scriptname), (scriptargs) solution for skipping newlisp opts ;; and their args: could be a helper for getopts. ;; ;; Should be correct for typical shebang (#!/...) ...
by hartrock
Mon Aug 10, 2015 3:52 am
Forum: newLISP in the real world
Topic: case different from cond; doesn't allow "default"
Replies: 1
Views: 3663

Re: case different from cond; doesn't allow "default"

This works (from the manual): (define (translate n) (case n (1 "one") (2 "two") (3 "three") (4 "four") (true "Can't translate this"))) or this (good to use for error messages, if an unexpected condition occurs): (define (translate n) (cond ((= n 1) "one") ((= n 2) "two") ((= n 3) "three") ((= n 4) "...
by hartrock
Mon Aug 10, 2015 3:21 am
Forum: newLISP in the real world
Topic: 'choice pop' for choosing FIFO semantics after standard push
Replies: 7
Views: 7452

Re: 'choice pop' for choosing FIFO semantics after standard

Here is another patch against newlisp-10.6.4.tgz 2015-08-09 16:32 : diff --git a/newlisp.c b/newlisp.c index 55ff89b..117d27d 100644 --- a/newlisp.c +++ b/newlisp.c @@ -2151,6 +2151,35 @@ if(offset < 0) return(offset); } +void listPrelastLast(CELL * list, CELL ** pPrelast, CELL ** pLast) +{ +CELL * ...
by hartrock
Fri Aug 07, 2015 10:17 pm
Forum: newLISP in the real world
Topic: 'choice pop' for choosing FIFO semantics after standard push
Replies: 7
Views: 7452

Re: 'choice pop' for choosing FIFO semantics after standard

pop with index undoes last element optimization Here is a patch, which undoes last element optimization only if needed (against newlisp-10.6.4.tgz 2015-08-05 16:18): diff --git a/mirror/nl-liststr.c b/mirror/nl-liststr.c index a601cdd..427f7d7 100644 --- a/mirror/nl-liststr.c +++ b/mirror/nl-listst...
by hartrock
Fri Aug 07, 2015 2:04 pm
Forum: newLISP in the real world
Topic: 'choice pop' for choosing FIFO semantics after standard push
Replies: 7
Views: 7452

Re: 'choice pop' for choosing FIFO semantics after standard

Thanks for the hints. Updated cpop code : ;; best in functionality (context 'cpop) (define-macro (cpop:cpop l (ix 0)) (if (eval l) (pop (eval l) (eval ix)))) ; returns empty list, if empty list (context MAIN) ;; this has limitations, but should be faster (macro (em-cpop L (Ix 0)) ; emacro: expansion...
by hartrock
Wed Aug 05, 2015 11:09 pm
Forum: newLISP in the real world
Topic: 'choice pop' for choosing FIFO semantics after standard push
Replies: 7
Views: 7452

'choice pop' for choosing FIFO semantics after standard push

cpop stands for 'choice' pop , where the cpop is able to choose, if a standard push without ix leads to FIFO semantics on cpops side. Currently only the push has this choice of switching from standard LIFO to FIFO semantics, by push ing back using -1 ix, which is working for an empty list: on the o...
by hartrock
Wed Aug 05, 2015 12:29 am
Forum: newLISP in the real world
Topic: [fr] more symmetry between push and pop -> [fr] cancelled
Replies: 7
Views: 7891

Re: [fr] more symmetry between push and pop

There is a frequent code pattern used where you build lists or queues by always push ing to the end using the -1 index to build queues . You are creating a 0 or -1 element position. Then using pop without index until empty? . If you do not allow pushing on on an empty list at -1, code gets complica...
by hartrock
Tue Aug 04, 2015 11:10 pm
Forum: newLISP in the real world
Topic: [fr] more symmetry between push and pop -> [fr] cancelled
Replies: 7
Views: 7891

Re: [fr] more symmetry between push and pop

Let's give some additional perspective. The pusher is feeding the popper is eating, both are using a queue with LIFO; but pusher may choose poor popper has to loose, to use this as a queue with FIFO. Prenote: here standard push / pop means, doing this without ix for back/front info; which has the we...
by hartrock
Tue Aug 04, 2015 12:21 am
Forum: newLISP in the real world
Topic: [fr] more symmetry between push and pop -> [fr] cancelled
Replies: 7
Views: 7891

Re: [fr] more symmetry between push and pop

Up to version 9.2.11 when indexing lists, indices too big would pick the last element and indices to small or to negative would pick the first element in a list. For empty lists the result would be nil in a consistent fashion, e.g for pop , nth , first , last etc.. In programming practice this ofte...
by hartrock
Sun Aug 02, 2015 4:34 pm
Forum: newLISP in the real world
Topic: [fr] more symmetry between push and pop -> [fr] cancelled
Replies: 7
Views: 7891

[fr] more symmetry between push and pop -> [fr] cancelled

[Update 2] Feature request ([fr]) cancelled. There is a reason for not making (pop aList -1) as simple as (push elem aList -1) : it is performance, which degrades for longer lists, because there is a pointer forwards from each cell to its next cell in the list, but not backwards. This has implicati...
by hartrock
Fri Jul 24, 2015 8:22 pm
Forum: newLISP in the real world
Topic: get-url of empty content fails (fixed in 10.6.4)
Replies: 28
Views: 17796

Re: get-url of empty content fails

check out: http://www.newlisp.org/downloads/development/inprogress/ 2015-07-24 02:12 now always four members in list mode: header, content, http response line, status code Thank you! Result now seems to be a good compromise between: effort and improvement, and different error handling purposes. PS:...
by hartrock
Thu Jul 23, 2015 8:01 pm
Forum: newLISP in the real world
Topic: get-url of empty content fails (fixed in 10.6.4)
Replies: 28
Views: 17796

2. Update: suggestion (removed errorneous "fix")

2. Update: suggestion (removed errorneous "fix") What about putting the int status code (or nil, if there is an invalid HTTP status line) as fourth member after the HTTP server response string in "list" mode? Or is there any problem with this idea, I don't see? There already is HTTP status as an int...
by hartrock
Wed Jul 22, 2015 3:25 pm
Forum: newLISP in the real world
Topic: get-url of empty content fails (fixed in 10.6.4)
Replies: 28
Views: 17796

different error levels [Re: get-url of empty content fails]

Ps: May be newLISP shouldn't prepend and error message to an exsisting server error page at all. Perhaps the error message should only be generated when no page comes back from server after the header. Short feedback: Sounds like an improvement, because typical server behavior is to give some info ...
by hartrock
Wed Jul 22, 2015 11:57 am
Forum: newLISP in the real world
Topic: get-url of empty content fails (fixed in 10.6.4)
Replies: 28
Views: 17796

bug hunting: success! [Re: get-url of empty content fails]

Many thanks! I think it is solved now. The cpymem test clearly showed the missing zero termination of the response string in the cell. This happened for content appended to an error message. newLISP also stores the size of a memory buffer independent of string zero-termination. Because of this, the...
by hartrock
Tue Jul 21, 2015 3:39 pm
Forum: newLISP in the real world
Topic: get-url of empty content fails (fixed in 10.6.4)
Replies: 28
Views: 17796

Re: get-url of empty content fails

May be it has to do with UTF8 handling, although all my tests are fine without it. Can you compile without UTF8 and try again? Same result: sr@mad:/tmp/newlisp-10.6.4$ ./newlisp newLISP v.10.6.4 64-bit on Linux IPv4/6 libffi, options: newlisp -h > (set 't (post-url "http://localhost/ViPLab" "dummy ...
by hartrock
Tue Jul 21, 2015 3:23 pm
Forum: newLISP in the real world
Topic: get-url of empty content fails (fixed in 10.6.4)
Replies: 28
Views: 17796

bug hunting: '\0' to late in errorneous string cell content

Found interesting difference in strings (see at bottom): sr@mad:~/newLISP/BoF$ newlisp newLISP v.10.6.4 64-bit on Linux IPv4/6 UTF-8 libffi, options: newlisp -h > (set 't (post-url "http://localhost/ViPLab" "dummy content" "text/plain" "list debug")) POST /ViPLab HTTP/1.1 Host: localhost User-Agent:...
by hartrock
Tue Jul 21, 2015 9:09 am
Forum: newLISP in the real world
Topic: get-url of empty content fails (fixed in 10.6.4)
Replies: 28
Views: 17796

bug hunting [Re: get-url of empty content fails]

Bug stays with (info taken from http://www.newlisp.org/downloads/development/inprogress/) newlisp-10.6.4.tgz 2015-07-20 23:50 1.6M (dump output of differing strings added): sr@mad:~/newLISP/BoF$ newlisp newLISP v.10.6.4 64-bit on Linux IPv4/6 UTF-8 libffi, options: newlisp -h > (set 't (post-url "ht...
by hartrock
Mon Jul 20, 2015 4:49 pm
Forum: newLISP in the real world
Topic: get-url of empty content fails (fixed in 10.6.4)
Replies: 28
Views: 17796

Re: get-url of empty content fails

Bug stays with newlisp-10.6.4.tgz 2015-07-20 15:25 1.6M : sr@mad:~/newLISP/BoF$ newlisp newLISP v.10.6.4 64-bit on Linux IPv4/6 UTF-8 libffi, options: newlisp -h > (set 't (post-url "http://localhost/ViPLab" "dummy content" "text/plain" "list debug")) POST /ViPLab HTTP/1.1 Host: localhost User-Agent...
by hartrock
Mon Jul 20, 2015 2:14 pm
Forum: newLISP in the real world
Topic: get-url of empty content fails (fixed in 10.6.4)
Replies: 28
Views: 17796

Re: get-url of empty content fails

Testing with newlisp-10.6.4.tgz 2015-07-19 23:31 1.6M bug stays (first call OK, thereafter bug): newLISP v.10.6.4 64-bit on Linux IPv4/6 UTF-8 libffi, options: newlisp -h > (set 't (post-url "http://localhost/ViPLab" "dummy content" "text/plain" "list")) ("Date: Mon, 20 Jul 2015 13:51:33 GMT\r\nServ...
by hartrock
Sun Jul 19, 2015 8:56 am
Forum: newLISP in the real world
Topic: get-url of empty content fails (fixed in 10.6.4)
Replies: 28
Views: 17796

Re: get-url of empty content fails

If this happened on Windows or OS2, TRU64, Solaris or AIX, it may have been fixed: http://www.newlisp.org/downloads/development/inprogress/ There was an uninitialized buffer in a custom version of vasprintf() -> my_vasprintf() used by above OSs. No, error has been on Debian Linux. Ps: doing some mo...
by hartrock
Fri Jul 17, 2015 7:12 pm
Forum: newLISP in the real world
Topic: get-url of empty content fails (fixed in 10.6.4)
Replies: 28
Views: 17796

Re: get-url of empty content fails

Thanks for the upgrade. Unfortunately there is some problem: > ; "OK with "list": > (set 't (post-url "http://localhost/ViPLab" "dummy content" "text/plain" "list")) ("Date: Fri, 17 Jul 2015 18:37:10 GMT\r\nServer: Apache/2.2.22 (Debian)\r\nContent-Length: 17\r\nConnection: close\r\nContent-Type: te...