Search found 228 matches

by ralph.ronnquist
Thu Oct 15, 2015 12:28 pm
Forum: newLISP in the real world
Topic: leave-string: any idea for simplifying?
Replies: 4
Views: 6557

Re: leave-string: any idea for simplifying?

Not really simpler, but the negative index case would be slightly shorter with the following.

Code: Select all

((length 0 pos str) str)
by ralph.ronnquist
Sun Sep 27, 2015 5:09 pm
Forum: newLISP in the real world
Topic: [patch] system variables $main-args-load-ix, $load-list
Replies: 9
Views: 10144

Re: [patch] system variables $main-args-load-ix, $load-list

As I see it, the argument for addressing this part of the interpreter is to make it possible to build a generic modularization support framework that avoids everyone having to hard code the modularization into every application. I think the support needs from the interpreter includes the two discuss...
by ralph.ronnquist
Mon Sep 21, 2015 8:42 am
Forum: newLISP in the real world
Topic: script dir detection: any ideas for improvement?
Replies: 7
Views: 7930

Re: script dir detection: any ideas for improvement?

Since some while ago, I tend to package up my newlisp programs into tar files, and then install a newlisptar binary (embedding lsptar.lsp) at the production places. It's easy enough to set up a Makefile to collate various files into temporary local files for packing them into the tar appropriately. ...
by ralph.ronnquist
Sat Sep 19, 2015 10:33 am
Forum: Anything else we might add?
Topic: Functional programming - permutations
Replies: 23
Views: 37500

Re: Functional programming - permutations

Right. Yes, as far as I can work it out, it really appears to be due to something deteriorating when the distance between consecutive free cells grows. I simplified the testing code down to the following (though I'm sure there are better ways): (and (setf A (sequence 1 20000000)) true) (dotimes (j 1...
by ralph.ronnquist
Fri Sep 18, 2015 7:22 am
Forum: Anything else we might add?
Topic: Functional programming - permutations
Replies: 23
Views: 37500

Re: Functional programming - permutations

I've been time testing permutations function above, using the expression: (time (permutations (sequence 1 10))) The funny thing is, that when repeating this a number of times, the time goes up some 100 ms on each test. For example, for the first 20 repetitions (clipped to ms), I got: 2854, 2498, 252...
by ralph.ronnquist
Thu Sep 17, 2015 2:29 pm
Forum: Anything else we might add?
Topic: Functional programming - permutations
Replies: 23
Views: 37500

Re: Functional programming - permutations

You can gain a magnitude in speed by taking some more care in avoiding copying, as in the following (define (permutations items) (if (empty? items) '() (1 items) (let ((e (cons (first items))) (n (length items))) (flat (map (fn (p (i -1)) (collect (append (0 (inc i) p) e (i p)) n)) (permutations (re...
by ralph.ronnquist
Tue Sep 15, 2015 11:13 pm
Forum: newLISP in the real world
Topic: script dir detection: any ideas for improvement?
Replies: 7
Views: 7930

Re: script dir detection: any ideas for improvement?

I understood hartrock's problem to be how to know the name of the script file currently being evaluated, without hard-coding its name into the script. There are of course a range of ways to understand this, including the ones we've solved. For example, hartrock initially refers to "the directory of ...
by ralph.ronnquist
Tue Sep 15, 2015 5:12 am
Forum: newLISP in the real world
Topic: script dir detection: any ideas for improvement?
Replies: 7
Views: 7930

Re: script dir detection: any ideas for improvement?

The following stanza at the top of a file seems to do the job, on Linux: (constant 'meself (letn ((base (format "/proc/%d/fd" (sys-info -3))) (fd ((sort (directory base)) -2))) ((exec (format "readlink -f %s/%s" base fd)) 0))) It doesn't work on Mac of course, since it doesn't have a procfs, and it ...
by ralph.ronnquist
Mon Sep 14, 2015 2:27 am
Forum: newLISP in the real world
Topic: expand-string and friends
Replies: 0
Views: 4977

expand-string and friends

Just a general note that I've updated my various newlisp modules at http://www.realthing.com.au/files/newlisp, and in particular, added "markdown" (see http://daringfireball.net/projects/markdown) processing to expand-string.

Maybe markdown could be included into newlispdoc (as well)?
by ralph.ronnquist
Tue Aug 18, 2015 11:33 am
Forum: Anything else we might add?
Topic: FOOP references [update 4]
Replies: 2
Views: 6258

Re: FOOP references

Impressive stuff. Too complex (for me) to say much about it without diving in and using it, which unfortunately would be slightly at odds with my current newlisp noosphere. Except, maybe, the random thought that with some huffing and puffing becomes the question of: why keep the state(s) of state ma...
by ralph.ronnquist
Thu Aug 13, 2015 2:57 am
Forum: newLISP in the real world
Topic: [bug][10.6.4] expansion macro rewrite fails -> workaround
Replies: 3
Views: 4568

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

Good catch. And it happens on 10.6.[23] as well.
by ralph.ronnquist
Sun Aug 09, 2015 10:23 pm
Forum: newLISP newS
Topic: UTF8 and regular expressions in newLISP
Replies: 7
Views: 11925

Re: UTF8 and regular expressions in newLISP

E.g.,

Code: Select all

> (setf b (pack "b" (+ 0xc0 0x30)))
"�"
> (regex "x" (b -1))

ERR: invalid UTF8 string in function regex
by ralph.ronnquist
Sun Aug 09, 2015 9:10 am
Forum: newLISP in the real world
Topic: failing regex options
Replies: 1
Views: 3719

failing regex options

This problem got lost in the other thread. Namely that regex does not accept option flags 128, 256 or 1024. > (regex "x" "xxx" 128) ERR: regular expression in function regex : "offset 0 unknown option bit(s) set" > (regex "x" "xxx" 256) ERR: regular expression in function regex : "offset 0 unknown o...
by ralph.ronnquist
Sun Aug 09, 2015 12:13 am
Forum: newLISP in the real world
Topic: bug in regex; option 256 error, option 32 unrespected
Replies: 14
Views: 9376

Re: bug in regex; option 256 error, option 32 unrespected

My 2 cents after looking into the code. The input buffer ( buf ) is clipped at 4096 characters, and this quite easily may result in the appearance of a composite UTF8 character being cut off at the end. Thus, since regex has its UTF8 glasses solidly stuck on, one can't apply it to buf . So I thought...
by ralph.ronnquist
Sat Aug 08, 2015 4:04 am
Forum: newLISP in the real world
Topic: bug in regex; option 256 error, option 32 unrespected
Replies: 14
Views: 9376

Re: bug in regex; option 256 error, option 32 unrespected

I think you mis-read the grouping. Try

Code: Select all

(regex "(\r|\n)$" a 0)
by ralph.ronnquist
Sat Aug 08, 2015 2:41 am
Forum: newLISP in the real world
Topic: bug in regex; option 256 error, option 32 unrespected
Replies: 14
Views: 9376

Re: bug in regex; option 256 error, option 32 unrespected

There seems to be an options check at pcre.c:4520-4524 that makes it puke on a few of the documented PCRE options. It has nothing to do with newlines or backslashes. E.g. > (regex "a" "aa" 256) ERR: regular expression in function regex : "offset 0 unknown option bit(s) set" Maybe one can just remove...
by ralph.ronnquist
Sat Aug 08, 2015 2:09 am
Forum: newLISP in the real world
Topic: bug in regex; option 256 error, option 32 unrespected
Replies: 14
Views: 9376

Re: bug in regex; option 256 error, option 32 unrespected

Hmm. This is the same for all versions 10.6.[234] that I have... options 128, 256 and 1024 contradict the documentation in that way.
by ralph.ronnquist
Wed Aug 05, 2015 10:07 pm
Forum: newLISP in the real world
Topic: date-value parameters
Replies: 3
Views: 4682

Re: date-value parameters

Great. I'll get things upgraded eventually. Meanwhile I'll use the workaround of

Code: Select all

(apply date-value (list (int "2015") 1 1))
by ralph.ronnquist
Wed Aug 05, 2015 1:34 pm
Forum: newLISP in the real world
Topic: date-value parameters
Replies: 3
Views: 4682

date-value parameters

Somewhere something changed for date-value, which now doesn't evaluate its parameters, but requires explicit ints. E.g. (date-value 2015 1 1) ; is fine, but (date-value (int "2015") 1 1) ; is not, and (date-value '2015 1 1) ; is also not accepted This changed for 10.6.3 sometime after May this year,...
by ralph.ronnquist
Sun Aug 02, 2015 2:07 am
Forum: newLISP in the real world
Topic: Rotating generator (a generator factory pattern)
Replies: 2
Views: 4038

Re: Rotating tasklet (a tasklet factory pattern)

Nice idea. I assume the 'rot in setting rotX should be 'rotX rather. Though maybe you would call these "generators" rather than "tasklets"? Or, focussing on that they provide different behaviour upon each invocation, maybe you'd call it state machine; with something for conditional branching, you'll...
by ralph.ronnquist
Sun Jul 19, 2015 9:21 pm
Forum: newLISP in the real world
Topic: why the (sub) behavior like this?
Replies: 2
Views: 4291

Re: why the (sub) behavior like this?

Maybe it has something to do with https://en.wikipedia.org/wiki/Single-pr ... int_format
Try

Code: Select all

(format "%.30f" 20000.9)
by ralph.ronnquist
Sat Jul 18, 2015 11:51 pm
Forum: newLISP newS
Topic: newLISP Development Release v.10.6.3
Replies: 30
Views: 35504

Re: newLISP Development Release v.10.6.3

Whilst I bow to your experience in these matters, TedWalter, upon reflection I support Lutz in maintaining a practical barrier for code change. Obviously it can be done in different ways, but the way it's done certainly makes newlisp stable in respect of platform features and it's practical utility ...
by ralph.ronnquist
Sat Jul 18, 2015 10:52 pm
Forum: newLISP in the real world
Topic: CGI and State
Replies: 10
Views: 7724

Re: CGI and State

Just a note, that I've updated the distribution tgz to unpack into a directory, which you cd into and type "make run". That run directory holds the Makefile, lsptar.lsp, and the application runner, which is still packed into a tgz, and it unpacks like before into the several sub directories. In addi...
by ralph.ronnquist
Sat Jul 18, 2015 12:22 am
Forum: newLISP in the real world
Topic: CGI and State
Replies: 10
Views: 7724

Re: CGI and State

Good point. I'll fix the tar. Thanks. No, ranwar doesn't use -http mode, but rather implements the front-end itself. This is in order to allow multiple concurrent control connections as well as multiple concurrent client connections. Its built-in (configurable) limit says at most 10 concurrent reque...
by ralph.ronnquist
Fri Jul 17, 2015 11:39 pm
Forum: newLISP newS
Topic: newLISP Development Release v.10.6.3
Replies: 30
Views: 35504

Re: newLISP Development Release v.10.6.3

I'd be happy to learn (more) about git, and fwiw in full support for this.

And I can set you up with a remote armv7 build environment if you like.
Currently with Ubuntu 12.04 but that can be flexible.

Then there's also the Android variant(s) to hopefully be included as mainstream.