parsing input
Hi Alex, I read a line, which looks something like: 01/02/2009 30.00400.00tRandall Dow in which the fields are separated by a varying number of spaces. That gets put into L, and then I delete the NILs that come from multiple spaces. Do you have a suggestion for a better way than this: (let L (mapcar pack (split (line) )) (loop (NIL (memq NIL L)) (setq L (delete NIL L)) ) Regards, - Rand -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: parsing input
Hi Randall, I read a line, which looks something like: 01/02/2009 30.00400.00tRandall Dow in which the fields are separated by a varying number of spaces. That gets put into L, and then I delete the NILs that come from multiple spaces. Do you have a suggestion for a better way than this: (let L (mapcar pack (split (line) )) (loop (NIL (memq NIL L)) (setq L (delete NIL L)) ) not sure how do you use the parsed fields but what about something like: (use (@A @B @C @D @E) (when (match '(@A @B @C @D @E) (line)) (mapcar clip (list @A @B @C @D @E)) ) ) will return the five fields in a list without the delimiting spaces. Cheers, Tomas -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: parsing input
Hi Tomas, 01/02/2009 30.00400.00tRandall Dow ... (use (@A @B @C @D @E) (when (match '(@A @B @C @D @E) (line)) (mapcar clip (list @A @B @C @D @E)) ) ) While this is an elegant solution, it does not work as expected, because the '@X' symbols do not necessarily match non-white characters. I would stick with Randall's solution, just a little simplified: (filter prog (split (line) )) Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe