mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-03 14:04:33 +00:00
Updata commit hash
This commit is contained in:
parent
a35127fec7
commit
c78b053763
70 changed files with 79 additions and 70 deletions
|
@ -1,6 +1,6 @@
|
||||||
# Operator [...T], O
|
# Operator [...T], O
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Operator.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Operator.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
演算子の型です。
|
演算子の型です。
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Ratio
|
# Ratio
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Ratio.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Ratio.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
有理数を表す型です。主に、分数を使いたいときに使います。
|
有理数を表す型です。主に、分数を使いたいときに使います。
|
||||||
実はErgでの/演算子はRatioを返します。1/3などは0.33333...とは評価されず1/3のまま処理されます。また、0.1は1/10と等価です。なので、`0.1 + 0.2 == 0.3`となります。当たり前のように聞こえますが、PythonではなんとFalseになります。
|
実はErgでの/演算子はRatioを返します。1/3などは0.33333...とは評価されず1/3のまま処理されます。また、0.1は1/10と等価です。なので、`0.1 + 0.2 == 0.3`となります。当たり前のように聞こえますが、PythonではなんとFalseになります。
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Tensor Shape: [Nat; N]
|
# Tensor Shape: [Nat; N]
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Tensor.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Tensor.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
多次元配列を効率的に操作するためのクラス。多次元配列に対する積などの演算も定義する。
|
多次元配列を効率的に操作するためのクラス。多次元配列に対する積などの演算も定義する。
|
||||||
Matrix, Vectorなどはこの型を継承している。
|
Matrix, Vectorなどはこの型を継承している。
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# UnaryOp T, O
|
# UnaryOp T, O
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/patches/UnaryOp.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/patches/UnaryOp.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
単項演算子の型です。
|
単項演算子の型です。
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# ErgコードはPythonコードにどのようにトランスパイルされるか?
|
# ErgコードはPythonコードにどのようにトランスパイルされるか?
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/compiler/transpile.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/compiler/transpile.md&commit_hash=a9d45b743cc655543e0d7f586426499091cead3d)
|
||||||
|
|
||||||
正確には、ErgコードはPythonバイトコードにトランスパイルされます。
|
正確には、ErgコードはPythonバイトコードにトランスパイルされます。
|
||||||
しかしPythonバイトコードはほぼPythonコードに復元できるので、ここでは等価なPythonコードを例として上げています。
|
しかしPythonバイトコードはほぼPythonコードに復元できるので、ここでは等価なPythonコードを例として上げています。
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 書式
|
# 書式
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/doc_guideline.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/doc_guideline.md&commit_hash=a9d45b743cc655543e0d7f586426499091cead3d)
|
||||||
|
|
||||||
以下のルールに従っていないドキュメントはすべて修正の対象となる。
|
以下のルールに従っていないドキュメントはすべて修正の対象となる。
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Erg design's "Why" and Answers
|
# Erg design's "Why" and Answers
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/faq_syntax.md&commit_hash=1b3d7827bb770459475e4102c6f5c43d8ad79ae4)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/faq_syntax.md&commit_hash=a9d45b743cc655543e0d7f586426499091cead3d)
|
||||||
|
|
||||||
## Erg メモリ管理モデル
|
## Erg メモリ管理モデル
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Pythonのクラスシステム(Ergとの比較)
|
# Pythonのクラスシステム(Ergとの比較)
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/python/class_system.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/python/class_system.md&commit_hash=2ecd249a2a99dc93dde2660b8d50bfa4fa0b03b9)
|
||||||
|
|
||||||
## メソッド
|
## メソッド
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 基本事項
|
# 基本事項
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/00_basic.md&commit_hash=736dcb272d2132883ec7b883f7694829398be61e)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/00_basic.md&commit_hash=b9329fe66e9a24368e1380754fb7a35beb37ab0d)
|
||||||
|
|
||||||
> __Warning__: 本ドキュメントは未完成です。校正(文体、正しいリンクが張られているか、など)がなされていません。また、Ergの文法はバージョン0.*の間に破壊的変更が加えられる可能性があり、それに伴うドキュメントの更新が追いついていない可能性があります。予めご了承ください。
|
> __Warning__: 本ドキュメントは未完成です。校正(文体、正しいリンクが張られているか、など)がなされていません。また、Ergの文法はバージョン0.*の間に破壊的変更が加えられる可能性があり、それに伴うドキュメントの更新が追いついていない可能性があります。予めご了承ください。
|
||||||
> また、本ドキュメントの誤りを見つけた場合は、[こちらのフォーム](https://forms.gle/HtLYRfYzWCAaeTGb6)または[GitHubリポジトリ](https://github.com/mtshiba/TheErgBook/issues/new)から修正の提案をしていただけると幸いです。
|
> また、本ドキュメントの誤りを見つけた場合は、[こちらのフォーム](https://forms.gle/HtLYRfYzWCAaeTGb6)または[GitHubリポジトリ](https://github.com/mtshiba/TheErgBook/issues/new)から修正の提案をしていただけると幸いです。
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# セット
|
# セット
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/14_set.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/14_set.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
セットは集合を表し、データ構造的には重複、順序のない配列です。
|
セットは集合を表し、データ構造的には重複、順序のない配列です。
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# イテレータ
|
# イテレータ
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/16_iterator.md&commit_hash=14657486719a134f494e107774ac8f9d5a63f083)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/16_iterator.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
イテレータは、コンテナの要素を取り出すためのオブジェクトです。
|
イテレータは、コンテナの要素を取り出すためのオブジェクトです。
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 可視性
|
# 可視性
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/19_visibility.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/19_visibility.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
Ergの変数には __可視性__ という概念が存在します。
|
Ergの変数には __可視性__ という概念が存在します。
|
||||||
今まで見てきた変数は全て __プライベート変数(非公開変数)__ と呼ばれます。これは、外部から不可視の変数です。
|
今まで見てきた変数は全て __プライベート変数(非公開変数)__ と呼ばれます。これは、外部から不可視の変数です。
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# モジュール
|
# モジュール
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/24_module.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/24_module.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
Ergでは、ファイル自体を1つのレコードとみなすことができます。これをモジュールと呼びます。
|
Ergでは、ファイル自体を1つのレコードとみなすことができます。これをモジュールと呼びます。
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# デコレータ(修飾子)
|
# デコレータ(修飾子)
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/29_decorator.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/29_decorator.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
デコレータは型や関数に特定の状態や振る舞いを追加したり明示するために使われます。
|
デコレータは型や関数に特定の状態や振る舞いを追加したり明示するために使われます。
|
||||||
デコレータの文法は以下の通りです。
|
デコレータの文法は以下の通りです。
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 添字アクセス
|
# 添字アクセス
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/container_ownership.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/container_ownership.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
`[]`は通常のメソッドとは異なっています。
|
`[]`は通常のメソッドとは異なっています。
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
# Ergの文法一覧 (ver 0.1.0, provisional)
|
# Ergの文法一覧 (ver 0.1.0, provisional)
|
||||||
|
|
||||||
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/grammar.md&commit_hash=f09ef75b8b7bb86f892f224db4392c7c340b1147)
|
||||||
|
|
||||||
```
|
```
|
||||||
special_op ::= '=' | '->' | '=>' | '.' | ',' | ':' | '::' | '|>' | '&'
|
special_op ::= '=' | '->' | '=>' | '.' | ',' | ':' | '::' | '|>' | '&'
|
||||||
separator ::= ';' | '\n'
|
separator ::= ';' | '\n'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 索引
|
# 索引
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/indexes.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/indexes.md&commit_hash=d8472ec748aac5371571da81a161255fe60679b7)
|
||||||
|
|
||||||
この索引にないAPIについては[こちら](../API/index.md)を参照してください。
|
この索引にないAPIについては[こちら](../API/index.md)を参照してください。
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# クイックツアー
|
# クイックツアー
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/quick_tour.md&commit_hash=51016775279ecd28b87178dab6a493a645abb171)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/quick_tour.md&commit_hash=2ecd249a2a99dc93dde2660b8d50bfa4fa0b03b9)
|
||||||
|
|
||||||
`syntax`以下のドキュメントは、概ねプログラミング初心者でも理解できることを目指して書かれています。
|
`syntax`以下のドキュメントは、概ねプログラミング初心者でも理解できることを目指して書かれています。
|
||||||
すでにPythonやRust, Haskellなどの言語を習得されている方にとっては、少し冗長であるかもしれません。
|
すでにPythonやRust, Haskellなどの言語を習得されている方にとっては、少し冗長であるかもしれません。
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# クラス
|
# クラス
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/04_class.md&commit_hash=00350f64a40b12f763a605bc16748d09379ab182)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/04_class.md&commit_hash=a9d45b743cc655543e0d7f586426499091cead3d)
|
||||||
|
|
||||||
Ergにおけるクラスは、大まかには自身の要素(インスタンス)を生成できる型と言えます。
|
Ergにおけるクラスは、大まかには自身の要素(インスタンス)を生成できる型と言えます。
|
||||||
以下は単純なクラスの例です。
|
以下は単純なクラスの例です。
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# rank-2多相
|
# rank-2多相
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/_rank2type.md&commit_hash=00350f64a40b12f763a605bc16748d09379ab182)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/_rank2type.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
> __Warning__: このドキュメントは情報が古く、全般に間違いを含みます。
|
> __Warning__: このドキュメントは情報が古く、全般に間違いを含みます。
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# カインド
|
# カインド
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/kind.md&commit_hash=a9ea4eca75fe849e31f83570159f84b611892d7a)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/kind.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
Ergでは全てが型付けられている。型自体も例外ではない。「型の型」を表すのが __カインド(種)__ である。例えば`1`が`Int`に属しているように、`Int`は`Type`に属している。`Type`は最もシンプルなカインドである __原子カインド(Atomic kind)__ である。型理論的の記法では、`Type`は`*`に対応する。
|
Ergでは全てが型付けられている。型自体も例外ではない。「型の型」を表すのが __カインド(種)__ である。例えば`1`が`Int`に属しているように、`Int`は`Type`に属している。`Type`は最もシンプルなカインドである __原子カインド(Atomic kind)__ である。型理論的の記法では、`Type`は`*`に対応する。
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 型拡大
|
# 型拡大
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/widening.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/widening.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
例えば以下のような多相関数を定義する。
|
例えば以下のような多相関数を定義する。
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 用語辞典
|
# 用語辞典
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/terms.md&commit_hash=1b3d7827bb770459475e4102c6f5c43d8ad79ae4)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/terms.md&commit_hash=132373c23e0d7828a6571b0b74e74ba1608c7a98)
|
||||||
|
|
||||||
## 記号
|
## 記号
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# testサブコマンド
|
# testサブコマンド
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/tools/test.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/tools/test.md&commit_hash=a162001c6fb8938240cd0006b256969cce1298a6)
|
||||||
|
|
||||||
ergコマンドにはtestというサブコマンドがあり、テスト実装、及び実行の支援を行う。
|
ergコマンドにはtestというサブコマンドがあり、テスト実装、及び実行の支援を行う。
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Operator [...T], O
|
# Operator [...T], O
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Operator.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Operator.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
是运算符的类型
|
是运算符的类型
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Ratio
|
# Ratio
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Ratio.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Ratio.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
表示有理数的类型。它主要用于当您要使用分数时
|
表示有理数的类型。它主要用于当您要使用分数时
|
||||||
实际上,Erg中的/运算符返回 Ratio。1/3等不被评估为 0.33333... 并且被处理为1/3。此外,0.1 相当于 1/10。所以`0.1 + 0.2 == 0.3`。这听起来很明显,但在 Python中它是False
|
实际上,Erg中的/运算符返回 Ratio。1/3等不被评估为 0.33333... 并且被处理为1/3。此外,0.1 相当于 1/10。所以`0.1 + 0.2 == 0.3`。这听起来很明显,但在 Python中它是False
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Tensor Shape: [Nat; N]
|
# Tensor Shape: [Nat; N]
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Tensor.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Tensor.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
用于有效操作多维数组的类。它还定义了诸如多维数组上的乘法之类的操作
|
用于有效操作多维数组的类。它还定义了诸如多维数组上的乘法之类的操作
|
||||||
Matrix、Vector 等都继承自该类型
|
Matrix、Vector 等都继承自该类型
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# UnaryOp T, O
|
# UnaryOp T, O
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/patches/UnaryOp.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/patches/UnaryOp.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
一元运算符的类型
|
一元运算符的类型
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Erg 代码如何转译成 Python 代码?
|
# Erg 代码如何转译成 Python 代码?
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/compiler/transpile.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/compiler/transpile.md&commit_hash=a9d45b743cc655543e0d7f586426499091cead3d)
|
||||||
|
|
||||||
准确地说,Erg 代码被转译为 Python 字节码
|
准确地说,Erg 代码被转译为 Python 字节码
|
||||||
但是,由于 Python 字节码几乎可以重构为 Python 代码,因此这里以等效的 Python 代码为例
|
但是,由于 Python 字节码几乎可以重构为 Python 代码,因此这里以等效的 Python 代码为例
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 格式
|
# 格式
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/doc_guideline.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/doc_guideline.md&commit_hash=a9d45b743cc655543e0d7f586426499091cead3d)
|
||||||
|
|
||||||
任何不符合以下规则的文件都将得到更正
|
任何不符合以下规则的文件都将得到更正
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Erg 部分设计的原因
|
# Erg 部分设计的原因
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/faq_syntax.md&commit_hash=1b3d7827bb770459475e4102c6f5c43d8ad79ae4)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/faq_syntax.md&commit_hash=a9d45b743cc655543e0d7f586426499091cead3d)
|
||||||
|
|
||||||
## Erg内存管理模型
|
## Erg内存管理模型
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Python 类系统(与 Erg 比较)
|
# Python 类系统(与 Erg 比较)
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/python/class_system.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/python/class_system.md&commit_hash=2ecd249a2a99dc93dde2660b8d50bfa4fa0b03b9)
|
||||||
|
|
||||||
## 方法
|
## 方法
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 基本
|
# 基本
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/00_basic.md&commit_hash=736dcb272d2132883ec7b883f7694829398be61e)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/00_basic.md&commit_hash=b9329fe66e9a24368e1380754fb7a35beb37ab0d)
|
||||||
|
|
||||||
> __Warning__: 本文档不完整。它未经校对(样式、正确链接、误译等)。此外,Erg 的语法可能在版本 0.* 期间发生破坏性更改,并且文档可能没有相应更新。请事先了解这一点
|
> __Warning__: 本文档不完整。它未经校对(样式、正确链接、误译等)。此外,Erg 的语法可能在版本 0.* 期间发生破坏性更改,并且文档可能没有相应更新。请事先了解这一点
|
||||||
> 如果您在本文档中发现任何错误,请报告至 [此处的表单](https://forms.gle/HtLYRfYzWCAaeTGb6) 或 [GitHub repo](https://github.com/mtshiba/TheErgBook/issues/new )。我们将不胜感激您的建议
|
> 如果您在本文档中发现任何错误,请报告至 [此处的表单](https://forms.gle/HtLYRfYzWCAaeTGb6) 或 [GitHub repo](https://github.com/mtshiba/TheErgBook/issues/new )。我们将不胜感激您的建议
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Set
|
# Set
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/14_set.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/14_set.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
一个Set代表一个集合,它在结构上是一个重复的无序数组
|
一个Set代表一个集合,它在结构上是一个重复的无序数组
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 迭代器
|
# 迭代器
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/16_iterator.md&commit_hash=14657486719a134f494e107774ac8f9d5a63f083)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/16_iterator.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
迭代器是用于检索容器元素的对象
|
迭代器是用于检索容器元素的对象
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 可见性
|
# 可见性
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/19_visibility.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/19_visibility.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
Erg 变量具有 __visibility__ 的概念
|
Erg 变量具有 __visibility__ 的概念
|
||||||
到目前为止,我们看到的所有变量都称为 __private variables__。这是一个外部不可见的变量
|
到目前为止,我们看到的所有变量都称为 __private variables__。这是一个外部不可见的变量
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 模块
|
# 模块
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/24_module.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/24_module.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
Erg允许您将文件本身视为单个记录(Record)。这称为模块。
|
Erg允许您将文件本身视为单个记录(Record)。这称为模块。
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 装饰器(修饰符)
|
# 装饰器(修饰符)
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/29_decorator.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/29_decorator.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
装饰器用于向类型或函数添加或演示特定状态或行为
|
装饰器用于向类型或函数添加或演示特定状态或行为
|
||||||
装饰器的语法如下
|
装饰器的语法如下
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 下标(索引访问)
|
# 下标(索引访问)
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/container_ownership.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/container_ownership.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
`[]` 不同于普通的方法
|
`[]` 不同于普通的方法
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
# Erg 的语法(版本 0.1.0, 临时)
|
# Erg 的语法(版本 0.1.0, 临时)
|
||||||
|
|
||||||
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/grammar.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
```
|
```
|
||||||
special_op ::= '=' | '->' | '=>' | '.' | ',' | ':' | '::' | '|>' | '&'
|
special_op ::= '=' | '->' | '=>' | '.' | ',' | ':' | '::' | '|>' | '&'
|
||||||
separator ::= ';' | '\n'
|
separator ::= ';' | '\n'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 指数
|
# 指数
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/indexes.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/indexes.md&commit_hash=d8472ec748aac5371571da81a161255fe60679b7)
|
||||||
|
|
||||||
有关不在此索引中的 API,请参阅 [此处](../API/index.md)
|
有关不在此索引中的 API,请参阅 [此处](../API/index.md)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 快速浏览
|
# 快速浏览
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/quick_tour.md&commit_hash=51016775279ecd28b87178dab6a493a645abb171)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/quick_tour.md&commit_hash=2ecd249a2a99dc93dde2660b8d50bfa4fa0b03b9)
|
||||||
|
|
||||||
`syntax` 下面的文档是为了让编程初学者也能理解而编写的
|
`syntax` 下面的文档是为了让编程初学者也能理解而编写的
|
||||||
对于已经掌握 Python、Rust、Haskell 等语言的人来说,可能有点啰嗦
|
对于已经掌握 Python、Rust、Haskell 等语言的人来说,可能有点啰嗦
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Class
|
# Class
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/04_class.md&commit_hash=00350f64a40b12f763a605bc16748d09379ab182)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/04_class.md&commit_hash=a9d45b743cc655543e0d7f586426499091cead3d)
|
||||||
|
|
||||||
Erg 中的类大致是一种可以创建自己的元素(实例)的类型
|
Erg 中的类大致是一种可以创建自己的元素(实例)的类型
|
||||||
这是一个简单类的示例
|
这是一个简单类的示例
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Kind
|
# Kind
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/kind.md&commit_hash=a9ea4eca75fe849e31f83570159f84b611892d7a)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/kind.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
一切都在 Erg 中输入。类型本身也不例外。__kind__ 表示"类型的类型"。例如,`Int` 属于 `Type`,就像 `1` 属于 `Int`。`Type` 是最简单的一种,__atomic kind__。在类型论符号中,`Type` 对应于 `*`
|
一切都在 Erg 中输入。类型本身也不例外。__kind__ 表示"类型的类型"。例如,`Int` 属于 `Type`,就像 `1` 属于 `Int`。`Type` 是最简单的一种,__atomic kind__。在类型论符号中,`Type` 对应于 `*`
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 指示转换运算符关键字: widening
|
# 指示转换运算符关键字: widening
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/widening.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/widening.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
例如,定义多相关系数如下
|
例如,定义多相关系数如下
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 词汇表
|
# 词汇表
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/terms.md&commit_hash=1b3d7827bb770459475e4102c6f5c43d8ad79ae4)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/terms.md&commit_hash=132373c23e0d7828a6571b0b74e74ba1608c7a98)
|
||||||
|
|
||||||
## 符号
|
## 符号
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 测试子命令
|
# 测试子命令
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/tools/test.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/tools/test.md&commit_hash=a162001c6fb8938240cd0006b256969cce1298a6)
|
||||||
|
|
||||||
erg 命令有一个名为 test 的子命令,它支持测试的实现和执行
|
erg 命令有一个名为 test 的子命令,它支持测试的实现和执行
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Operator [...T], O
|
# Operator [...T], O
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Operator.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Operator.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
是運算符的類型
|
是運算符的類型
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Ratio
|
# Ratio
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Ratio.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Ratio.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
表示有理數的類型。它主要用于當您要使用分數時
|
表示有理數的類型。它主要用于當您要使用分數時
|
||||||
實際上,Erg中的/運算符返回 Ratio。1/3等不被評估為 0.33333... 并且被處理為1/3。此外,0.1 相當于 1/10。所以`0.1 + 0.2 == 0.3`。這聽起來很明顯,但在 Python中它是False
|
實際上,Erg中的/運算符返回 Ratio。1/3等不被評估為 0.33333... 并且被處理為1/3。此外,0.1 相當于 1/10。所以`0.1 + 0.2 == 0.3`。這聽起來很明顯,但在 Python中它是False
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Tensor Shape: [Nat; N]
|
# Tensor Shape: [Nat; N]
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Tensor.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Tensor.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
用于有效操作多維數組的類。它還定義了諸如多維數組上的乘法之類的操作
|
用于有效操作多維數組的類。它還定義了諸如多維數組上的乘法之類的操作
|
||||||
Matrix、Vector 等都繼承自該類型
|
Matrix、Vector 等都繼承自該類型
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# UnaryOp T, O
|
# UnaryOp T, O
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/patches/UnaryOp.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/patches/UnaryOp.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
一元運算符的類型
|
一元運算符的類型
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Erg 代碼如何轉譯成 Python 代碼?
|
# Erg 代碼如何轉譯成 Python 代碼?
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/compiler/transpile.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/compiler/transpile.md&commit_hash=a9d45b743cc655543e0d7f586426499091cead3d)
|
||||||
|
|
||||||
準確地說,Erg 代碼被轉譯為 Python 字節碼
|
準確地說,Erg 代碼被轉譯為 Python 字節碼
|
||||||
但是,由于 Python 字節碼幾乎可以重構為 Python 代碼,因此這里以等效的 Python 代碼為例
|
但是,由于 Python 字節碼幾乎可以重構為 Python 代碼,因此這里以等效的 Python 代碼為例
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 格式
|
# 格式
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/doc_guideline.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/doc_guideline.md&commit_hash=a9d45b743cc655543e0d7f586426499091cead3d)
|
||||||
|
|
||||||
任何不符合以下規則的文件都將得到更正
|
任何不符合以下規則的文件都將得到更正
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Erg 部分設計的原因
|
# Erg 部分設計的原因
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/faq_syntax.md&commit_hash=1b3d7827bb770459475e4102c6f5c43d8ad79ae4)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/faq_syntax.md&commit_hash=a9d45b743cc655543e0d7f586426499091cead3d)
|
||||||
|
|
||||||
## Erg內存管理模型
|
## Erg內存管理模型
|
||||||
|
|
||||||
|
@ -80,11 +80,11 @@ try!:
|
||||||
|
|
||||||
此外,Erg 沒有引入異常機制的另一個原因是它計劃引入并行編程的功能。這是因為異常機制與并行執行不兼容(例如,如果并行執行導致多個異常,則很難處理)
|
此外,Erg 沒有引入異常機制的另一個原因是它計劃引入并行編程的功能。這是因為異常機制與并行執行不兼容(例如,如果并行執行導致多個異常,則很難處理)
|
||||||
|
|
||||||
## Erg似乎删除了被認為是糟糕實踐的Python特性,為什麼不取消繼承呢?
|
## Erg似乎刪除了被認為是糟糕實踐的Python特性,為什么不取消繼承呢?
|
||||||
|
|
||||||
這是因為Python庫中的類是在假定它們將被繼承的基礎上設計的,如果完全取消繼承,那麼它們的操作就會出現問題
|
這是因為Python庫中的類是在假定它們將被繼承的基礎上設計的,如果完全取消繼承,那么它們的操作就會出現問題
|
||||||
|
|
||||||
然而,在Erg中,默認情况下類是final的,原則上禁止多重/多級繼承,囙此可以相對安全地使用繼承
|
然而,在Erg中,默認情況下類是final的,原則上禁止多重/多級繼承,因此可以相對安全地使用繼承
|
||||||
|
|
||||||
## 為什么多相關數的子類型推理默認指向記名trait?
|
## 為什么多相關數的子類型推理默認指向記名trait?
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Python 類系統(與 Erg 比較)
|
# Python 類系統(與 Erg 比較)
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/python/class_system.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/python/class_system.md&commit_hash=2ecd249a2a99dc93dde2660b8d50bfa4fa0b03b9)
|
||||||
|
|
||||||
## 方法
|
## 方法
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 基本
|
# 基本
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/00_basic.md&commit_hash=736dcb272d2132883ec7b883f7694829398be61e)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/00_basic.md&commit_hash=b9329fe66e9a24368e1380754fb7a35beb37ab0d)
|
||||||
|
|
||||||
> __Warning__: 本文檔不完整。它未經校對(樣式、正確鏈接、誤譯等)。此外,Erg 的語法可能在版本 0.* 期間發生破壞性更改,并且文檔可能沒有相應更新。請事先了解這一點
|
> __Warning__: 本文檔不完整。它未經校對(樣式、正確鏈接、誤譯等)。此外,Erg 的語法可能在版本 0.* 期間發生破壞性更改,并且文檔可能沒有相應更新。請事先了解這一點
|
||||||
> 如果您在本文檔中發現任何錯誤,請報告至 [此處的表單](https://forms.gle/HtLYRfYzWCAaeTGb6) 或 [GitHub repo](https://github.com/mtshiba/TheErgBook/issues/new )。我們將不勝感激您的建議
|
> 如果您在本文檔中發現任何錯誤,請報告至 [此處的表單](https://forms.gle/HtLYRfYzWCAaeTGb6) 或 [GitHub repo](https://github.com/mtshiba/TheErgBook/issues/new )。我們將不勝感激您的建議
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Set
|
# Set
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/14_set.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/14_set.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
一個Set代表一個集合,它在結構上是一個重復的無序數組
|
一個Set代表一個集合,它在結構上是一個重復的無序數組
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 迭代器
|
# 迭代器
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/16_iterator.md&commit_hash=14657486719a134f494e107774ac8f9d5a63f083)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/16_iterator.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
迭代器是用于檢索容器元素的對象
|
迭代器是用于檢索容器元素的對象
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 可見性
|
# 可見性
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/19_visibility.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/19_visibility.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
Erg 變量具有 __visibility__ 的概念
|
Erg 變量具有 __visibility__ 的概念
|
||||||
到目前為止,我們看到的所有變量都稱為 __private variables__。這是一個外部不可見的變量
|
到目前為止,我們看到的所有變量都稱為 __private variables__。這是一個外部不可見的變量
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 模塊
|
# 模塊
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/24_module.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/24_module.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
Erg允許您將文件本身視為單個記錄(Record)。這稱為模塊。
|
Erg允許您將文件本身視為單個記錄(Record)。這稱為模塊。
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 裝飾器(修飾符)
|
# 裝飾器(修飾符)
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/29_decorator.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/29_decorator.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
裝飾器用于向類型或函數添加或演示特定狀態或行為
|
裝飾器用于向類型或函數添加或演示特定狀態或行為
|
||||||
裝飾器的語法如下
|
裝飾器的語法如下
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 下標(索引訪問)
|
# 下標(索引訪問)
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/container_ownership.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/container_ownership.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
`[]` 不同于普通的方法
|
`[]` 不同于普通的方法
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
# Erg 的語法(版本 0.1.0, 臨時)
|
# Erg 的語法(版本 0.1.0, 臨時)
|
||||||
|
|
||||||
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/grammar.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
```
|
```
|
||||||
special_op ::= '=' | '->' | '=>' | '.' | ',' | ':' | '::' | '|>' | '&'
|
special_op ::= '=' | '->' | '=>' | '.' | ',' | ':' | '::' | '|>' | '&'
|
||||||
separator ::= ';' | '\n'
|
separator ::= ';' | '\n'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 指數
|
# 指數
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/indexes.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/indexes.md&commit_hash=d8472ec748aac5371571da81a161255fe60679b7)
|
||||||
|
|
||||||
有關不在此索引中的 API,請參閱 [此處](../API/index.md)
|
有關不在此索引中的 API,請參閱 [此處](../API/index.md)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 快速瀏覽
|
# 快速瀏覽
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/quick_tour.md&commit_hash=51016775279ecd28b87178dab6a493a645abb171)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/quick_tour.md&commit_hash=2ecd249a2a99dc93dde2660b8d50bfa4fa0b03b9)
|
||||||
|
|
||||||
`syntax` 下面的文檔是為了讓編程初學者也能理解而編寫的
|
`syntax` 下面的文檔是為了讓編程初學者也能理解而編寫的
|
||||||
對于已經掌握 Python、Rust、Haskell 等語言的人來說,可能有點啰嗦
|
對于已經掌握 Python、Rust、Haskell 等語言的人來說,可能有點啰嗦
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Class
|
# Class
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/04_class.md&commit_hash=00350f64a40b12f763a605bc16748d09379ab182)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/04_class.md&commit_hash=a9d45b743cc655543e0d7f586426499091cead3d)
|
||||||
|
|
||||||
Erg 中的類大致是一種可以創建自己的元素(實例)的類型
|
Erg 中的類大致是一種可以創建自己的元素(實例)的類型
|
||||||
這是一個簡單類的示例
|
這是一個簡單類的示例
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Kind
|
# Kind
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/kind.md&commit_hash=a9ea4eca75fe849e31f83570159f84b611892d7a)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/kind.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
一切都在 Erg 中輸入。類型本身也不例外。__kind__ 表示"類型的類型"。例如,`Int` 屬于 `Type`,就像 `1` 屬于 `Int`。`Type` 是最簡單的一種,__atomic kind__。在類型論符號中,`Type` 對應于 `*`
|
一切都在 Erg 中輸入。類型本身也不例外。__kind__ 表示"類型的類型"。例如,`Int` 屬于 `Type`,就像 `1` 屬于 `Int`。`Type` 是最簡單的一種,__atomic kind__。在類型論符號中,`Type` 對應于 `*`
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 指示轉換運算符關鍵字: widening
|
# 指示轉換運算符關鍵字: widening
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/widening.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/widening.md&commit_hash=b07c17708b9141bbce788d2e5b3ad4f365d342fa)
|
||||||
|
|
||||||
例如,定義多相關系數如下
|
例如,定義多相關系數如下
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 詞匯表
|
# 詞匯表
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/terms.md&commit_hash=1b3d7827bb770459475e4102c6f5c43d8ad79ae4)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/terms.md&commit_hash=132373c23e0d7828a6571b0b74e74ba1608c7a98)
|
||||||
|
|
||||||
## 符號
|
## 符號
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 測試子命令
|
# 測試子命令
|
||||||
|
|
||||||
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/tools/test.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)
|
[](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/tools/test.md&commit_hash=a162001c6fb8938240cd0006b256969cce1298a6)
|
||||||
|
|
||||||
erg 命令有一個名為 test 的子命令,它支持測試的實現和執行
|
erg 命令有一個名為 test 的子命令,它支持測試的實現和執行
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue