rofl that's the funniest thing I've seen all week XDrickyboy wrote:I actually can't bring myself to steal anything, unless I put the outfit on. :-)
newLisp competition 2007
Now i have a dilemma ;-)
I need to pick 2 files for the competition, not easy as there are some files/tools I like but perhpas others dont at all.
Difficult selection, for me, perhpas for you not at all. So i go for the most common divisor called "enjoyable tools" ;-)
So my First contribution is Pinballs, because of its hyphnotic infuence ;-)
(load "http://www.nodep.nl/downloads/newlisp/pinballs.lsp")
or can be found inside your newlisp distribution when using GS! ;-)

My second contribution is (although still in progress)
(load "http://www.nodep.nl/downloads/newlisp/nlist.lsp")

I need to pick 2 files for the competition, not easy as there are some files/tools I like but perhpas others dont at all.
Difficult selection, for me, perhpas for you not at all. So i go for the most common divisor called "enjoyable tools" ;-)
So my First contribution is Pinballs, because of its hyphnotic infuence ;-)
(load "http://www.nodep.nl/downloads/newlisp/pinballs.lsp")
or can be found inside your newlisp distribution when using GS! ;-)

My second contribution is (although still in progress)
(load "http://www.nodep.nl/downloads/newlisp/nlist.lsp")

-- (define? (Cornflakes))
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
Wow, I just spent some time using that to go through the newLISP files on your server, they're amazing! My favorite has to be worm.lsp!newdep wrote:My second contribution is (although still in progress)
(load "http://www.nodep.nl/downloads/newlisp/nlist.lsp")
Great job! :-D
And I love how you can load them just by using them as an argument to newlisp:
Code: Select all
$ newlisp http://www.nodep.nl/downloads/newlisp/worm.lsp
It's a .........!
Not a contribution for the newlisp competition but very well worth to be announced to the world and a very healty contribution to our family ;-)
(load "http://www.nodep.nl/downloads/newlisp/itsa.lsp")
We Enjoy ;-)
Not a contribution for the newlisp competition but very well worth to be announced to the world and a very healty contribution to our family ;-)
(load "http://www.nodep.nl/downloads/newlisp/itsa.lsp")
We Enjoy ;-)
-- (define? (Cornflakes))
-
- Posts: 394
- Joined: Wed Apr 26, 2006 3:37 am
- Location: Oregon, USA
- Contact:
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.
which returns
Based on Human Sorting
Code: Select all
(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 (transpose (list strs nums))))
)
(define (natural-sort l)
(sort l (fn (x y) (< (natural-key x) (natural-key y))))
)
(set 'foo '("i19n" "i17n" "z40" "40a" "50" "foo" "z4000" "z30"))
(natural-sort foo)
Code: Select all
("40a" "50" "foo" "i17n" "i19n" "z30" "z40" "z4000")
But doesn't the plain newLISP 'sort' do this already?
Lutz
ps: but the difference will show up with a different example:
Code: Select all
(set 'foo '("i19n" "i17n" "z40" "40a" "50" "foo" "z4000" "z30"))
(sort foo) => ("40a" "50" "foo" "i17n" "i19n" "z30" "z40" "z4000")
ps: but the difference will show up with a different example:
Code: Select all
(set 'foo '("i19n" "i17n" "z40" "40a" "50" "foo" "z4000" "z80"))
; natural sort
("40a" "50" "foo" "i17n" "i19n" "z40" "z80" "z4000")
; plain sort
("40a" "50" "foo" "i17n" "i19n" "z40" "z4000" "z80")
Better example.
Good point Lutz. I should have provided a better example.
Here's the basic case
and the embedded case
Of course there's always the edge cases ...
To me having the zero first seems better. But to most non-programmers it doesn't. Hopefully whatever you're sorting in this case will have consistency on leading zeroes.
Here's the basic case
Code: Select all
> (natural-sort '("a10" "a2" "a1" "a14"))
("a1" "a2" "a10" "a14")
> (sort '("a10" "a2" "a1" "a14"))
("a1" "a10" "a14" "a2")
Code: Select all
> (natural-sort '("i30z" "i3n" "i20n" "i18z"))
("i3n" "i18z" "i20n" "i30z")
> (sort '("i30z" "i3n" "i20n" "i18z"))
("i18z" "i20n" "i30z" "i3n")
Code: Select all
> (natural-sort '("i1" "i03" "i5"))
("i1" "i03" "i5")
> (sort '("i1" "i03" "i5"))
("i03" "i1" "i5")
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
I also noticed that in 9.2.5 or higher I can make it even shorter! :)cormullion wrote:a little too short
Code: Select all
(define (natural-key s)
(filter if (flat (transpose (list (parse s "[0-9]+" 0) (map int (find-all "[0-9]+" s)))))))
Folks,
It's time for my contribution: a comicbook reader.
It is able to handle .cbr, .cbz and .rar formats, reads JPG, PNG and GIF files. Written with GTK-server because I am porting the newlisp code to another language as well.
Runs in Unix/Linux/Win32. Users of the infamous Win32 platform need to download 'unzip.exe' and 'unrar.exe' separately. See the header of the program for details.
Free comicbooks can be obtained from FlashbackUniverse, FreeComicBooks and many other places, including torrentsites (if you have the original copy yourself, of course ;-) )
The code is here: http://www.turtle.dds.nl/newlisp/comic.lsp
The corresponding configfile here: http://www.gtk-server.org/gtk-server.cfg
This is a screenshot of the program running in windowed mode, after pressing the right mouse button:

The program also handles key events. Pressing the <SPACE> key moves forward to the next page, also <CURSORRIGHT>. The <CURSORLEFT> moves back, and with the 'F' key fullscreen mode can be toggled on or off.
Enjoy!!!
It's time for my contribution: a comicbook reader.
It is able to handle .cbr, .cbz and .rar formats, reads JPG, PNG and GIF files. Written with GTK-server because I am porting the newlisp code to another language as well.
Runs in Unix/Linux/Win32. Users of the infamous Win32 platform need to download 'unzip.exe' and 'unrar.exe' separately. See the header of the program for details.
Free comicbooks can be obtained from FlashbackUniverse, FreeComicBooks and many other places, including torrentsites (if you have the original copy yourself, of course ;-) )
The code is here: http://www.turtle.dds.nl/newlisp/comic.lsp
The corresponding configfile here: http://www.gtk-server.org/gtk-server.cfg
This is a screenshot of the program running in windowed mode, after pressing the right mouse button:

The program also handles key events. Pressing the <SPACE> key moves forward to the next page, also <CURSORRIGHT>. The <CURSORLEFT> moves back, and with the 'F' key fullscreen mode can be toggled on or off.
Enjoy!!!
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
I do not own a Mac so I cannot support MacOSX.... sorry! If you want me to support MacOSX, please donate €600,= so I can buy one :-)Runs in Unix/Linux/Win32.
From your error it seems newLisp is unable to load the GTK-server DLL. Did you compile it from scratch? It should be possible to run GTK on MacOSX, but again, I have never tested it myself...
Peter
There is a long drawn out procedure to compile the GTK libraries for the Mac (natively, not X-Windows) and I tried it twice, but never could get it to work.
Before OS X 10.5 Leopard, there was a rumor that GTK would ship with Mac OS X, but unfortunately this did not come true.
Lets just hope then one day GTK offers binaries for OS X, just like they do for Windows.
Lutz
Before OS X 10.5 Leopard, there was a rumor that GTK would ship with Mac OS X, but unfortunately this did not come true.
Lets just hope then one day GTK offers binaries for OS X, just like they do for Windows.
Lutz
That's true! I fully agree :-)You have to admit that's the best "something's wrong" post ever, no matter what the problem is...
Indeed, I hope so too... as soon as it happens I'll support MacOSX as well.Lets just hope then one day GTK offers binaries for OS X, just like they do for Windows.
Cheers
Pete
Competition rules?
I am just curious what the word "involved" means. Does my newLISP syntax highlighting mode for Vim (written in vimscript) qualify? Not that I am pretending to be a winner, but may I at least enter the competition with this contribution?as long as the newlisp language is involved
With newLISP you can grow your lists from the right side!
So, let me start. My first contribution is newlisp.vim -- the newLISP syntax highlighting plugin for the Vim text editor. You can load it...Oops! You don't need to load anything, it is already on you computer: look into 'util' subdirectory of your newLISP installation. Russians have came! ;-) But, is you insist, it is script #2067 at the Vim site.newdep wrote:Sure...you may post anything (upto 2 contributions..etc..)
My second contribution is vidirect.lsp -- a small script that helps to download videos from sites like YouTube and some others. It is small because it does nothing by itself: it queries the site vidirect.ru to obtain the downloading url, it runs wget (windows version) to perform download, it even works with windows clipboard with an external program. Unfortunately the documentation is in Russian language -- the script is targeted not to lisp hackers, but to end users. The full distribution (source, binary, Russian documentation, two accompanying third-party programs) is here, and the source alone is here. Enjoy!
With newLISP you can grow your lists from the right side!
For Win32 users I made a ZIP package with the full application.
Installation:
1) Install a GTK Runtime Environment from here or here (either one will do).
2) Unzip the ZIP file in a directory of your choice.
It is assumed you have the newlisp binary in your PATH, and if not, copy it to the same directory.
Now run 'comic.exe' and enjoy!
Peter
Installation:
1) Install a GTK Runtime Environment from here or here (either one will do).
2) Unzip the ZIP file in a directory of your choice.
It is assumed you have the newlisp binary in your PATH, and if not, copy it to the same directory.
Now run 'comic.exe' and enjoy!
Peter
Here's my contribution for this year (windows only):
http://hpwsoft.de/anmeldung/html1/newLI ... test07.php
(I am not ready in time, so I post what I have so far.)
;-(
(Project is far bigger than last contribution, so newLISP in heavy duty)
Merry christmas to all newLISP'ers!
Edit: The fact that I can not publish the source is that it contains technical and price data of my employer.
(I get a special permit from Lutz to do so. Thanks to Lutz!)
http://hpwsoft.de/anmeldung/html1/newLI ... test07.php
(I am not ready in time, so I post what I have so far.)
;-(
(Project is far bigger than last contribution, so newLISP in heavy duty)
Merry christmas to all newLISP'ers!
Edit: The fact that I can not publish the source is that it contains technical and price data of my employer.
(I get a special permit from Lutz to do so. Thanks to Lutz!)
Last edited by HPW on Tue Dec 18, 2007 9:33 pm, edited 1 time in total.
Hans-Peter