For Non-Japanese
Hi, I'm debiru, and the author this thread.
I have translated the Gleam Language Tour into Japanese and published it. I also developed a playground where you can customize pages with JavaScript and execute code. I have provided the ability to save your code as a URL. For example, this is my code for FizzBuzz.
https://gleam.lavoscore.org/table-of-contents/?code=aW1wb3J0IG...
In the rest of this article, I will introduce the Gleam sample code and the Gleam community along with my developments for the Japanese. That's all for non-Japanese in this article. Thanks.
For Japanese
こんにちは。debiru です。Gleam (グリーム)というプログラミング言語があるのですが、最近(2024年2月10日頃)に v1.0.0-rc1 がリリースされました。Gleam は Rust で実装され Erlang VM (BEAM) 上で動作する言語です。
Japanese document
Gleam の公式ドキュメントはいくつか存在しています。
- Documentation – Gleam
- Language tour - The Gleam Book
- Welcome to the Gleam language tour! 💫 - The Gleam Language Tour
この最後に挙げた Tour は 2024 年に公開されたコンテンツです。Gleam の構文や機能をプレイグラウンドでコードを実際に実行しながら学習することができます。
しかし、説明文が英語のままでは初学者はとっつきにくいですよね。
ということで、この度、この Gleam Language Tour を日本語訳して公開しました。
本家 Tour では Table of Contents が常に表示されておらず使いづらかったので、ページをカスタマイズしてサイドバーに常時表示するようにしてあります。
また、プレイグラウンドのコードを URL でシェアできるように保存機能を付けました。
Sample code - FizzBuzz
以下はサンプルで書いた FizzBuzz のコードです。
https://gleam.lavoscore.org/table-of-contents/?code=aW1wb3J0IG...
Gleam では FizzBuzz を以下のように実装できます。
import gleam/io
import gleam/int
import gleam/list
// This is a sample code for studing Gleam.
// And here is the code to introduce this playground.
// You can save your code as the URL by clicking on the Save button in the upper right corner.
pub fn main() {
fizzbuzz(100)
}
fn fizzbuzz(n: Int) {
let impl_1 = fn(n: Int) -> String {
case n % 3, n % 5 {
0, 0 -> "FizzBuzz"
0, _ -> "Fizz"
_, 0 -> "Buzz"
_, _ -> int.to_string(n)
}
}
let _impl_2 = fn(n: Int) -> String {
let result = case n % 3 { 0 -> "Fizz" _ -> "" }
let result = case n % 5 { 0 -> result <> "Buzz" _ -> result }
case result { "" -> int.to_string(n) _ -> result }
}
list.range(1, n)
|> list.map(impl_1)
|> list.each(io.println)
}
Gleam community
https://gleam.lavoscore.org/ トップページに以下のような記述があります。
もし行き詰まったり、質問がある場合は、遠慮なく the Gleam Discord server でお尋ねください。もし、あなたが分かりにくいと感じたことがあれば、他の人も同じように感じている可能性があります。このツアーをより良いものにするために、私たちはそれを知りたいのです。
https://gleam.lavoscore.org/what-next/ また、最後のページには次のように書かれています。
the Gleam Discord server に参加して、コミュニティに会いましょう。彼らはフレンドリーで親切です!
Gleam コミュニティは Discord で初学者からの質問などを受け付けています。コミュニケーションする際の言語は英語ですが、和気あいあいとしているので Gleam に興味を持った方はぜひ参加してみてください。
わからないことがあれば、この Qiita ページのコメント欄でも質問してくれれば私が回答します。
みなさん Gleam 言語を触っていきましょう!