第九章 函数

1.概论
REBOL提供如下几种函数:
NATIVE、FUNCTION、MEZZANINE、OPERATOR、ROUTINE

2.求值函数
2.1参数
friend: luke@rebol.com
message: "message in a bottle"

send friend message

send luke@rebol.com "message in a bottle"

send friend
** Script Error: send is missing its message argument.
** Where: send friend

send friend message "urgent"

send friend detab copy message

send friend (detab (copy message))

file: %image
insert tail insert file %graphics/ %.jpg
print file
graphics/image.jpg

insert (tail (insert file %graphics/)) %.jpg


2.2参数数据类型
send 1234 "numbers"
** Script Error: send expected address argument of type: email block.
** Where: send 1234 "numbers"

help send
USAGE:
SEND address message /only /header header-obj
DESCRIPTION:
Send a message to an address (or block of addresses)
SEND is a function value.
ARGUMENTS:
address -- An address or block of addresses (Type: email block)
message -- Text of message. First line is subject. (Type: any)
REFINEMENTS:
/only -- Send only one message to multiple addresses
/header -- Supply your own custom header
header-obj -- The header to use (Type: object)

send luke@rebol.com $1000.00


2.3精化

copy/part  (copy just part of a string)

find/tail (return the tail of the match)

load/markup (return XML/HTML tags and strings)

find/case/tail (match case and return tail)

insert/only/dup (insert entire block multiple times)

string: "no time like the present"
print copy string
no time like the present

print copy/part string 7
no time

help copy
USAGE:
COPY value /part range /deep
DESCRIPTION:
Returns a copy of a value.
COPY is an action value.
ARGUMENTS:
value -- Usually a series (Type: series port bitset)
REFINEMENTS:
/part -- Limits to a given length or position.
range -- (Type: number series port)
/deep -- Also copies series values within the block.

str: "test"
insert/dup/part str "this one" 4 5
print str
this this this this test

str: "test"
insert/part/dup str "this one" 4 5
print str
thisthisthisthisthistest

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值