Search found 14 matches

by ghfischer
Sat May 03, 2008 8:02 pm
Forum: newLISP newS
Topic: A custom push-assoc
Replies: 1
Views: 1956

A custom push-assoc

During the assoc discussion I came across a problem I'm sure I knew how to solve a year or two ago, but I can't figure out anymore. I know I'll only have assoc lists of the form ((a (1 2)) (b (3 4)) ...) I want to write a function like (push-assoc key value assoc-lst) The only way I could get it to ...
by ghfischer
Sun Apr 20, 2008 3:30 pm
Forum: newLISP newS
Topic: char bug?
Replies: 9
Views: 7157

I'm of the opinion that char should move from strings to integers and not introduce nil. I think the empty string is a valid special case where 0 should be returned. That being said I'm ok with char returning errors if the offset is out of bounds. I'd argue that any argument to the offset for an emp...
by ghfischer
Sat Apr 19, 2008 7:57 pm
Forum: newLISP newS
Topic: char bug?
Replies: 9
Views: 7157

A temporary patch.

In nl-string.c change line 219 from offset = adjustNegativeIndex(offset, len); to if ((offset != 0) || (len > 0)) offset = adjustNegativeIndex(offset, len); This will produce the following behavior: newLISP v.9.3.8 on OSX IPv4 UTF-8, execute 'newlisp -h' for more info. > (char "") 0 > (char "" 0) 0 ...
by ghfischer
Sun Mar 30, 2008 7:34 pm
Forum: newLISP newS
Topic: Corner case date issue in daylight savings time.
Replies: 4
Views: 3495

Good point on the apply consequence. Imagine you have a scheduled report to run at 7am every day. Since you're in a timezone that does daylight savings for a portion of the year the report should run at 7am GMT and for another portion at 8am GMT. But as a user, I don't care about any of that - I wan...
by ghfischer
Sun Mar 30, 2008 5:38 pm
Forum: newLISP newS
Topic: Corner case date issue in daylight savings time.
Replies: 4
Views: 3495

Another quick thought.

> (date (date-value) 0 "%Y %m %d %H %M %S") "2008 03 30 12 32 58" > (date (date-value 2008 3 30 12 32 58) 0 "%Y %m %d %H %M %S") "2008 03 30 07 32 58" To me these two functions should return the same value. Lutz - Perhaps you could add another option onto (date-value) syntax: (date-value int-year i...
by ghfischer
Sun Mar 30, 2008 5:11 pm
Forum: newLISP newS
Topic: Corner case date issue in daylight savings time.
Replies: 4
Views: 3495

Corner case date issue in daylight savings time.

I'm working on adding some date syntactic sugar for newlisp. Inspired by the ease of use of certain date manipulation in Ruby. During my tests I noticed what i think is an issue in some of the date routines related to offset or possibly daylight savings time. I tried to implement a newlisp version o...
by ghfischer
Wed Jan 30, 2008 8:41 pm
Forum: Anything else we might add?
Topic: Another newLISP-like language :)
Replies: 49
Views: 47394

Arc -- meh.

I read through the arc tutorial and am thoroughly unimpressed. Most of the stuff I like newLISP already has, and there's no mention of any integrated web stuff (like net-* or *-url). The one interesting feature I thought might be useful to put in newLISP is some version of Arc's uniq macro functiona...
by ghfischer
Thu Dec 13, 2007 7:05 pm
Forum: Anything else we might add?
Topic: newLisp competition 2007
Replies: 68
Views: 64931

cormullion wrote:a little too short
I also noticed that in 9.2.5 or higher I can make it even shorter! :)

Code: Select all

(define (natural-key s)
  (filter if (flat (transpose (list (parse s "[0-9]+" 0) (map int (find-all "[0-9]+" s)))))))
by ghfischer
Thu Dec 13, 2007 4:24 pm
Forum: Anything else we might add?
Topic: newLisp competition 2007
Replies: 68
Views: 64931

Better example.

Good point Lutz. I should have provided a better example. Here's the basic case > (natural-sort '("a10" "a2" "a1" "a14")) ("a1" "a2" "a10" "a14") > (sort '("a10" "a2" "a1" "a14")) ("a1" "a10" "a14" "a2") and the embedded case > (natural-sort '("i30z" "i3n" "i20n" "i18z")) ("i3n" "i18z" "i20n" "i30z"...
by ghfischer
Thu Dec 13, 2007 2:43 pm
Forum: Anything else we might add?
Topic: newLisp competition 2007
Replies: 68
Views: 64931

A short helper.

Although not a complex piece of code, the following is quite useful when you have to sort lists the way most real people think of sorting. (define (natural-key s) (set 'strs (parse s "[0-9]+" 0)) (set 'nums (find-all "[0-9]+" s)) (if nums (set 'nums (map int nums)) (set 'nums '())) (filter if (flat ...
by ghfischer
Thu Jan 04, 2007 12:21 am
Forum: newLISP newS
Topic: newLISP on Noodles with Nettles
Replies: 0
Views: 2745

newLISP on Noodles with Nettles

http://newlisp-on-noodles.org/wiki/images/3/3e/Nettlepasta.jpg I just released a module for working with the nettle cryptographic library. http://newlisp-on-noodles.org/wiki/index.php/Nettles Enjoy! PS - I haven't been able to get it to work on Mac OS X. Nettle is in Fink but there's no dylib. If a...
by ghfischer
Wed Nov 01, 2006 9:11 pm
Forum: newLISP newS
Topic: Noodles
Replies: 1
Views: 2613

Noodles

johnd and I have decided to publicly release the newLISP on Noodles wiki

http://www.newlisp-on-noodles.org

In a nutshell, we want Noodles to be the "Ruby on Rails" of newLISP.

Right now we've got a few place holders for library and module development and some tips 'n' tricks.

Enjoy.

Gord
by ghfischer
Fri Jan 13, 2006 8:02 pm
Forum: newLISP in the real world
Topic: pushing stuff
Replies: 4
Views: 4566

Use map.

Code: Select all

> (set 'a '())
() 
> (set 'b '("this" "that"))
("this" "that") 
> (map (fn(x) (push x a)) b)
("this" "that") 
> a
("that" "this") 
This will push every element in b onto a.
by ghfischer
Tue May 10, 2005 11:09 pm
Forum: newLISP in the real world
Topic: fork and sleep
Replies: 1
Views: 2578

fork and sleep

Can someone explain to me why the following code does not sleep 5 seconds? I have a hunch that a signal from the forked child invalidates the sleep - but I have no proof. (define (SleepMe x) (println "Starting...") (fork (dotimes (y 10) (println y))) (sleep (* x 1000)) (println "Why do you not sleep...