wangjicheng886的个人空间 https://blog.eetop.cn/1774723 [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

skill language user guide 39--40

热度 2已有 220 次阅读| 2023-5-29 20:13 |系统分类:芯片设计

Modifying Lists

The following functions operate on variables without changing their value or creating new
variables.

以下函数在操作变量时不会改变它们的值或创建新的变量。

Coordinates

An xy coordinate is represented by a two-element list. The colon (:) binary operator builds a
coordinate from an x value and a y value.

一个xy坐标被表示为一个由两个元素组成的列表。冒号 (:) 二元操作符将一个x值和一个y值构建成一个坐标。

xValue = 300 

yValue = 400 

aCoordinate = xValue:yValue => ( 300 400 )


The functions xCoord and yCoord access the x coordinate and the y coordinate.

函数xCoord和yCoord分别访问x坐标和y坐标。

xValue = 300 

yValue = 400 

aCoordinate = xValue:yValue => ( 300 400 )

xCoord(aCoordinate) ==>300

yCoord(aCoordinate) ==>400

car(aCoordinate) ==>300

cadr(aCoordinate) ==>400    ; The xCoord and yCoord functions are aliases for The car and The cadr functions.


1)You can use the single quote (') operator or list function to build a coordinate list.

2)You can use the car function to access the x coordinate and car( cdr ( … ) ) to access
the y coordinate.


alias   /ˈeɪliəs/   n   别名;

Coordinate   /kəʊˈɔːdɪneɪt , kəʊˈɔːdɪnət/   n  坐标;

represent   /ˌreprɪˈzent/    v  代表,表示;

colon    /ˈkəʊlən/     n  冒号


注:binary operator  二元操作符

在编程中,二元操作符是指需要两个操作数才能执行操作的运算符。例如,在表达式1 + 2中,“+”是一个二元操作符,操作数为1和2。另外,冒号“:”也是一个二元操作符,它需要两个操作数来构建一个坐标,即x值和y值。


Bounding Boxes

A bounding box is represented by a list of the lower-left and upper-right coordinates. Use the
list function to build a bounding box that contains  一个边界框用包含左下角和右上角坐标的列表表示。使用list函数构建一个包含……的边界框。

1)Coordinates specified with the binary operator (:).

bBox = list( 300:400 500:450 )  ==>((300 400) (500 450))

bBox = '(300:400 500:450)      ==>((300:400) (500:450))   ;注意两个表达式的区别,带运算符的列表,不适合用单引号表示


2)Coordinates specified by variables.

lowerLeft = 300:400 

upperRight = 500:450 

bBox = list( lowerLeft upperRight )  ==>((300 400) (500 450))


You can use the single quote (') operator to build the bounding box if the coordinates are specified by literal lists.

bBox = '(( 300 400 ) ( 500 450 ))


Bounding boxes provide a good example of working with the car and cdr functions. Use any combination of four a’s (each a executes another car) or d’s (each d executes another cdr).

边界框是使用car和cdr函数进行操作的一个很好的示例。使用4个a(每个a执行另一个car)或d(每个d执行另一个cdr)的任意组合。


Using car and cdr with Bounding Boxes

aBox=list((x1:y1) (x2:y2)) ==>((x1 y1) (x2 y2))

car(aBox) ==> (x1 y1)

cdr(aBox) ==>(x2 y2)

caar(aBox) ==>x1

cadar(aBox) ==>y1

caadr(aBox) ==>x2

cadadr(aBox) ==y2



bind  v  绑定;捆绑;系   bound/bound

bounding    形成…的边界

specify   /ˈspesɪfaɪ/ 具体说明;明确规定;详述;详列

literal  /ˈlɪtərəl/  adj 字面意义的;完全按原文的;缺乏想象力的



2

点赞

刚表态过的朋友 (2 人)

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 28

    粉丝
  • 7

    好友
  • 19

    获赞
  • 8

    评论
  • 130

    访问数

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-6-17 16:05 , Processed in 0.049832 second(s), 16 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部