It's about a way of coding in JavaScript in the most Functional style without any kind of sugar.
Video is here:
http://www.devclub.eu/2011/07/04/lisp-like-javascript/ (it's in Russian)
8. Douglas Crockford
• Everytime Douglas Crockford blinks his
eyes, another IE6 instance is killed.
вторник, 5 июля 2011 г.
9. Douglas Crockford
• Everytime Douglas Crockford blinks his
eyes, another IE6 instance is killed.
• Every time you declare a variable in the
global scope, Douglas Crockford kills a
kitten.
вторник, 5 июля 2011 г.
10. Douglas Crockford
• Everytime Douglas Crockford blinks his
eyes, another IE6 instance is killed.
• Every time you declare a variable in the
global scope, Douglas Crockford kills a
kitten.
• There is only one necessary global, and that is Douglas
Crockford
вторник, 5 июля 2011 г.
11. Douglas Crockford
• Everytime Douglas Crockford blinks his
eyes, another IE6 instance is killed.
• Every time you declare a variable in the
global scope, Douglas Crockford kills a
kitten.
• There is only one necessary global, and that is Douglas
Crockford
• JohnResig == awesome, but DouglasCrockford === awesome
вторник, 5 июля 2011 г.
12. Douglas Crockford
• Everytime Douglas Crockford blinks his
eyes, another IE6 instance is killed.
• Every time you declare a variable in the
global scope, Douglas Crockford kills a
kitten.
• There is only one necessary global, and that is Douglas
Crockford
• JohnResig == awesome, but DouglasCrockford === awesome
• “I’m your father, John”
вторник, 5 июля 2011 г.
13. Douglas Crockford
• Everytime Douglas Crockford blinks his
eyes, another IE6 instance is killed.
• Every time you declare a variable in the
global scope, Douglas Crockford kills a
kitten.
• There is only one necessary global, and that is Douglas
Crockford
• JohnResig == awesome, but DouglasCrockford === awesome
• “I’m your father, John”
• In truth there exists no anonymous functions in JavaScript
because Douglas Crockford loves and names all of his
children.
вторник, 5 июля 2011 г.
14. Douglas Crockford
• Everytime Douglas Crockford blinks his
eyes, another IE6 instance is killed.
• Every time you declare a variable in the
global scope, Douglas Crockford kills a
JavaScript Guru!
kitten.
• There is only one necessary global, and that is Douglas
Crockford
• JohnResig == awesome, but DouglasCrockford === awesome
• “I’m your father, John”
• In truth there exists no anonymous functions in JavaScript
because Douglas Crockford loves and names all of his
children.
вторник, 5 июля 2011 г.
17. « ... it did a remarkable
thing: It could teach you
to think recursively »
вторник, 5 июля 2011 г.
18. « ... it did a remarkable
thing: It could teach you
to think recursively »
« ... all of the functions
in The Little Schemer
can be written in
JavaScript. »
вторник, 5 июля 2011 г.
19. « ... it did a remarkable
thing: It could teach you
to think recursively »
« ... all of the functions
in The Little Schemer
can be written in
JavaScript. »
«So get a copy of The
Little Schemer and
start recursing ... »
вторник, 5 июля 2011 г.
20. « ... it did a remarkable
thing: It could teach you
to think recursively »
« ... all of the functions
in The Little Schemer
And so I didn...b e w r i t t e n i n
ca
JavaScript. »
«So get a copy of The
Little Schemer and
start recursing ... »
вторник, 5 июля 2011 г.
21. Primitives
car, cdr, cons, null?, eq?, zero?
вторник, 5 июля 2011 г.
22. Primitives
car, cdr, cons, isNull, eq?, zero?
null?, isEq, isZero
вторник, 5 июля 2011 г.
25. Cond
(cond (question1 answer1)
(question2 answer2)
...
(else else_answer))
вторник, 5 июля 2011 г.
26. Cond
(cond (question1 answer1)
(question2 answer2)
...
(else else_answer))
(define member?
(lambda (a lat)
(cond
((null? lat) #f)
(else (or (eq? (car lat) a)
(member? a cdr(lat)))))))
вторник, 5 июля 2011 г.
27. Cond
(cond (question1 answer1)
(question2 answer2)
...
(else else_answer))
(define member?
(lambda (a lat)
(cond
((null? lat) #f)
(else (or (eq? (car lat) a)
(member? a cdr(lat)))))))
вторник, 5 июля 2011 г.
28. Cond
(cond (question1 answer1)
(question2 answer2)
...
(else else_answer))
(define member?
(lambda (a lat)
(cond
((null? lat) #f)
(else (or (eq? (car lat) a)
(member? a cdr(lat)))))))
вторник, 5 июля 2011 г.
29. Cond
(cond (question1 answer1)
(question2 answer2)
...
(else else_answer))
(define member?
(lambda (a lat)
(cond
((null? lat) #f)
(else (or (eq? (car lat) a)
(member? a cdr(lat)))))))
вторник, 5 июля 2011 г.
30. Cond
(cond (question1 answer1)
(question2 answer2)
...
(else else_answer))
(define member?
(lambda (a lat)
(cond
((null? lat) #f)
(else (or (eq? (car lat) a)
(member? a cdr(lat)))))))
вторник, 5 июля 2011 г.
31. Cond
(cond (question1 answer1)
(question2 answer2)
...
(else else_answer))
(define member?
(lambda (a lat)
(cond
((null? lat) #f)
(else (or (eq? (car lat) a)
(member? a cdr(lat)))))))
вторник, 5 июля 2011 г.
32. Cond
(cond (question1 answer1)
(question2 answer2)
...
(else else_answer))
(define member?
(lambda (a lat)
(cond
((null? lat) #f)
(else (or (eq? (car lat) a)
(member? a cdr(lat)))))))
вторник, 5 июля 2011 г.
33. Cond
(cond (question1 answer1)
(question2 answer2)
...
(else else_answer))
(define member?
(lambda (a lat)
(cond
((null? lat) #f)
(else (or (eq? (car lat) a)
(member? a cdr(lat)))))))
вторник, 5 июля 2011 г.
34. Cond
(cond (question1 answer1)
(question2 answer2)
...
(else else_answer))
(define member?
(lambda (a lat)
(cond
((null? lat) #f)
(else (or (eq? (car lat) a)
(member? a cdr(lat)))))))
вторник, 5 июля 2011 г.
35. Cond
(cond (question1 answer1)
(question2 answer2)
...
(else else_answer))
(define member?
(lambda (a lat)
(cond
((null? lat) #f)
(else (or (eq? (car lat) a)
(member? a cdr(lat)))))))
вторник, 5 июля 2011 г.
36. Cond
if (question1){return answer1;}
else if (question2){return answer2;}
...
else {return else_answer;}
вторник, 5 июля 2011 г.
37. Cond
if (question1){return answer1;}
else if (question2){return answer2;}
...
else {return else_answer;}
function isMember(a, lat){
if (isNull(lat)){
return false;
}else{
return isEq(car(lat), a) ||
isMember(a, cdr(lat));
}
}
вторник, 5 июля 2011 г.
38. Cond
if (question1){return answer1;}
else if (question2){return answer2;}
...
else {return else_answer;}
function isMember(a, lat){
if (isNull(lat)){
return false;
}else{
return isEq(car(lat), a) ||
isMember(a, cdr(lat));
}
}
вторник, 5 июля 2011 г.