Skip to content

Instantly share code, notes, and snippets.

@emacdona
Created January 20, 2022 12:59
Show Gist options
  • Save emacdona/cf7b6376418b224be9f0401df433bccd to your computer and use it in GitHub Desktop.
Save emacdona/cf7b6376418b224be9f0401df433bccd 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 ,(funcall l)))
(execute-lambda-at-compile-time-b (l) \`(quote ,(funcall (eval l))))
(run-example (symbol)
\`(handler-case (,symbol (lambda () 'hello))
(error (e) (format nil "~a" e)))))
(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-clisp \
-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