I'm in a class reviewing various languages and we're building a text parser with Lisp. I can get my Lisp program to do lots of different functions with numbers but I'm struggling with text. I want to just peek at the first character in a line to see if it contains a < then do something, but I can't seem to figure out how to go about this simple task. Here's my simple little code so far:

;;;Sets up the y.xml file for use (setq file (open "c:\\temp\\y.xml")) ;;;Just reads one line at a time, (jkk file) (defun jkk (x) (read-line x) ) ;;;Reads the entire file printing each line, (loopfile file) (defun loopfile (x) (loop for line = (read-line x nil) while line do (print line)) )

This next part I tried to combine the loop with an if statement to see if it can find "<" and if so just print that line and skip any others which doesn't work. Any help with doing this really easy task would be greatly appreciated. Never used Lisp or any other functional language before, I'm used to using functions like crazy in my VB and Java projects but I don't have any decent reference materials for Lisp.

After this program is done we don't have to mess with Lisp anymore so I didn't bother to order anything. Trying Google Books.. starting to figure stuff out but this language is and old and tough one!

;;;Reads the entire file printing the line when < is found (defun loopfile_xml (x) (loop for line = (read-line x nil) while line do ( if(char= line "<") (print line) ) ) )

Thanks guys