send-toot.lisp 827 B

12345678910111213141516171819202122
  1. ;; a comment starts with a semicolon like that
  2. (in-package :scripts) ; always starts a script with this line
  3. ;; defun means 'define a function'
  4. (defun read-stdin ()
  5. ;; 'let' introduce a new variable, 'data' in this case
  6. (let ((data (loop ; read from standard and collect character in a list
  7. for char = (read-char *standard-input* nil nil)
  8. while char
  9. collect char)))
  10. (coerce data 'string))) ; transform the list in a string
  11. (defun main ()
  12. (when-let* ((body (read-stdin)))
  13. ;; the first element of a list (the stuff between parents is the
  14. ;; function name the rest of the lists are the functions parameters.
  15. ;; nil means false or kind of 'empty'
  16. (send-status body nil nil nil +status-public-visibility+)))
  17. ;; call the function to send a toot
  18. (main)