Skip to content

Instantly share code, notes, and snippets.

@emacdona
Last active January 21, 2022 02:49
Show Gist options
  • Save emacdona/708b824077cafa0d588e665b8388662f to your computer and use it in GitHub Desktop.
Save emacdona/708b824077cafa0d588e665b8388662f to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
EXAMPLE=$(cat <<EOF
(macrolet ((execute-lambda-at-compile-time-a (l)
\`(quote
,(handler-case (funcall l)
(error (e) (format nil "~a" e)))))
(execute-lambda-at-compile-time-b (l)
\`(quote
,(handler-case (funcall (eval l))
(error (e) (format nil "~a" e)))))
(run-example (symbol)
\`(,symbol (lambda () 'hello))))
(print (list
(run-example funcall)
(run-example execute-lambda-at-compile-time-b)
(run-example execute-lambda-at-compile-time-a)
)))
EOF
)
TEMP_DIR=$(mktemp -d)
SCRIPT="${TEMP_DIR}/example.lisp"
echo "${EXAMPLE}" >> "${SCRIPT}"
echo "CLISP:"
echo
docker \
run -it --rm \
--name example-clisp \
-v "${TEMP_DIR}":"/workdir" \
-w "/workdir" \
daewok/clisp clisp ./example.lisp
echo
echo
echo "SBCL:"
docker \
run -it --rm \
--name example-sbcl \
-v "${TEMP_DIR}":"/workdir" \
-w "/workdir" \
daewok/sbcl \
sbcl --script ./example.lisp | grep -v "^;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment