Example use:
CL-USER> (with-open-file (s "data")
(do ((line (read-line s nil nil)
(read-line s nil nil))
(i 0 (1+ i)))
((or (= i 10) (null line)))
(with-thread (name author id)
line
(format t "Topic name: ~A. Author: ~A. Link: ~A~%"
name author (thread-link id)))))
i tried to read it, but all i see is (((()()((())))()(())())))()(())))()))))))((()()()()()()))((((())))))))))))))()()()))))))()(((()))))))))((((()))))))()())()))))))))(((()()((())))()(())())))()(())))()))))))((()()()()()()))((((())))))))))))))()()()))))))()(((()))))))))((((()))))))()())()))))))))(((()()((())))()(())())))()(())))()))))))((()()()()()()))(((((unfun))))))))))))))()()()))))))()(((()))))))))((((()))))))()())()))))))))(((()()((())))()(())())))()(())))()))))))((()()()()()()))((((())))))))))))))()()()))))))()(((()))))))))((((()))))))()())()))))))))(((()()((())))()(())())))()(())))()))))))((()()()()()()))((((())))))))))))))()()()))))))()(((()))))))))((((()))))))()())()))))))))(((()()((())))()(())())))()(())))()))))))((()()()()()()))((((())))))))))))))()()()))))))()((((x)))))))))((((()))))))()())(y)))))))))(((()()((())))()(())())))()(())))()))))))((()()()()()()))((((())))))))))))))()()()))))))()(((()))))))))((((()))))))()())()))))))))(((()()((())))()(())())))()(())))()))))))((()()()()()()))((((())))))))))))))()()()))))))()((((myeyesarebeingraped)))))))))((((()))))))()())()))))))))(((()()((())))()(())())))()(())))()))))))((()()()()()()))((((())))))))))))))()()()))))))()(((()))))))))((((()))))))()())()))))))))(((()()((())))()(())())))()(())))()))))))((()()()()()()))((((())))))))))))))(defun)()()))))))()(((()))))))))((((()))))))()())()))))))))
Name:
Anonymous2009-10-09 10:28
>>1
Nice, WITH-THREAD is pretty suave indeed, but doesn't your implementation warn you, if you don't add a IGNORE declaration on that gensym?
Someone out to make a /prog/scrape in CL if they're bored enough.
As for parsing, I have to implement a META-like parser myself which works on S-Exps(not like there aren't a bunch already floating around, but it doesn't look very hard to do anyway): http://home.pipeline.com/~hbaker1/Prag-Parse.html
Name:
Anonymous2009-10-09 10:34
>>1
Looks like your'e programming language can't strip off trailing spaces.
Name:
Anonymous2009-10-09 10:42
>>4 but doesn't your implementation warn you, if you don't add a IGNORE declaration on that gensym?
Why would you let an implementation bloat your code? >>5
He's probably using SLIME, the trailing whitespace is a fuckup of SLIME (or rather, his fuckup way of copying text). An actual error in his code is that id is a string and (write-to-string id) should be replaced simply by 'id' (and then the links won't be broken).
Glad to see some lisp code now and then, reminds me this is a board about programming.
>>3
I find it hilarious when someone only sees parens in Lisp, but it's the natural thing for most people completly new to it to notice.
Lispers read code most of the code by indentation. I don't think it takes more than a few days to get used to it: it took me less than a week, while I read and wrote Lisp code. Nowadays, I'm very glad Lisp's syntax is made of lists: this makes so many things so much easier: macros, symbolic processing, writing your own interpreters, structured editing are all a breeze.
>>6
You can supress the warning, but I thought it's considered good style to mark variables which are meant to be ignored accordingly, but then there's as many Lisp styles as there's Lispers. The closest I can think of any written guidelines are Norvig's: http://www.cs.umd.edu/~nau/cmsc421/norvig-lisp-style.pdf
Name:
Anonymous2009-10-09 10:48
>>7
LISP = Python? I think I can understand Abelson.
Name:
Anonymous2009-10-09 10:50
>>9
The difference is that indentation in lisp aids in readability, while indentation in python gets in the way.
>>9
You read it by indentation, but the indentation isn't forced in any way: there's many ways to format your code, of course you should use your own judgement about where it would be better to break a line. The parens give the code the structure. Of course the parens are just a way to delimit lists, they're gone after READ, and your code simply becomes a list/tree or if you want a more fancy term, the code you write is an AST.