注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

随机过程

http://superware.blog.163.com

 
 
 

日志

 
 

Pair in Scheme  

2015-07-19 16:56:36|  分类: 默认分类 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

        There are many data types in scheme, including integer, real, complex, rational, character, boolean,  hash,  array, vector, pair, and list. It is notable that the pair and list, they are the basement of programming scheme.

        1. Pair

        (1 . 2) is a pair, it consists of two pointers, and each of the two pairs point to a value. The pair can be made by function, e.g. (cons 1 2). The left hand value of the pair can be obtained by function car, and the right one by function cdr. e.g.

Pair in Scheme - superware - 随机过程

         2. List

       
If the right hand of the pair is not a value, but is a pointer which point to another list, we can obtain a list. e.g. (1 2 3 4), which is really the simplified by the form (1 . (2 . (3 . 4  '()))). It can be noted that the list is in nature a linked list.

Pair in Scheme - superware - 随机过程

        3.  Tree, the substance of  list

        The list (A B C (D (F H) G) E), which can be given by the expression

(cons 'A 'B 'C (cons 'D (cons 'F 'H) 'G) 'E)

The list is in nature a tree, and the first element of the list is the root of the tree or subtree. The tree of the above list can be given by

Pair in Scheme - superware - 随机过程
        List    ->    (A  B  C  (D  (F H)  G)  E)
                           *              *     *     

        4. S-Expression

        The AST of the expression (+  a  (*  b  c))  can be given as

Pair in Scheme - superware - 随机过程
 
  评论这张
 
阅读(87)| 评论(0)
推荐

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017