Guest User

Untitled

a guest
Jan 23rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #!/usr/bin/sbcl --script
  2.  
  3. (defun stream-to-lines (stream)
  4. (let ((line (read-line stream nil)))
  5. (and line
  6. (cons line (stream-to-lines stream)))))
  7.  
  8. (defun print-stream-reversed-order (stream &key (printer 'write-line))
  9. (mapcar printer (reverse (stream-to-lines stream))))
  10.  
  11. (defun tac (filepath)
  12. (let ((stream (or (and filepath (open filepath))
  13. *standard-input*)))
  14. (print-stream-reversed-order stream)
  15. (close stream)))
  16.  
  17. (tac (cadr *posix-argv*))
Add Comment
Please, Sign In to add comment