JavaScriptとLisp

5,088 views

Published on

Published in: Art & Photos, Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
5,088
On SlideShare
0
From Embeds
0
Number of Embeds
1,366
Actions
Shares
0
Downloads
23
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

JavaScriptとLisp

  1. 1. var profile = { name : ‘Taiju Higashi’, twitter : ‘@taiju’, hatenaid : ‘id:jdg’, job : undefined };
  2. 2. http://d.hatena.ne.jp/jdg/ http://higashizm.sakura.ne.jp/reg/ http://higashizm.sakura.ne.jp/jquery_first/
  3. 3. http://weblogs.mozillazine.org/roadmap/archives/2008/04/ popularity.html http://d.hatena.ne.jp/yad-EL/20081002/p1
  4. 4. “I was recruited to Netscape with the promise of "doing Scheme" in the browser. Netscape Scheme Lisp
  5. 5. "Whether that language should be Scheme was an open question, but Scheme was the bait I went for in joining Netscape.
  6. 6. http://www.crockford.com/javascript/javascript.html http://d.hatena.ne.jp/brazil/20050829/1125321936
  7. 7. "JavaScript's C-like syntax, including curly braces and the clunky for statement, makes it appear to be an ordinary procedural language. This is misleading because JavaScript has more in common with functional languages like Lisp or Scheme than with C or Java. JavaScript C
  8. 8. "It has arrays instead of lists and objects instead of property lists. Functions are first class. It has closures. You get lambdas without having to balance all those parens. lambda GET
  9. 9. http://www.crockford.com/javascript/little.html
  10. 10. "JavaScript has much in common with Scheme. It is a dynamic language. It has a flexible datatype (arrays) that can easily simulate s-expressions. And most importantly, functions are lambdas. JavaScript Scheme Lisp S function=lambda
  11. 11. (define foo (lambda (a b c) (body)))
  12. 12. (define foo (lambda (a b c) (body))) var foo = function(a, b, c) { return body; };
  13. 13. (foo a b c)
  14. 14. (foo (a b c)) foo(a, b, c)
  15. 15. (cond (p1 e1) (p2 e2) ... (else en))
  16. 16. (cond (p1 e1) (p2 e2) ... (else en)) p1 ? e1 : p2 ? e2 : en
  17. 17. (and p1 p2 ... pn) (or p1 p2 ... pn)
  18. 18. (and p1 p2 ... pn) (or p1 p2 ... pn) (p1 && p2 ... && pn) (p1 || p2 ... || pn)
  19. 19. (quote (a b c)) (quote (a . (b . (c . nil))))
  20. 20. (quote (a b c)) (quote (a . (b . (c . nil)))) [‘a’, [‘b’, [‘c’]]

×