2007年9月28日 星期五

lisp tutorial

I'd say Practical Common Lisp is the best lisp tutorial (common lisp tho) you could get on internet. and it's free to read online. :)

2007年5月25日 星期五

Enterprise..... oh enterprise.....

Informations are too much these days,

People are asking 'what this can be used on?' or 'which is better? YYY compared to XXX and ZZZ ?' for everything.

But the reason behind their asking is not about choice,

not about mind, it's about values these days...

So, anything 'non-practical' and 'non-enterprise' considered useless.

===

I remember One day I came across this part of comments in 'beautifulsoup' ( a python html/xml parser), and that's really a classic explain for enterprise usage :)


#Enterprise class names! It has come to our attention that some people
#think the names of the Beautiful Soup parser classes are too silly
#and "unprofessional" for use in enterprise screen-scraping. We feel
#your pain! For such-minded folk, the Beautiful Soup Consortium And
#All-Night Kosher Bakery recommends renaming this file to
#"RobustParser.py" (or, in cases of extreme enterprisitude,
#"RobustParserBeanInterface.class") and using the following
#enterprise-friendly class aliases:
class RobustXMLParser(BeautifulStoneSoup):
pass
class RobustHTMLParser(BeautifulSoup):
pass
class RobustWackAssHTMLParser(ICantBelieveItsBeautifulSoup):
pass
class RobustInsanelyWackAssHTMLParser(MinimalSoup):
pass
class SimplifyingSOAPParser(BeautifulSOAP):
pass


===

I like lisp, really , I do.

You can really write some python in lisp style.


Y = ( lambda func:
( lambda f: func(lambda x: (f(f))(x)))
( lambda f: func(lambda x: (f(f))(x))))

F = lambda f: lambda x : x==0 and 1 or x*(f)(x-1)

T = Y(F)


Cool, python still runs Y and can easily use Y to generate a recursive factorial function. So maybe you can thinking in lisp just in about any language.

The reason why I still don't code in lisp for daily routine is because practically I don't have anything need to be solved in lisp way. Maybe, after all, worse is still better.

==
I still remember many people takes John Hull books in school not because they like it, 'but it will earn lots money in wall street!!! '....

Not sure if I can still think differents these days...

Money, Enterprise.....When will the joy of programming can be considered?

2007年5月19日 星期六

EPL Exercise 1.2.1

> (define x '(a b ((3) c) d))
> (car (cdr x))
b
> (caddr x)
((3) c)
> (cdaddr x)
(c)
> (char? (car '(#\a #\b)))
#t
> (cons 'x x)
(x a b ((3) c) d)
> (cons (list 1 2) (cons 3 '(4)))
((1 2) 3 4)
> (cons (list) (list 1 (cons 2 '())))
(() 1 (2))

The applicative order Y combinator.


(lambda (f)
((lambda (x) (f (lambda (y) ((x x) y))))
(lambda (x) (f (lambda (y) ((x x) y))))))


or


(define Y
(lambda (f)
((lambda (x) (x x))
(lambda (x) (f (lambda (y) ((f f) y)))))))


1. has no free variables.
2. has no normal form.
3. work when applicative order reduction.