Про Лисп - Глава 2

Paul Graham, “On Lisp - Chapter 2”, public translation into Russian from English More about this translation.

See also 133 similar translations

Translate into another language.

Participants

zoid2564 points
cvb2230 points
Hexs276 points
And others...
Join Translated.by to translate! If you already have a Translated.by account, please sign in.
If you do not want to register an account, you can sign in with OpenID.
Pages: ← previous Ctrl next
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

On Lisp - Chapter 2

Про Лисп - Глава 2

History of edits (Latest: gdmjpn 1 week, 3 days ago) §

— Мне кажется, правильнее будет везде по тексту Lisp заменить на Лисп. Потому что чередование кириллицы и латиницы покоробит читателя. sindikat

Comment was deleted

More 3 comments

— Я убеждён, что название переводится как "Про Лисп" ruguevara

Functions

Функции

History of edits (Latest: zoid 2 years ago) §

Functions are the building-blocks of Lisp programs. They are also the building-blocks of Lisp. In most languages the + operator is something quite different from user-defined functions. But Lisp has a single model, function application, to describe all the computation done by a program. The Lisp + operator is a function, just like the ones you can define yourself.

Функции - стандартные блоки программ Лисп. Они также и стандартные блоки Лисп. В большинстве языков оператор ”+” – это нечто, совершенно отличное от определяемых пользователем функций. Но у Лисп есть единая модель для описания всех вычислений, сделанных программой – применение функций. В Лисп оператор ”+” – это точно такая же функция, какую вы можете определить сами.

History of edits (Latest: zoid 1 year, 11 months ago) §

In fact, except for a small number of operators called special forms, the core of Lisp is a collection of Lisp functions. What’s to stop you from adding to this collection? Nothing at all: if you think of something you wish Lisp could do, you can write it yourself, and your new function will be treated just like the built-in ones.

В действительности, за исключением небольшого количества операторов, называемых специальными формами, ядро Лисп – это коллекция функций Лисп. Что же остановит вас от пополнения коллекции? Совершенно ничего. Если вы думаете о чем-нибудь, что хотели бы, чтобы делал Лисп, то можете написать это сами, и ваша новая функция будет работать точно так же, как встроенная.

History of edits (Latest: zoid 1 year, 11 months ago) §

This fact has important consequences for the programmer. It means that any new function could be considered either as an addition to Lisp, or as part of a specific application. Typically, an experienced Lisp programmer will write some of each, adjusting the boundary between language and application until the two fit one another perfectly. This book is about how to achieve a good fit between language and application. Since everything we do toward this end ultimately depends on functions, functions are the natural place to begin.

Этот факт имеет важные следствия для программиста. Это означает, что любую новую функцию можно рассматривать или как дополнение к Лисп, или как часть определенного приложения. Как правило, опытный программист Лисп напишет всего понемногу, корректируя границу между языком и приложением, пока они не подойдут друг другу идеально. Эта книга о том, как достигнуть хорошей подгонки между языком и приложением. Поскольку все, что мы делаем в этом направлении, в конечном счете, зависит от функций, функция – это естественная точка отсчета.

History of edits (Latest: zoid 1 year, 11 months ago) §

2.1 Functions as Data

2.1 Функции в качестве данных

History of edits (Latest: zoid 2 years ago) §

Two things make Lisp functions different. One, mentioned above, is that Lisp itself is a collection of functions. This means that we can add to Lisp new operators of our own. Another important thing to know about functions is that they are Lisp objects.

Функции Лисп отличаются двумя вещами. Первая, упомянутая выше, это то, что сам Лисп – коллекция функций. Это означает, что мы можем добавить к Лисп свои новые операторы. Другая важная вещь, которую нужно знать о функциях, это то, что они являются объектами Лисп.

History of edits (Latest: zoid 1 year, 11 months ago) §

Lisp offers most of the data types one finds in other languages. We get integers and floating-point numbers, strings, arrays, structures, and so on. But Lisp supports one data type which may at first seem surprising: the function. Nearly all programming languages provide some form of function or procedure. What does it mean to say that Lisp provides them as a data type? It means that in Lisp we can do with functions all the things we expect to do with more familiar data types, like integers: create new ones at runtime, store them in variables and in structures, pass them as arguments to other functions, and return them as results.

В Лисп можно найти большинство типов данных, которые имеются в других языках. Такие, как целые числа и числа с плавающей запятой, строки, массивы, структуры и так далее. А еще Лисп поддерживает один тип данных, который может поначалу вызвать удивление: функция. Почти все языки программирования в том или ином виде поддерживают функции или процедуры. Что значит, когда говорят, что Лисп представляет функции как тип данных? Это значит, что в Лисп мы можем делать с ними то же самое, что могли бы делать с известными типами данных, например, целыми числами: создавать новые во время выполнения, сохранять их в переменных и в структурах, передавать их как параметры другим функциям и возвращать их как результаты.

History of edits (Latest: zoid 1 year, 11 months ago) §
Pages: ← previous Ctrl next
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

© Paul Graham.