加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

如何在Scala中重置两次移位?

发布时间:2020-12-16 18:37:37 所属栏目:安全 来源:网络整理
导读:从这个 blog post我理解复位中的单个移位是如何实现的. reset { 1 + shift {k:Int = Int = k(5)} + 1} 被提到了 val reified = {shiftValue:Int = 1 + shiftValue + 1}; reified (5) 现在我有另一个例子: reset { 1 + shift(k1:Int = Int = k1(5)} + 1; 2 +
从这个 blog post我理解复位中的单个移位是如何实现的.

reset { 1 + shift {k:Int => Int => k(5)} + 1}

被提到了

val reified = {shiftValue:Int => 1 + shiftValue + 1}; reified (5)

现在我有另一个例子:

reset { 
  1 + shift(k1:Int => Int => k1(5)} + 1;
  2 + shift(k2:Int => Int => k2(6)} + 2
}

它具体到:

val reified ={shifyValue1:Int =>
    1 + shiftValue + 1; 
    2 + shift(k2:Int => Int => k2(6)} + 2
}
reified(5)

我怎样才能进一步改进它以摆脱第二班?

解决方法

val reified ={shiftValue1:Int =>
    1 + shiftValue + 1; 
    val reified2 = {shiftValue2: Int => 2 + shiftValue + 2};
    reified2(6)
}
reified(5)

基本上是相同的转型.

(scala没有安装在这里,所以我只在Scheme中测试了这个转换,它应该表现相同,忽略任何类型的系统问题.)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读