美文网首页NodeJS in LNNM
写写LISP,也只在一瞬间

写写LISP,也只在一瞬间

作者: Tulayang | 来源:发表于2015-03-21 15:48 被阅读187次
function op(type, a, b) {
  return op.operators[type](a, b);
}
op.operators = {
  '+': function (a, b) {return a + b;},
  '-': function (a, b) {return a - b;},
  '×': function (a, b) {return a * b;},
  '÷': function (a, b) {return a / b;},
  '%': function (a, b) {return a % b;}
};
op('+', op('-', op('×', 20000, 1010), 50000), op('÷', op('%', 963, 1000), 3));

相关文章

网友评论

  • Tulayang:@阿豪

    上边代码的LISP书写方式是这样的:

    ```
    (+ (- (× 20000 1010) 50000) (÷ (% 963 1000) 3))
    ```
  • c1b2c1e08f94:据说js但是参考了一部分lisp的风(B)格,函数式编程风格,那么这个js和lisp有啥界限和具体不同的嘛?

本文标题:写写LISP,也只在一瞬间

本文链接:https://www.haomeiwen.com/subject/hhowxttx.html