Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
i2y committed Dec 7, 2014
1 parent ef20ada commit 27c13ee
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 5 deletions.
19 changes: 18 additions & 1 deletion README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Its interpreter is written in Python3. The interpreter translates a program writ
- Pattern matching / Data types, like algebraic data types
- Pipeline operator
- Syntax sugar of anonymous function definition
- Actor, like Erlang's actor(using Eventlet)
- Actor, like the actor of Erlang(using Eventlet)
- Macro, like the traditional macro of Lisp
- Built-in Python3 itertools and functools, operator module functions and function in itertools recipes


Expand Down Expand Up @@ -82,6 +83,22 @@ def hello():
app.run()
```

### aif
```
macro aif(test, true_expr, false_expr):
quasi_quote:
it = unquote(test)
if it:
unquote(true_expr)
else:
unquote(false_expr)
print(aif([], first(it), "empty"))
# => "empty"
print(aif([10, 20], first(it), "empty"))
# => 10
```

## Requirements
- CPython >= 3.2 or PyPy >= 3.2.1
- rply >= 0.7.2
Expand Down
17 changes: 17 additions & 0 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Python3のAST/バイトコードに変換し、Python仮想マシン上で実行
- パイプライン演算子
- 無名関数定義のシンタックスシュガー
- Erlangに似たアクター(Eventletベース)
- Lispの伝統的マクロと似たマクロ
- Python3のitertools、functools、operatorモジュールの関数とitertoolsレシピの関数が組み込み


Expand Down Expand Up @@ -93,6 +94,22 @@ def hello():
app.run()
```

### aif
```
macro aif(test, true_expr, false_expr):
quasi_quote:
it = unquote(test)
if it:
unquote(true_expr)
else:
unquote(false_expr)
print(aif([], first(it), "empty"))
# => "empty"
print(aif([10, 20], first(it), "empty"))
# => 10
```

## 依存モジュール
- CPython >= 3.2 or PyPy >= 3.2.1
- rply >= 0.7.2
Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Its interpreter is written in Python3. The interpreter translates a program writ
- Pattern matching / Data types, like algebraic data types
- Pipeline operator
- Syntax sugar of anonymous function definition
- Actor, like Erlang's actor(using Eventlet)
- Actor, like the actor of Erlang(using Eventlet)
- Macro, like the traditional macro of Lisp
- Built-in Python3 itertools and functools, operator module functions and function in itertools recipes


Expand Down Expand Up @@ -83,6 +84,22 @@ def hello():
app.run()
```

### aif
```
macro aif(test, true_expr, false_expr):
quasi_quote:
it = unquote(test)
if it:
unquote(true_expr)
else:
unquote(false_expr)
print(aif([], first(it), "empty"))
# => "empty"
print(aif([10, 20], first(it), "empty"))
# => 10
```

## Requirements
- CPython >= 3.2 or PyPy >= 3.2.1
- rply >= 0.7.2
Expand Down
21 changes: 20 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ Features
- Pattern matching / Data types, like algebraic data types
- Pipeline operator
- Syntax sugar of anonymous function definition
- Actor, like Erlang's actor(using Eventlet)
- Actor, like the actor of Erlang(using Eventlet)
- Macro, like the traditional macro of Lisp
- Built-in Python3 itertools and functools, operator module functions
and function in itertools recipes

Expand Down Expand Up @@ -100,6 +101,24 @@ Flask
app.run()
aif
~~~

::

macro aif(test, true_expr, false_expr):
quasi_quote:
it = unquote(test)
if it:
unquote(true_expr)
else:
unquote(false_expr)

print(aif([], first(it), "empty"))
# => "empty"
print(aif([10, 20], first(it), "empty"))
# => 10

Requirements
------------

Expand Down
4 changes: 2 additions & 2 deletions examples/aif.mochi
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ macro aif(test, true_expr, false_expr):
else:
unquote(false_expr)

print(aif(contains([10, 20, 30], 10), it / 2, it))
print(aif(contains([10, 20, 30], 100), it / 2 , it))
print(aif([], first(it), "empty"))
print(aif([10, 20], first(it), "empty"))

0 comments on commit 27c13ee

Please sign in to comment.