找回密码
 注册
Simdroid-非首页
查看: 80|回复: 0

[基础概念] TagSet/:=到底是怎么用,是什么意思呢?

[复制链接]
发表于 2012-11-7 16:11:31 | 显示全部楼层 |阅读模式 来自 上海
f/:lhs=rhs
assigns rhs to be the value of lhs, and associates the assignment with the symbol f.

  1. f /: f[h[x_]] = x^2;
  2. f[g[2]]
  3. 和下面的结果是样的
  4. h /: f[h[x_]] := x^2;
  5. f[g[2]]
复制代码
都是4,首字母一定要是后面出现的字母,是f或g
那么没有分别吗,二者都行?

能否再给些例子呢?

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-3-28 18:20 , Processed in 0.027959 second(s), 11 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表