-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] manual/variables.rst #7
Open
sorami
wants to merge
6
commits into
JuliaTokyo:master
Choose a base branch
from
sorami:variables
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7f8f5a8
Add a partial draft of chapter Variables
fc9cdc9
Update original English text, to keep it up to date w/ newest ver
ad01770
Update according to the comments for the pull request
c9e8e8b
Add a few translation text about allowed variable characters
feac48d
Minor word change
8484ff0
Reflect the updates in master
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
|
||
*********** | ||
Variables | ||
変数 | ||
*********** | ||
|
||
A variable, in Julia, is a name associated (or bound) to a value. It's useful when you want to store a value (that you obtained after some math, for example) for later use. For example: | ||
|
||
Juliaでは、変数は値に結び付けられた(束縛された)名前です。これは、(例えば計算結果などの)値を後で使うためにしまっておくのに便利です。以下に例を示します。 | ||
|
||
.. doctest:: | ||
|
||
# Assign the value 10 to the variable x | ||
|
@@ -23,10 +25,31 @@ A variable, in Julia, is a name associated (or bound) to a value. It's useful wh | |
julia> x = "Hello World!" | ||
"Hello World!" | ||
|
||
.. doctest:: | ||
|
||
# 10という値を変数xに割り当てる | ||
julia> x = 10 | ||
10 | ||
|
||
# xの値を使って計算する | ||
julia> x + 1 | ||
11 | ||
|
||
# xに値を再度割り当てる | ||
julia> x = 1 + 1 | ||
2 | ||
|
||
# 別の型の値、例えば文字列を割り当てることもできる | ||
julia> x = "Hello World!" | ||
"Hello World!" | ||
|
||
Julia provides an extremely flexible system for naming variables. | ||
Variable names are case-sensitive, and have no semantic meaning (that is, | ||
the language will not treat variables differently based on their names). | ||
|
||
Juliaでは、非常に柔軟に変数を命名することができます。 | ||
変数名の大文字と小文字は区別されますが、セマンティクスでの意味を持つわけではありません(言語は名前によって変数の扱いを変えない、ということです)。 | ||
|
||
.. raw:: latex | ||
|
||
\begin{CJK*}{UTF8}{gbsn} | ||
|
@@ -54,6 +77,8 @@ the language will not treat variables differently based on their names). | |
|
||
Unicode names (in UTF-8 encoding) are allowed: | ||
|
||
(UTF-8エンコーディングの)ユニコードでの名前を使うこともできます。 | ||
|
||
.. raw:: latex | ||
|
||
\begin{CJK*}{UTF8}{mj} | ||
|
@@ -72,12 +97,16 @@ name followed by tab. For example, the variable name ``δ`` can be | |
entered by typing ``\delta``-*tab*, or even ``α̂₂`` by | ||
``\alpha``-*tab*-``\hat``-*tab*-``\_2``-*tab*. | ||
|
||
JuliaのREPLや、その他いくつかの編集環境では、バックスラッシュから始まるLaTeX記号名、そしてその後にタブを入力することで、様々なユニコード数学記号を入力することができます。 例えば、 変数名 ``δ`` は ``\delta``-*タブ* 、``α̂₂`` は ``\alpha``-*tab*-``\hat``-*tab*-``\_2``-*tab* とすることで入力することができます。 | ||
|
||
.. raw:: latex | ||
|
||
\end{CJK*} | ||
|
||
Julia will even let you redefine built-in constants and functions if needed: | ||
|
||
もし必要であれば、Juliaでは、ビルトインの定数や関数を再定義することすらできます。 | ||
|
||
.. doctest:: | ||
|
||
julia> pi | ||
|
@@ -99,9 +128,14 @@ Julia will even let you redefine built-in constants and functions if needed: | |
|
||
However, this is obviously not recommended to avoid potential confusion. | ||
|
||
とはいえ、潜在的な混乱を避けるため、これはもちろん推奨されません。 | ||
|
||
Allowed Variable Names | ||
====================== | ||
|
||
許可される変数名 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 利用可能な変数名 |
||
====================== | ||
|
||
Variable names must begin with a letter (A-Z or a-z), underscore, or a | ||
subset of Unicode code points greater than 00A0; in particular, `Unicode character categories`_ Lu/Ll/Lt/Lm/Lo/Nl (letters), Sc/So (currency and | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. コードポイント |
||
other symbols), and a few other letter-like characters (e.g. a subset | ||
|
@@ -111,6 +145,12 @@ as well as other Unicode code points: diacritics and other modifying | |
marks (categories Mn/Mc/Me/Sk), some punctuation connectors (category | ||
Pc), primes, and a few other characters. | ||
|
||
変数名の最初は、アルファベット(A-Zもしくはa-z)、アンダースコア、そして00A0より大きい場所を指し示すユニコードから始まる必要があります。 | ||
ユニコードは特に、`Unicode character categories`_ Lu/Ll/Lt/Lm/Lo/Nl(文字)、Sc/So (通貨とその他の記号)、そしていくつかの文字(letter)のような字(character)(例:Sm数学記号の一部)を使うことができます。 | ||
最初の文字以降は、!や数字(0-9とNd/Noカテゴリにあるその他の文字)、そしてその他のユニコードも使うことができます。 | ||
使用可能なユニコードとしては、 | ||
発音区別記号(訳注: ``´`` や `````、 ``^`` など)やその他の修飾記号(Mn/Mc/Me/Skカテゴリ)、いくつかの句読点(punctuation connectors)(Pcカテゴリ)、プライム記号(訳注: xxx)、そしてその他いくつかの文字があります。 | ||
|
||
.. _Unicode character categories: http://www.fileformat.info/info/unicode/category/index.htm | ||
|
||
Operators like ``+`` are also valid identifiers, but are parsed specially. In | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
セマンティクス
プログラム意味論的な
省いてしまっても良い?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
言語は名前によって変数の扱いを変えない
言語は、その変数の名前によって扱いを変えない
変数の名前が扱いに影響を与えない
名前によって、変数の取り扱いを変えない
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
意味(semantic meaning)