Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. (defun count-prefix-spaces-in-lines (pathname)
  2. (with-open-file (stream pathname)
  3. (loop :for line := (read-line stream nil)
  4. :while line
  5. :collect (loop :for ch :across line
  6. :while (find ch #(#\space #\tab))
  7. :sum 1))))
  8.  
  9.  
  10. (count-prefix-spaces-in-lines "/etc/passwd")
  11. --> (0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement