Menu

Show posts

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 Menu

Messages - Excalibor

#1
Whither newLISP? / Modern LISP and newLISP on reddit
October 06, 2009, 01:03:46 AM
Hi,



A reddit user asked what's a good, modern LISP to learn and among the usual cruft about Common Lisp (which is cool) came Scheme (flavours), Clojure, Rebol (surprising, but it's actually quite cool, shame on licensing) and newLISP.



As usual, our newlispers have been downvoted, so after 'rescuing' them, i think some good things can be said over there so it takes some notice?



http://www.reddit.com/r/programming/comments/9qzm5/whats_a_good_modern_lisp_to_learn/">http://www.reddit.com/r/programming/com ... _to_learn/">http://www.reddit.com/r/programming/comments/9qzm5/whats_a_good_modern_lisp_to_learn/



laters!
#2
Whither newLISP? /
July 02, 2009, 06:45:33 AM
Hi there,



the database you are describing reminds me to nosql (not the current, famous one) an ascii text based relational database which used perl scripts for the operations, and files for tables... it was pretty interesting, because you needed zero sql to do all the usual relational db chores.



as for your problem, which being a perlite myself I understand pretty well, brings to mind a couple of ideas which may be feasible (i don't actually know and i'm afraid i'm not good enough to even try them at the moment, leaving time aside, although i'm soon going on holiday and without internet I may use some time to hack some programs away :-)



one is ropes, which has recently resurfaced on reddit, which is storing text in binary trees instead of arrays. it allows for some really neat things.



the other one is Scheme promises. Ideally you would want to get the first match of your search and a promise to get more if you insist on it.



; WARNING: fictional Scheme code in here, don't try at home
(define mymatch
  (lambda (rope)
    (cons (force (match "[ATCG]{3}" (first rope))))
             (delay (match "[ATCG]{3}" (rest rope))))))


for the adequate definitions of match, first and rest. Or just doing a depth-first tree travesal of the rope, step by step.



let's imagine:



 - we have the string adn.



 - in one go we transform it into a rope that



 * matches the search terms and



 * returns a match and a promise to keep matching on the rest of the rope



It's then just a matter of walking on this at the appropiate steps...



I'm not saying this is efficient or even feasible, although I suspect promises would be pretty easy in newLISP, I have thought about implementing them (maybe they are even out there and me not knowing!) but it seems easy, for an open enough definition of easyness, and ropes are, by default, pretty efficient and, well, they are trees... :-)



(Actually, a rope implementation in newLISP ishould work nicely with red-black trees, and considering they are by definition inmutable, work nicely with ORO, mmm, what an idea... ;-) )



I can imagine the trouble of getting this huge string on memory and not being able to efficiently manage to chunk it (e.g. ADN strips) but the overhead of being a rope instead of an array seems reasonable, and the benefits could be great; as for promises, it's one of the best ways to implement lazy streams on eager languages I have ever seen, so it may be worth a try.



Even another approach, again it may be worthless, would be treating the string like a linked list. Using promises you can store indexes to the elements you have already found, and the tail would be a promise to keep advancing through the list. Again, considering anything you do on the list would be, at least, O(N), it does seem efficient enough, right? It's like a flexible, lazy splice'ing of the list...



well, I've written on the spot, because I'm stuck at work and needed to vent, please don't take any nonsense as personal :-)



good luck!
#3
newLISP newS /
June 15, 2009, 03:27:50 PM
Lutz,



Sounds really enticing, can't waitto get the new version a documentation!



As for threading, I guess I was really thinking about fork() emulation under Windows... If native threads are the way to go, maybe a windows guru could provide a test implementation so we can use Cilk and concurrent code going really parallel under windows? I have several unix machines for real work, but my developing workstation is a windows xp box... I wonder if cygwin already provides this? maybe I should try to compile newlisp with cygwin and see...



anyway, I can't wait for Monday to arrive :-)



thx
#4
newLISP newS /
June 14, 2009, 01:35:32 PM
Lutz,



Sounds cool, indeed!



Anyway, lots of changes for the new release, it'll surely be worth the upgrading!



Once question, though. I know that Windows, not having fork(), it's a hindrance for multiprocess... Any possibility of having pseudo-fork support on Windows by using threads of some kind? (posix or green threads, for example?)
#5
Whither newLISP? /
June 09, 2009, 12:21:46 PM
Lutz,



Thanks for your reply. Yeah, I see the Cilk abilities as a huge step forward, and it's something I'd really like to esplore with calm and joy (which means I haven't been able to do anything less that a quick glance at them).



My question was more in the interpreter line. I mean, when I launch newlisp on my "dual"-core netbook, it's one of the processor that gets fired up, not both of them. I'd like to see how it behaves using spawn or Cilk, but I was wondering if there's anything (or the possibility) for the interpreter itself to see that a certain code can be launched in several cores at once and do so.



I'm afraid I cannot show any examples out of my head right now, but the same way an optimizer can unroll loops, or you can do tail call optimization if feasible (I mean, it can be done, not that newlisp does or should do) maybe there was someway to autoparallize some parts of a certain code automagically.



I don't really know how difficult this may be (I mean, I know it is a very hard problem, but not how hard it can be, either in general nor in newlisp in particular), but Steele's paper and what he said about a linked list being essentially sequential got me to thought if there's anything inherently sequential in newlisp, and if there's maybe anything (hashes? dunno....) parallelizable as well (as it uses red-black trees under the hood, and so on...)



It's not that it can't be done with the tools we already have, but if there's anything on the language and its implementation that's already (or about) to be ready for multicore... I'll leave multinode aside, as I understand distributed computing a different (although not necessarily by a large amount) a slightly different problem.



Of course, if the interfaces are high enough level, multicore and multinode can be just seeen as the same problem, but I was wondering if I have nodes A and B doing things, and each node has a multicore, how can messages from node A to B be fired up and use the available cores in B without previous knowledge of those multicores as new nodes.



Maybe I'm doing a simple question in a twisted way...



Anyway, you have reminded me of Cilk, and it's a good exercise for me to learn, so doubly thanks!



laters,
#6
Whither newLISP? / Parallelism and newLISP
June 05, 2009, 02:12:17 PM
Greetings!



I'm sure many of you have read Guy Steele's recent article about multicore, parallel programming...



If you have not, here's the link to the PDF file: http://groups.csail.mit.edu/mac/users/gjs/6.945/readings/MITApril2009Steele.pdf">http://groups.csail.mit.edu/mac/users/g ... Steele.pdf">http://groups.csail.mit.edu/mac/users/gjs/6.945/readings/MITApril2009Steele.pdf



The thing is, he splicitely mentions linked lists as being conceptually sequential and thus hardly parallelizable (this is, traditional LISP lists) and exposes some interesting tree proposals as parallelization strategies (not that I have been able to understand everything at a first glance, and I haven't been able to really read the article stopping where things get hairy).



Anyway... I was wondering how's newLISP ready for the multicore future (coincidentally this netbook of mine presents itself as a dual-core CPU, I think it's because Linux is treating hyperthreading as multicore... anyway, maybe Intel's Atom is dual core, I dunno, and I don't really care right now :-P ---)



This is just for the sake of discussion and planning... I did some useful scripts in newLISP at work and it may become my second tool for some more, after Perl, and some of those will do some really heavy string comparison magic, so I was wondering how to parallelize them to be able to take HP Blade's dual-core with hyperthreading presenting themselves as 4-core machines... :-)



I am thinking that I may divide the search space so I can launch 4 parallel processes at once, and thus saving, surely, lots of time designing the algorithms, but I thought that asking you guys may be very wise nevertheless... :-)



Anyway, thanks for your thoughts!
#7
Anything else we might add? /
May 17, 2009, 10:15:41 AM
Done :-)



http://sourceforge.net/community/cca09/nominate/?project_name=newLISP&project_url=http://www.newlisp.org/">



best of luck!
#8
newLISP newS /
April 02, 2009, 02:23:01 AM
Quote from: "newdep"very nice kazimir ! -> http://www.instprog.com/Instprog.default-library.lsp">//http://www.instprog.com/Instprog.default-library.lsp



perhpas 'nice' is an understatement here ;-)


Agreed! I already use it and abuse it, so thanks for the great work.



Now, returning to supernatural symbols, I think I get the idea...  It's interesting, though, as it came to my mind this could be used to make functions that shape themselves at evaluation time depending on outside knowledge (via (symbols)) at the moment of evaluation... Maybe it's a silly idea, but it could allow not just self-mutating functions, but also evolutionary ones?



Just a quick thought...



When's your next blog entry coming? :-)



laters and thanks!
#9
newLISP in the real world /
March 26, 2009, 08:16:12 AM
Quote from: "Lutz"Package making scripts for UBUNTU debian Linux, Mac OS X and Win32 are already part of the source distrubution.


Ah, cool, I didn't know... I'll try compiling on my lpia based Mini Dell and let you all know...



thx!
#10
newLISP Graphics & Sound / Problem with newLISP-GS
March 26, 2009, 08:14:15 AM
Greetings,



I dunno if this is common to all platforms, but I have particularly noticed in my windows machine at work:



I run newLISP-GS, hack around, leave it open and when I come back the next day (the machine has tasks to do during the night, so it's on during the week) my newLISP-GS session is gone.



As I usually prefer using gVIM and a shell for development, I only use newLIPS-GS for the convinience when testing functions or ideas, so I don't really know if I have lost any data. I did lost, however, my hacking session, which is not bad but it's annoying, unless it's saved somewhere else I don't know about...)



Can anyone confirm this behavior? If so, can be fixed? A /tmp/ buffer file like in VI could be nice for this kind of happenings... it would provide a recovery option, or at least something similar...



Anyway, I just thought I'd let you know, for future releases...



Also, if I can get some free time, I'll try to check the sources myself, but even then I won't promise any result :-)



thanks!



PS- posted inadvertently on the Unixen forum, moved here as fast as I could.
#11
newLISP in the real world /
March 26, 2009, 07:27:05 AM
Yup! Tested on both GNU/Linux and in Windows, like a charm.



Lutz, is there any chance to permanently add the Debian-packaging  information related to newLISP to the sources? That would allow us to use newdep's script and then make a package to install on Debian-like GNU/Linux distributions (like mine :-)



Anyway, it's cool, thanks a lot.
#12
Whither newLISP? / Re: (but-last) ?
March 25, 2009, 07:01:05 AM
Quote from: "xytroxon"Time for newLISP's implicit indexing to come to the rescue!!! ;)



...



(drop-last '("http" "example.com" "path" "to" "files" "file1.html"))
-> ("http" "example.com" "path" "to" "files")


Yeah, it's actually something that doesn't easily arise just by browsing the functions index when reading the documentation... That's why I was proposing an alias, so it's easier to find just by looking... Implicit is cool, but for newbies, explicit is better :-)



thanks anyway!
#13
Whither newLISP? /
March 25, 2009, 06:41:28 AM
Quote from: "cormullion"I'm not sure I'd consider such an easy to do task worthy of a new function all of its own ... most is quite fun, but a bit vague for some, perhaps.



but-first and but-last would be symmetrical alternatives.


QuoteThe truth is (chop) is not an intuitive name for this task, even when it's covered by it.


Well it's quite a good name for the task. in many ways, just not symmetrical like first/rest/last.


Yes, please don't misunderstand me, chop is great name, and applied to strings is actually a kind of standard (at least from a Perl/PHP POV), and extending it to lists is actually just as natural...



I was just thinking that if I can make that error, someone else could do it (please don't tell me I'm the only moron around! ;-) and following the Principle of Least Surprise, I'd prefer "nicer" names, even if I will surely use implicit splitting (i don't really use first, etc on quick scripts, but I tend to use them in more permanent things, as they express the code intention in a clearer, if you'll allow me, way.



but-first and but-last would really be great as names, they are clear and predictable, once you see the others around.



Another possibility, in a different plane, would be to allow for an extra index to first, such as (first lst n) would take the first n elements... (first lst -1) would "naturally" take all the first ones but the last one... :-P



Thanks for your comments, anyway, as I can easily gather these aliases in a common library for use and abuse :-P
#14
Whither newLISP? / (but-last) ?
March 24, 2009, 07:54:31 AM
Hi there,



This is a problem that has arisen several times now in my programs (which do some heavy text file parsing)



I get a text line, (parse) it and then I need a list of tokens but the last one.



A silly example: getting the base URI from a given URI:



 "http://example.com/path/to/files/file1.html">http://example.com/path/to/files/file1.html"



There's surely a hundred ways to do this, but I simply (parse) it given all possible token separators and I get the list



("http" "example.com" "path" "to" "files" "file1.html")



I needed a simple (but-last) function to get all elements but the last one to use is some loops:



I came with different solutions, these are my favourites:


(define (but-last lst)
  (rest (rotate lst)))

(define (but-last2 lst)
  (1 (- (length lst) 1) lst))

(define (but-last3 lst)
  (chop lst))


You see, the first one is "less optimal" than the second, but it only mentions lst once and, alas, is more useful to on-the-fly generated lists . OTOH performance is not that horrible, so it's a nice hack (instead of slicing, twisting, kind of) :-)



Then, reading more into the documentation, I arrived to chop. Doh!



So...



We have an asymmetry in here:


'(this is a list)

 first    rest

 chop     last


So, maybe an alias chop = but-last, except-last, almost-all, firsts could be useful?



I mean, we have the "first" and the "rest" of a list, we could have the "firsts" and the "last"? The truth is (chop) is not an intuitive name for this task, even when it's covered by it.



In my view, the fact that newLISP treats strings and lists the same for many different kind of things is not a favor in this case. I'm thinking in the new user, because I'm a kind-of new user, and, well, you know... :-P



Anyway, your thoughts?



laters
#15
newLISP and the O.S. /
March 20, 2009, 11:06:58 AM
Well, I see... it's a generalized WIndows problem...



Thanks for the advice, Lutz, I'll surely do as you say, it should be, anyway, easy enough...



laters!