为了爱护灵,我尚未理解文号
Long story: I am doing a project for my functional programing class, and I thought of writing an AI controller in Lisp, for the Mario AI competition. I was looking over frameworks/libraries/ways of ...
为了爱护灵,我尚未理解文号
在计划和Racket,一个象征像是一种可以变换的插图,因此可以把符号与<代码>以下?(最根本的点比较)相比较。 联合国文件都用英文大写字母附加数字编号。
符号的用法之一是轻度计数。 例如,可以说方向是<条码>以北<>、<条码>南条码>、<条码>东>、<条码>或<条码>西条码>。 当然,为了同一目的,你可以使用扼杀手段,但效率会略微降低。 使用数字是一种坏的想法;以尽可能清楚和透明的方式代表信息。
另一个例子是,SXML使用清单、符号和插图代表XML。 具体来说,插图代表了特性数据和符号。 因此,XML<em>hello world</em>
将按数值<代码>(列入“hello world”>,可作更细致的写作(em "hello world”)
。
标志的另一个用途是关键。 例如,你可以实施一个方法表,作为执行职能的字典制图符号。 为了称之为一种方法,你看着与方法名称相对应的符号。 Lisp/Scheme/Racket认为,really易于使用,因为该语文在识别符号(部分语文的辛醇)和符号(语文的数值)之间已有内在通信。 这一信函使支持macros的工作变得容易,从而对语言进行用户界定的合成推广。 例如,使用“方法名称”与符号之间的暗中通信(阶级系统界定的同义概念)可以实施一个等级制度,作为大型图书馆:
(send obj meth arg1 arg2)
=>
(apply (lookup-method obj meth) obj (list arg1 arg2))
(在其他特许证中,我所说的话大多是真实的,但还有其他东西可以知道,如包裹和功能与变数的排位一样。)
文号为简单明了的表述,即(缺席)保证为interated;即,任何两种照相的符号均为 。
Why do Lisps have symbols? Well, it s largely an artifact of the fact that Lisps embed their own syntax as a data type of the language. Compilers and interpreters use symbols to represent identifiers in a program; since Lisp allows you to represent a program s syntax as data, it provides symbols because they re part of the representation.
除此以外,它们有什么用处? 好的是:
字母缩略语为人读物。 它们都是单一州。 因此,如果你在你的法典中宣布禁忌,然后再次使用禁忌,就会发现同样的记忆。
Sample use: different symbols can represent different pieces on a chessboard.
From Structure and Interpretation of Computer Programs Second Edition by Harold Abelson and Gerald Jay Sussman 1996:
In order to manipulate symbols we need a new element in our language: the ability to quote a data object. Suppose we want to construct the list (a b). We can’t accomplish this with (list a b), because this expression constructs a list of the values of a and b rather than the symbols themselves. This issue is well known in the context of natural languages, where words and sentences may be regarded either as semantic entities or as character strings (syntactic entities). The common practice in natural languages is to use quotation marks to indicate that a word or a sentence is to be treated literally as a string of characters. For instance, the first letter of “John” is clearly “J.” If we tell somebody “say your name aloud,” we expect to hear that person’s name. However, if we tell somebody “say ‘your name’ aloud,” we expect to hear the words “your name.” Note that we are forced to nest quotation marks to describe what somebody else might say. We can follow this same practice to identify lists and symbols that are to be treated as data objects rather than as expressions to be evaluated. However, our format for quoting differs from that of natural languages in that we place a quotation mark (traditionally, the single quote symbol ’) only at the beginning of the object to be quoted. We can get away with this in Scheme syntax because we rely on blanks and parentheses to delimit objects. Thus, the meaning of the single quote character is to quote the next object. Now we can distinguish between symbols and their values:
(define a 1)
(define b 2)
(list a b)
(1 2)
(list ’a ’b)
(a b)
(list ’a b)
(a 2)
www.un.org/Depts/DGACM/index_spanish.htm 含有符号的清单可以像我们语言的表述一样看待:。
(* (+ 23 45) (+ x 9))
(define (fact n) (if (= n 1) 1 (* n (fact (- n 1)))))
例:
文号只是一个价值的特殊名称。 价值可以是任何东西,但文号每次都指同值,而这类东西用于快速比较。 你说是必须思考的,他们像C中的数字不变,这是他们通常如何执行(储存的数字)。
为了说明Luis Casillas的观点,观察符号eval<>/code>与指示不同可能是有益的。
以下例子说明季度(第10.1.10段)。 为方便起见,我将此职能作为<代码>eval:
(define my-eval (lambda (x) (eval x (scheme-report-environment 5))))
符号可轻易评价其名称的价值或功能:
(define s 2) ;Value: s
(my-eval "s") ;Value: "s"
(my-eval s) ;Value: 2
(define a +) ;Value: a
(define b "+") ;Value: b
(my-eval a) ;Value: #[arity-dispatched-procedure 12]
(my-eval b) ;Value: "+"
((my-eval a) 2 3) ;Value: 5
((my-eval b) 2 3) ;ERROR: The object "+" is not applicable.
Long story: I am doing a project for my functional programing class, and I thought of writing an AI controller in Lisp, for the Mario AI competition. I was looking over frameworks/libraries/ways of ...
I use emacs via Putty and since Putty doesn t send certain key combinations to the remote console I generally need to re-bind them to other key combinations. After installing the amazing Zen-Coding ...
I develop in Lisp and in Scheme, but I was reading about Clojure and then I want to know, in which cases is better to use it than using Lisp or Scheme? Thanks
If I have a list of 0 s, how would I modify, for example, the 16th 0 in the list?
I was trying to write my own put-pixel on (Gdk) pixbuf in Lisp. When I finally realized how I can operate on C pointers in CL, new obstacle came along - (gdk:pixbuf-get-pixels pb) returns me negative ...
I have created some of my own user packages and have run into a name clash. In Java, the naming convention is to use your domain name in the package name: e.g. import com.example.somepackage;. Are ...
We have built a webservice for a client that uses AutoCAD. They have a macro that runs in AutoCAD that builds a SOAP request. But they have not figured out how to actually send() the soap request to ...
In Chapter 9 of the Little Schemer, the Author presents the following two functions (define Q (lambda (str n) (cond ((zero? (remainder (first$ str ) n)) (Q (second$ str ) n)) ...