logo
  • 教程列表
  • SO官方文檔
  • 譁眾取寵
    • 離開了
    • 正確的 currying
    • 基於指數的 currying
    • 沒有明確引數的乾燥閉包
    • 沒有引數的乾燥閉合
  1. StackOverflow 文件
  2. groovy 教程
  3. 譁眾取寵
  4. 基於指數的 currying

基於指數的 currying

Created: November-22, 2018

def quatNorm = { a, b, c, d ->
    Math.sqrt(a*a + b*b + c*c + d*d)
}
assert quatNorm(1, 4, 4, -4) == 7.0

def complexNorm = quatNorm.ncurry(1, 0, 0) // b, c == 0
assert complexNorm(3, 4) == 5.0
  • 沒有明確引數的乾燥閉包
  • 正確的 currying

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明