动态类型的编程语言:Mochi
Mochi是一个动态类型的编程语言,用于函数式编程和actor风格的编程。
它的解析器采用Python3编写。这个解析器将一个采用Mochi编写的程序转换成Python3的AST / bytecode。
特性
- 类似于Python的语法
- Tail recursion optimization (self tail recursion only), and no loop syntax
- Re-assignment are not allowed in function definition.
- Basic collection type is a persistent data structure. (using Pyrsistent)
- Pattern matching / Data types, like algebraic data types
- Pipeline operator
- Syntax sugar of anonymous function definition
- Actor, like the actor of Erlang(using Eventlet)
- Macro, like the traditional macro of Lisp
- Builtin functions includes functions exported by itertools module, recipes, functools module and operator module
示例
Factorial def factorial(n, m): if n == 1: m else: factorial(n - 1, n * m) factorial(10000, 1) # => 28462596809170545189064132121198688... # Or def factorial: n: factorial(n, 1) 0, acc: acc n, acc: factorial(n - 1, acc * n) factorial(10000) # => 28462596809170545189064132121198688...
</strong>
本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!