Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Aha! moments
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
K.S.Sreeram  
View profile  
 More options Sep 27 2006, 9:04 pm
Newsgroups: comp.lang.lisp
From: "K.S.Sreeram" <kssree...@gmail.com>
Date: 27 Sep 2006 18:04:22 -0700
Local: Wed, Sep 27 2006 9:04 pm
Subject: Re: Aha! moments

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 '*' !

(power 'x 3)  ->  (* x (* x x))

See the original article by Darius Bacon for the details:
http://cybertiggyr.com/gene/peval/peval.cgi

[sreeram;]


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google