1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2024-12-15 22:58:58 +01:00
tinmop/doc/send-toot.lisp
2020-05-08 15:45:43 +02:00

22 lines
827 B
Common Lisp

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