[HN Gopher] Lisp Koans
       ___________________________________________________________________
        
       Lisp Koans
        
       Author : phoe-krk
       Score  : 129 points
       Date   : 2020-11-28 10:43 UTC (12 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | vilhelm_s wrote:
       | I thought this would be http://hackersdictionary.com/html/Some-
       | AI-Koans.html .
        
         | phoe-krk wrote:
         | _A novice was trying to fix a broken Lisp machine by turning
         | the power off and on._
         | 
         |  _Knight, seeing what the student was doing, spoke sternly:
         | "You cannot fix a machine by just power-cycling it with no
         | understanding of what is going wrong."_
         | 
         |  _Knight turned the machine off and on._
         | 
         |  _The machine worked._
         | 
         | ---------------
         | 
         | Always beautiful to read those.
        
       | phoe-krk wrote:
       | If you've seen the Lisp Koans in the past, you might want to
       | revisit them someday. Around half a year ago I've rewritten[0]
       | the original set of koans, fixed multiple correctness issues,
       | added some content, and cleaned up the test framework; they now
       | look much better than the original version.
       | 
       | [0] https://github.com/google/lisp-koans/pull/111
        
         | cnasc wrote:
         | Thanks! I've got your book next to my desk on the top of the
         | pile of things to read next
        
           | phoe-krk wrote:
           | Thanks! Hope that it serves you well.
        
         | zdragnar wrote:
         | Thank you!
        
           | phoe-krk wrote:
           | My pleasure, hope they serve you well.
        
             | owyn wrote:
             | Cool, I started doing these a couple of years ago, nice to
             | have an updated version. I haven't done lisp in a long time
             | but I'm trying to get back into CL.
             | 
             | One question: using SBCL I can run the script with sbcl
             | --script contemplate.lisp but how do I load the koans into
             | the repl in a way that has all the helper/test functions
             | available? If I just (load "test-framework.lisp") or do
             | sbcl --load contemplate.lisp, I get a bunch of warnings and
             | things like (assert-equal t t) throw "undefined function".
             | It's mentioned in the original PR that this "should" be
             | possible now but I didn't see it in the README.
             | 
             | One thing I'm very not familiar with yet is the
             | quicklisp/abcl and packaging system so this is probably
             | very obvious. Thanks!
        
               | phoe-krk wrote:
               | Hmmm. Koans in the original form _will_ warn because they
               | are incomplete, so loading them altogether is going to
               | not work very well. I don 't think that the current
               | version of koans is very well-suited for interactive
               | development; please feel free to open an issue for that
               | and perhaps it will get done someday.
        
               | owyn wrote:
               | Okay cool, I can just eval the actual code separately
               | from the koan test framework for now, it's fine. Sounds
               | like an interesting problem for the reader for sure. :)
               | 
               |  _edited with suggestion to call use-package_ I 'm not
               | very familiar with the lisp packaging stuff yet.
               | 
               | Here's what I was trying to do:                 * (load
               | "test-framework.lisp")       T       * (use-package
               | :lisp-koans.test)       T       * (assert-equal t t)
               | debugger invoked on a UNBOUND-VARIABLE in thread
               | #<THREAD "main thread" RUNNING {1001570143}>:       The
               | variable LISP-KOANS.TEST::*KOAN-ASSERT-LIST* is unbound.
               | 
               | Aha it looks like it's part of the code that is testing
               | for blanks in the original form.                 (if
               | (form-contains-blanks-p form)           (push :incomplete
               | *koan-assert-list*)
               | 
               | That seems like it's fixable, maybe I will open a bug for
               | that. I don't think it expects to run outside of the run-
               | koan function. That's fine, I'll stop there until I know
               | enough to fix it haha.
               | 
               | Also thanks for answering my noob questions! I just
               | realized you also wrote the Common Lisp Condition System
               | which is on my TO-READ list (after I do about 100 hours
               | of lisp refresher stuff lol).
        
               | phoe-krk wrote:
               | Oh! I see now! You're not using the LISP-KOANS.TEST
               | package.
               | 
               | (use-package :lisp-koans.test) and you should be good to
               | go.
        
               | phoe-krk wrote:
               | For that, you should be able to load the test framework
               | and the koan helper file separately. Then try to evaluate
               | individual koans in emacs/slime - it should work.
        
               | phoe-krk wrote:
               | Yes, none of this expects to be run outside of the
               | standard koan run. Sorry about this; please open an issue
               | and eventually I'll patch this code to be runnable
               | outside of the koans file.
        
       | pmoriarty wrote:
       | Are these available for Emacs Lisp?
        
         | phoe-krk wrote:
         | Seems like https://github.com/jtmoulia/elisp-koans is
         | available, but it was forked before my changes and therefore
         | does not seem to include them.
         | 
         | Might be worth to update them if anyone finds the time for
         | that!
        
           | jtmoulia wrote:
           | Awesome to see such a comprehensive update to the lisp koans.
           | much thanks!
           | 
           | Like you said, elisp-koans was forked from lisp-koans awhile
           | back. Bringing over the additional coverage you added will be
           | a great improvement!
           | 
           | I love the addition of the `koans-solved` directory. I was
           | using a separate branch, but that was a pain to keep in sync
           | with master. Will definitely bring that over :)
        
       | submeta wrote:
       | Just started learning Emacs Lisp. Common Lisp is on my todo list.
       | Glancing through these tasks, I realize I have a lot to learn
       | before I can call myself proficient. But I am very eager. Started
       | reading Guy Steele and Touretzky. Love the concepts, the
       | simplicity, homoiconicity, Lisp macros, and the fact that it is
       | time tested.
       | 
       | ## Edit
       | 
       | Years ago when I was confronted with a new technology that caught
       | my interest, I'd ask myself: Is it in use? Is it wide-spread? Is
       | it used by companies in commercial situations?
       | 
       | My questions have changed. Now I tend to apply questions like:
       | Does the hacker in me get excited? Does this technology help me
       | solve problems? Does it make my life easier?
        
         | capableweb wrote:
         | About the questions that has changed over time. I see them as
         | questions that depend on the context rather than experience
         | and/or time.
         | 
         | If you're trying to build something many people should be able
         | to build upon, you as a developer should be easily replaceable
         | and you want to have a high hiring pool with mid-level
         | developers (like how the typical startup thinks), then your
         | first questions are more appropriate.
         | 
         | But if you're looking to build something for fun, to scratch
         | your own itch or trying to do something more innovative than a
         | CRUD app, then perhaps your latter questions are more
         | appropriate.
        
         | jtmoulia wrote:
         | I ported lisp-koans to elisp https://github.com/jtmoulia/elisp-
         | koans
         | 
         | It's still rough and doesn't include @phoe-krk's latest changes
         | (forked 1.5yrs ago), but I found it super useful for learning
         | lisp.
        
         | abhinav22 wrote:
         | Try this guide - it's quite a good and concise introduction and
         | will get you coding quickly. It can be read alongside a
         | textbook:
         | 
         | https://github.com/ashok-khanna/common-lisp-by-example
         | 
         | (Disclaimer: I'm the compiler of this guide)
        
           | Kelamir wrote:
           | I love the guide. Thank you very much, abhinav22.
        
             | abhinav22 wrote:
             | You are most welcome Kelamir :)
        
           | monroewalker wrote:
           | Awesome guide :). I've been meaning to learn the basics of
           | LISP since trying out Emacs and this was finally an easy
           | enough introduction to it that I've read a fair amount.
           | Thanks for this!
        
             | abhinav22 wrote:
             | Your welcome :) I was (am) in the exact same shoes as you,
             | so I wrote notes along the way , hence us beginners "get"
             | it ;)
             | 
             | Good luck and I hope to see you as a pro lisp programmer in
             | a few months!
        
           | dunefox wrote:
           | Looks good, thanks. Will you include more topics that are
           | missing now?
        
             | abhinav22 wrote:
             | Nah, it was a conscious choice to limit the amount of
             | material in the guide as not to overwhelm the beginner.
             | 
             | The various textbooks on lisp are great and this wasn't
             | aimed to replace them, but just guide the reader through
             | the initial phase where they may be overwhelmed.
        
       | Zhyl wrote:
       | I really like the koans format of language learning. I find they
       | pique and sustain my interest more than rote tutorials or trying
       | to glean purpose, feel and function of languages.
       | 
       | It feels much more like a puzzle, the hints can be more cryptic
       | and requires me to be more bought in than an introductory podcast
       | or an online set of lessons.
       | 
       | I'd love to see this format applied to other topics and fields,
       | although none will likely lend themselves to the format as
       | natively as programming languages will.
        
       | markc wrote:
       | Clojure Koans: http://www.clojurekoans.com/
        
         | dimitar wrote:
         | These are pretty easy compared to 4clojure, so they are perhaps
         | the best for beginners.
        
       ___________________________________________________________________
       (page generated 2020-11-28 23:01 UTC)