Here are a few things that triggered major Aha! moments for me, in no particular order.
- reading the source of cl-ppcre, which illustrated
- run-time compilation (to chains of closures) without using COMPILE or COMPILE-FILE
- parsing regular expression strings, with nice error-reporting via conditions
- that Lisp solutions to practical problems can be concise, comprehensible, and *fast*
- reading Keene's CLOS book
- finding an application of continuable errors; it replaced a convoluted scheme of checking return values at multiple levels with a simple handler-bind wrapper.
- realizing that file formats and communication protocols are just bits on disk or on a wire or sometimes even in memory, and Lisp is pretty good at generating the right bits and octets; inspired by (among other stuff):
- learning that CLX is a Lisp program, not a binding to the C xlib
- learning that Marc's CL-PDF is a Lisp program
- learning about Frode's binary-types
- reading Peter's chapters on parsing binary files
- reading Will Hartung's "Guerilla Lisp Opus"
- realizing that most Common Lisp implementations are mostly written in Common Lisp
A few themes:
- Despite conceptually understanding how tools like CLOS and closures and conditions work, it took a tricky problem solved neatly by the tool to really make an Aha! moment
- Aha! moments have made complicated tasks simpler and unapproachable tasks approachable (given the right amount of time and effort). They take the magic out of things. (Philip Greenspun used to say that his course would teach undergrads how to build Amazon in a semester; despite the hyperbole, it really did take the mystery out of how useful web applications can be constructed.)
Advice:
- Be actively curious about how interesting things work ("how can cl-ppcre be faster than Perl?")
- Be broadly aware of the tools available, and don't worry about immediate application
- Don't settle for tedium (it's hard to have a breakthrough if you have resigned yourself to something that feels substandard)
- People who write one interesting thing usually keep it up; find and watch interesting people (trickle-down Aha! effect?)
Minor delights:
- format tricks (~v and ~{~^~} specifically)
- inspecting a GF object in slime
What are some of the things that triggered your own Aha! moments? What sort of stuff delighted you when you discovered it? What advice would you give people who want to have more Aha! moments?
Zach Beane <x...@xach.com> writes: > Here are a few things that triggered major Aha! moments for me, in no > particular order.
Oops, I forgot one:
- seeing the output of DISASSEMBLE for the first time (it was on a native-compiling Lisp), and the realization that the functionality is part of standard CL
On 27 Sep 2006 17:12:44 -0400, Zach Beane <x...@xach.com> wrote:
> [snip]
> - inspecting a GF object in slime
> What are some of the things that triggered your own Aha! moments? What > sort of stuff delighted you when you discovered it? What advice would > you give people who want to have more Aha! moments?
- macros of course, in particular, writing a DSL for defining GUI menu hierarchies
- learning what generic functions are and what you can do with them in CLOS (e.g. the different kinds of specializers)
- the MOP (and every MOP-related thread in this newsgroup is making me aware that I'm still hanging onto preconceived notions about OOP)
Zach Beane wrote: > What are some of the things that triggered your own Aha! moments? What > sort of stuff delighted you when you discovered it? What advice would > you give people who want to have more Aha! moments?
I guess "code is data" is the most basic lisp aha! But its implications continue to be sources for many more such aha moments.
For instance, in most other programming languages, new abstractions are built by writing code on /top/ of existing abstractions. But in lisp, its possible to build new abstractions by writing code *beneath* existing code.
Here's an example (in scheme):
(define (square x) (* x x)) (define (power x n) (cond ((= n 0) 1) ((odd? n) (* x (power x (- n 1)))) (else (square (power x (/ n 2))))))
This is a simple function which raises x to the integer power n, with a minimum number of multiplications. (let ((x 5)) (power x 3)) returns 125. Now its possible to make the same piece of code return optimized symbolic output by just writing a new implementation of '*' !
> > Here are a few things that triggered major Aha! moments for me, in no > > particular order.
> Oops, I forgot one:
> - seeing the output of DISASSEMBLE for the first time (it was on a > native-compiling Lisp), and the realization that the > functionality is part of standard CL
> Zach
That got me into lisp actually... few months ago. Downloaded the allegro trial, got a book from a colleague (The Winston & Horn one), put some samples, and one of the first things I did was ... compile, then optimizations, and that bought me. Too bad my daily job is C/C++ coding (game development).
On 27 Sep 2006 17:12:44 -0400, <x...@xach.com> wrote:
> Here are a few things that triggered major Aha! moments for me, in no > particular order.
> - reading Keene's CLOS book
For 20 years, I've successfully avoided OOP, halfway thru Keene, I lusted for CLOS. The next program is the CLOS teaching tool.
> - realizing that file formats and communication protocols are just > bits on disk or on a wire or sometimes even in memory, and Lisp > is pretty good at generating the right bits and octets; inspired
STREAMS! It's all streams, and lisp rocks at that. In-line filters and transforms of the 'data-stream', branching and colalescing, sources and sinks.
> - Aha! moments have made complicated tasks simpler and > unapproachable tasks approachable (given the right amount of time > and effort). They take the magic out of things. (Philip Greenspun
s/magic/fear/ s/things/improbables/
> - Be broadly aware of the tools available, and don't worry about > immediate application
The tough one. It's too easy to code up a solution to a problem, you don't think about distributing the answer, since other lispers can code as solution just as fast.
> What advice would you give people who want to have more Aha! > moments?
Well, :Slime 2005-04-27 is there in my usual Emacs setup - I just don't actively or consciously use it. C-h m shows reports no mode specifics. C-h a slime lists very many slime commands. What Swank is I have no idea.
GP lisper wrote: > Then you've never used slime, it's pretty self-evident. > <goes back to ignoring trolls>
Your logic doesn't quite follow.
Slime is a superior interaction mode, yet it doesn't show up as a mode. How Slime helps with "incremental programming" thus remains a mystery.
Adam <nos...@example.com> writes: > Slime is a superior interaction mode, yet it doesn't show up as a mode. > How Slime helps with "incremental programming" thus remains a mystery.
Then do M-x slime-connect from emacs. Open up a source file. Modify a function and type C-c C-c and the new version is compiled into your enviroment.
Petter
-- A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail?