{"id":405,"date":"2021-03-25T10:34:33","date_gmt":"2021-03-25T14:34:33","guid":{"rendered":"https:\/\/www.fitzsim.org\/blog\/?p=405"},"modified":"2021-03-26T21:57:25","modified_gmt":"2021-03-27T01:57:25","slug":"quickly-start-a-common-lisp-script","status":"publish","type":"post","link":"https:\/\/www.fitzsim.org\/blog\/?p=405","title":{"rendered":"Quickly Start a Common Lisp Script"},"content":{"rendered":"<p>So you want to write a utility script, and you want to write it in Common Lisp.  I created a template Common Lisp script called <code>start.lisp<\/code>.  It&#8217;s meant to be renamed and hacked up but it provides a starting point for a new Common Lisp script, with some utility libraries included.<\/p>\n<p>Here&#8217;s a &#8220;one-liner&#8221; that you can paste into a text editor, verify visually, then copy-n-paste from the editor into a terminal.  This will get you up and running on major distros:<\/p>\n<p><code style=\"min-width: 20em\">sudo apt install sbcl || \\<br \/>\nsudo dnf install sbcl || \\<br \/>\nsudo yum install sbcl && \\<br \/>\ngit clone --recursive https:\/\/git.sr.ht\/~fitzsim\/cl-starter-script && \\<br \/>\n.\/cl-starter-script\/start.lisp --help<\/code><\/p>\n<p>It uses some shell tricks I found on the <a href=\"https:\/\/www.emacswiki.org\/emacs\/EmacsScripts\">EmacsWiki<\/a>, and a UIOP<sup><a href=\"#footnote-1\">1<\/a><\/sup> feature (<code>(uiop:argv0)<\/code> with <code>__CL_ARGV0<\/code>) I discovered via the impressive <a href=\"https:\/\/github.com\/fare\/cl-launch\">cl-launch project<\/a>.  It&#8217;s too bad <code>cl-launch<\/code> isn&#8217;t more widely packaged, since it seems like a good idea.<\/p>\n<p>I may add more utility features to this template repository, but I&#8217;ll also try to keep it simple and self-contained.  Self-contained meaning after the initial <code>git clone<\/code> there&#8217;s no need to go back to the Internet for more libraries.<\/p>\n<p>This is only meant for utility scripts (and for me as a learning exercise for ASDF and Common Lisp packages).  It is available in my <a href=\"https:\/\/git.sr.ht\/~fitzsim\/cl-starter-script\">Sourcehut<\/a>, and mirrored to <a href=\"https:\/\/github.com\/fitzsim\/cl-starter-script\">Microsoft GitHub<\/a>.<\/p>\n<p>For bigger projects, check out <a href=\"https:\/\/xach.com\/lisp\/quickproject\/\">Quickproject<\/a>, and for installing newer Common Lisp implementations than your operating system provides, consider <a href=\"https:\/\/github.com\/roswell\/roswell\">Roswell<\/a>.<\/p>\n<p>Thanks to Didier Verna for help with ASDF and for quickly incorporating into <a href=\"https:\/\/github.com\/didierverna\/clon\">CLON<\/a> some new features I requested.<\/p>\n<div id=\"footnote-1\">1. &#8220;Utilities for Implementation- and OS- Portability&#8221;<\/div>\n","protected":false},"excerpt":{"rendered":"<p>So you want to write a utility script, and you want to write it in Common Lisp. I created a template Common Lisp script called start.lisp. It&#8217;s meant to be renamed and hacked up but it provides a starting point for a new Common Lisp script, with some utility libraries included. Here&#8217;s a &#8220;one-liner&#8221; that &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.fitzsim.org\/blog\/?p=405\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Quickly Start a Common Lisp Script&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-405","post","type-post","status-publish","format-standard","hentry","category-lisp","entry"],"_links":{"self":[{"href":"https:\/\/www.fitzsim.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/405","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.fitzsim.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fitzsim.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fitzsim.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fitzsim.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=405"}],"version-history":[{"count":20,"href":"https:\/\/www.fitzsim.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/405\/revisions"}],"predecessor-version":[{"id":426,"href":"https:\/\/www.fitzsim.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/405\/revisions\/426"}],"wp:attachment":[{"href":"https:\/\/www.fitzsim.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=405"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fitzsim.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=405"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fitzsim.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=405"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}