駭客與畫家 Hackers & Painters Big Ideas from the Computer Age
- 作者的Paul Graham的home page
- Paul Graham - Wikipedia, the free encyclopedia
- 作者的著作: ANSI Common Lisp
- Ch06. How to Make Wealth
- Ch11. The Hundred-Year Language - 駭客與畫家第11章 - 百年語言。
- Ch13. Revenge of the nerds - 駭客與畫家第13章 - 書呆的復仇。"We were after the C++ programmers. We managed to drag a lot of them about halfway to Lisp."
- Guy Steele, co-author of the Java spec - Functional VS Imperative (未完)
- 说说动态语言
- 动态语言,别再说不
- 漫談 lisp、scheme、ML嘻嘻,有一個LISP的笑話:某人自稱hack進了NASA的AI Lab,偷盜了不少程式。
為了證明,它列出某個LISP程式的最後一頁:
......))))))))))))))))))))))))))))))))
)))))))))))))))))))))
一整頁的右括號。:) - Type system - Wikipedia, the free encyclopedia
var x = 5; // (1)
var y = "hi"; // (2)
var z = x + y; // (3)- In this code fragment, (1) binds the value 5 to x; (2) binds the value "hi" to y; and (3) attempts to add x to y. In a dynamically typed language, the value bound to x might be a pair (integer, 5), and the value bound to y might be a pair (string, "hi"). When the program attempts to execute line 3, the language implementation checks the type tags integer and string, and if the operation + (addition) is not defined over these two types it signals an error.
- In dynamic typing, type checking often takes place at runtime because variables can acquire different types depending on the execution path.
- C static weak unsafe nominative
- In this code fragment, (1) binds the value 5 to x; (2) binds the value "hi" to y; and (3) attempts to add x to y. In a dynamically typed language, the value bound to x might be a pair (integer, 5), and the value bound to y might be a pair (string, "hi"). When the program attempts to execute line 3, the language implementation checks the type tags integer and string, and if the operation + (addition) is not defined over these two types it signals an error.
- Greenspun's Tenth Rule - Wikipedia, the free encyclopediaAny sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.
- Occam's razor - Wikipedia, the free encyclopediaAll things being equal, the simplest solution tends to be the best one.
- ANSI Common Lisp Ch2 - Welcome to Lisp
When we evaluate a pure Lisp expression like (+ 1 2), there are no side-effects; it just returns a value. But when we call format, as well as returning a value, it prints something. That's one kind of side-effect.
Functional programming means writing programs that work by returning values, instead of by modifying things. It is the dominant paradigm in Lisp. Most built-in Lisp functions are meant to be called for the values they return, not for side-effects.
Just as we can use ' as an abbreviation for quote, we can use \#'
as an abbreviation for function.
The defun macro creates a function and gives it a name. But
functions don't have to have names, and we don't need defun to
define them. Like most other kinds of Lisp objects, we can refer
to functions literally.
To refer literally to an integer, we use a series of digits; to
refer literally to a function, we use what's called a lambda
expression. A lambda expression is a list containing the symbol
lambda, followed by a list of parameters, followed by a body of
zero or more expressions. - Common Lisp - Wikipedia, the free encyclopedia
(sort (list 5 2 6 3 1 4) #'>)
; Sorts the list using the > function as the comparison operator.
; Returns (6 5 4 3 2 1).(sort (list '(9 a) '(3 b) '(4 c))
#'(lambda (x y) (< (car x) (car y))))
; Sorts the list according to the first element (car) of each sub-list.
; Returns ((3 b) (4 c) (9 a)).
沒有留言:
張貼留言