February 17, 2002

Michael Parker has released a library that is more or less an implementation of awk in Lisp: CL-AWK

He says "I've been using it on my (sadly) AWK-free lispm, but I've tested it and it works on clisp and Lispworks 4.2 as well."

His example:

(defawk checkpass ()
   (setq *FS* ";"))
  ((/= *NF* 7)
   (format t "~%line ~D, does not have 7 fields: ~S" *NR* $0))
  ((~ $1 #/[^A-Za-z0-9]/)
   (format t "~%line ~D, nonalphanumeric user id: ~S" *NR* $0))
  (($== $2 "")
   (format t "~%line ~D, no password: ~S" *NR* $0))
  ((~ $3 #/[^0-9]/)
   (format t "~%line ~D, nonnumeric user id: ~S" *NR* $0))
  ((~ $4 #/[^0-9]/)
   (format t "~%line ~D, nonnumeric group id: ~S" *NR* $0))
  ((!~ $6 #/^\//)
   (format t "~%line ~D, invalid login directory: ~S" *NR* $0)) )
Posted by jjwiseman at February 17, 2002 03:13 PM
Post a comment

Email Address:


Unless you answer this question, your comment will be classified as spam and will not be posted.
(I'll give you a hint: the answer is “lisp”.)


Remember info?