This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote from: "cormullion"Essentially I wrote a program in newLISP that tried its best to eliminate as many pieces as possible from a ChainShot game.Quote from: "itistoday"
Nice project. Perhaps you could add a GUI to it one day..!
I implemented a simple memory allocation hack:Quote from: "Fanda"
Using this approach, code readability goes down to... lets say... C/C++ ;-)))Quote from: "Fanda"
Perhaps you are looking for is some sort of associative data access. A way to access a piece of information via a key pointing to a data-value. This is what binary-trees are used for in 99% of the cases.Quote from: "Lutz"
newLISP has bult-in very fast associative data access by usage of contexts/namespaces, which internally are binary trees (the red-black kind of optiized binary tree.Quote
Here is short chapter in the manual with examples, which might help you:http://newlisp.org/downloads/newlisp_manual.html#hash">http://newlisp.org/downloads/newlisp_manual.html#hash
Lutz
Are you thinking about speed? The need for speed...?! :)Quote from: "cormullion"
I wonder how big your lists are going to be... What's the application, out of interest?Quote from: "cormullion"
(define (TREE-label tree) (tree 1))
(define (TREE-left tree) (tree 2))
(define (TREE-right tree) (tree 3))
(define (set-TREE-label tree value)
(nth-set (tree 1) value))
(set 'my-tree (make-depth-3-binary-tree))
(set-TREE-label (find-subtree my-tree 3) 2000)
(println "3: " (find-subtree my-tree 3))
(println "2000: " (find-subtree my-tree 2000))
3: nil
2000: (labeled-binary-tree 2000 () ())
(set-TREE-label (find-subtree tree 5) 2000)
(set 'my-tree (make-depth-3-binary-tree))
(println (find-subtree my-tree 3))
My second contribution is (although still in progress)Quote from: "newdep"
(load "http://www.nodep.nl/downloads/newlisp/nlist.lsp"> ")//http://www.nodep.nl/downloads/newlisp/nlist.lsp
$ newlisp http://www.nodep.nl/downloads/newlisp/worm.lsp
Oops! Wrong! It'sQuote from: "Cyril"O(n)! Very, very evil typo. Sorry, folks. And nobody have corrected me. :-(
However, none of the newLISP users from this forum are into IRC, so the channel has been quiet for most of the year.Quote from: "cormullion"
But if you like talking to yourself, it's kind of fun... :)Quote
For 'last' the optimization was never done, but is trivial to add for 9.2.9.Quote from: "Lutz"