Lambda Tutorial (2016)

栏目: IT技术 · 发布时间: 4年前

内容简介:These web pages provide a practical introduction to lambda reduction, with a few pointers to more esoteric issues. I'm a linguist, and I have linguists in mind for my audience, so linguistic issues will be emphasized (e.g., a discussion of the interaction

Lambda tutorial

These web pages provide a practical introduction to lambda reduction, with a few pointers to more esoteric issues. I'm a linguist, and I have linguists in mind for my audience, so linguistic issues will be emphasized (e.g., a discussion of the interaction of lambda with other binding operators such as "exists" and "forall").

Browser issues : If your browser can handle JavaScript 1.2, and if you have JavaScript turned on, you will be able to evaluate examples by clicking on a button, and to make up your own examples to try; otherwise, the examples will just sit there. For instance, try clicking on the "Reduce" button:You should see the string "(it works)" appear in the second window. This is a live program written in JavaScript---you can type any expression into the input box and try reducing it (you need to spell out "lambda" in the input, the program will convert it to " λ " in the output). Character problems : As of May 2003, Internet Explorer doesn't seem to be able to print the forall or the exists symbols in the first paragraph above (you may see an empty box). But Opera and Mozilla (both with free versions) seem to do ok. Finally, Mozilla can't deal with the lambda symbol (" λ ") in JavaScript output, so for now all the lambdas are spelled out when they are in examples.

Goal : Church's λ -calculus provides a convenient way of representing meanings, whether meanings of programs or of expressions in English or some other natural language. As a result, it is ubiquitous in computer science, logic, and formal approaches to the semantics of natural language. The λ -calculus consists of two things: a formal language and an associated notion of REDUCTION (roughly equivalent to "computation"). In the context of the lambda calculus, reduction is specifically called λ -reduction. What these pages will attempt to do is teach you how to perform λ -reduction accurately and confidently.

Other sources : I recommend Hankin's Lambda Calculi : A Guide for Computer Scientists (Oxford) for a readable survey, and Barendregt's The Lambda Calculus (Elsevier) for a more complete reference work. Barendregt and Barendsen's shorter introduction to the lambda calculus is also excellent , and accessible electronically for free (if the citeseer link ceases to work, I've cached a copyhere; note for some mysterious reason pages 2, 3 and 4 are blank). Selinger has an excellent set of lecture notes covering many logical and computational aspects of the lambda calculus here . For a more linguistic perspective, chapter 2 of Carpenter's Type-Logical Semantics (MIT Press) presents a λ -calculus within a framework for describing natural language. The following is too fun not to mention: David Keenan, To dissect a mockingbird: a graphical notation for the lambda calculus with animated reduction .

Acknowledgements : Saber Ben Salem made a number of helpful suggestions.

Contents of this document:

    Binding: free versus bound
    β -reduction (the heavy lifting)
    α -reduction (alphabetic variants)
    Examples and practice
    Order of combination versus order of reduction; convergence
    Various alternative notational conventions
    The semantics of the λ -operator
    Scheme reference code

Binding: free versus bound

λ is a binding operator, just like backwards E ("∃") or upside down A ("∀"). Consequently, it always binds something (a variable), taking scope over some expression that (usually) contains occurrences of the bound variable. More practically, λ always occurs in the following configuration:

( λ var body)
Here, "var" is the variable bound by the lambda operator, and "body" is the constituent that the lambda operator has scope over.

For instance:

( λ x (* (+ 3 x) (- x 4)))
Here "x" is the variable (the one immediately after the binding operator), and the body is "(* (+ 3 x) (- x 4))". The body contains two occurrences of "x", and both are bound by the λ operator; any variable token that is not bound is free .
( λ x (* (+ y x) (- x z)))
In this form, the tokens of "y" and of "z" are both free.

Freedom is always relative to a particular expression. If the preceding expression is embedded within a larger one, the free variables can come to be bound:

(∃ y ( λ x (* (+ y x) (- x z))))
In this case, the "y" has been bound, and only the "z" remains free.

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

我知道他想看什么

我知道他想看什么

沙建军 / 中信出版社 / 2018-1 / 48.00

社交媒体迅速发展、信息快速迭代、时间碎片化;大数据、智能终端、物联网横空出世;移动支付、网红经济和传统营销失效,这些都让这个时代的媒体、内容、渠道、产品之间的边界越来越模糊,也从根本上改变了营销的逻辑,内容营销从热词变成趋势,变成营销的底层思维。未来一切都是媒体,形式也是内容。 本书作者通过对国内外36个内容营销的新近案例的故事化描述和透彻分析,提出“组织媒介化”“营销内容化”“内容情趣化”......一起来看看 《我知道他想看什么》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

URL 编码/解码
URL 编码/解码

URL 编码/解码