Scheme基本概念之External Representations
来源:互联网 发布:一元购网站源码 编辑:程序博客网 时间:2024/05/22 12:48
An important concept in Scheme is that of the external representation of an object as a sequence of characters. For example, an external representation of the integer 28 is the sequence of characters ‘28’, and an external representation of a list consisting of the integers 8 and 13 is the sequence of characters ‘(8 13)’.
The external representation of an object is not necessarily unique. The integer 28 also has representations ‘#e28.000’ and ‘#x1c’, and the list in the previous paragraph also has the representations ‘( 08 13 )’ and ‘(8 . (13 . ( )))’.
Many objects have standard external representations, but some, such as procedures and circular data structures, do not have standard representations (although particular implementations may defi ne representations for them).
An external representation may be written in a program to obtain the corresponding object .
External representations can also be used for input and output. The procedure read parses external representations, and the procedure write generates them. Together, they provide an elegant and powerful input/output facility.
Note that the sequence of characters ‘(+ 2 6)’ is not an external representation of the integer 8, even though it is an expression that evaluates to the integer 8; rather, it is an external representation of a three-element list, the elements of which are the symbol + and the integers 2 and 6. Scheme’s syntax has the property that any sequence of characters
that is an expression is also the external representation of some object. This can lead to confusion, since it may not be obvious out of context whether a given sequence of characters is intended to denote data or program, but it is also a source of power, since it facilitates writing programs such as interpreters and compilers that treat programs as data or data as programs.
The external representation of an object is not necessarily unique. The integer 28 also has representations ‘#e28.000’ and ‘#x1c’, and the list in the previous paragraph also has the representations ‘( 08 13 )’ and ‘(8 . (13 . ( )))’.
Many objects have standard external representations, but some, such as procedures and circular data structures, do not have standard representations (although particular implementations may defi ne representations for them).
An external representation may be written in a program to obtain the corresponding object .
External representations can also be used for input and output. The procedure read parses external representations, and the procedure write generates them. Together, they provide an elegant and powerful input/output facility.
Note that the sequence of characters ‘(+ 2 6)’ is not an external representation of the integer 8, even though it is an expression that evaluates to the integer 8; rather, it is an external representation of a three-element list, the elements of which are the symbol + and the integers 2 and 6. Scheme’s syntax has the property that any sequence of characters
that is an expression is also the external representation of some object. This can lead to confusion, since it may not be obvious out of context whether a given sequence of characters is intended to denote data or program, but it is also a source of power, since it facilitates writing programs such as interpreters and compilers that treat programs as data or data as programs.
- Scheme基本概念之External Representations
- Scheme基本概念之Whitespace
- Scheme基本概念之Delimiters
- Scheme基本概念之 Comments
- Scheme基本概念之vector
- scheme基本概念之Variable Bindings
- scheme基本概念之true and false
- Scheme基本概念之 Disjointness of Types
- Scheme R5RS 3.基本概念
- 处理字符串的外部表示(Handling External Representations of Strings)CFString
- Fluent Scheme 之对话框
- scheme 之道
- Scheme之不定参数
- scheme 之道
- scheme 入门之 hello world
- Fluent Scheme 之 GUI 命令
- fluent scheme 之 xyplot 功能
- Scheme语言基础之数据类型
- Android开发之基本概念
- DataSet与GridView绑定
- Irrlicht引擎
- 《怪诞行为学2》读书笔记,第三章 宜家效应:为什么我们会高估自己的劳动成果?
- java中访问修饰符的使用,方法重写定义,final修饰符,布局的特点等等:
- Scheme基本概念之External Representations
- 动态规划(算法导论学习笔记)
- STM32 -USART中断方式
- 素数定理(素数的分布)
- careercup1.7
- iOS6的framework运行在iOS5或者以下版本机器上报错的解决办法
- Google Maps API编程资源大全
- Ubuntu 12.04中文输入法的安装
- [转]Android xmlns 的作用及其自定义