Phel の Pharファイルが公開されたので、試してみるのが非常に簡単になりました。
2025/06/11
2025/06/19

Phelを試すのが更に簡単になりました。PHP(8.2以上)の実行環境があれば、phel.phar ファイルをダウンロードするだけで、phel-langを実行できます。dockerやcomposerが無くても良くなるので、とりあえず触ってみるのは簡単です。
準備
phel.pharをダウンロードして、実行権限を付けるだけです。(Windowsなら実行権限も不要かもしれません)
v0.18.1 がリリースされていますので、v0.18.1 の phel.phar をダウンロードします。
$ curl -OL https://github.com/phel-lang/phel-lang/releases/download/v0.18.1/phel.phar
$ chmod +x phel.phar
これで準備は完了です。phel-lang 0.18.0 で追加された doctor コマンドで動作環境に問題がないかを確認してみます。
$ ./phel.phar doctor
Checking requirements:
- PHP >= 8.2: OK
- json extension: OK
- mbstring extension: OK
- readline extension: OK
Your system meets all requirements.
OKでした。
REPLの実行
REPLを起動して 1 + 2 + 3 の結果を表示してみました。
$ ./phel.phar repl
Welcome to the Phel Repl
Type "exit" or press Ctrl-D to exit.
phel:1> (println (+ 1 2 3))
6
nil
phelのスクリプトファイルの実行
では、次にphelのコードが書かれたファイルを実行してみます。
src/hello.phel
(ns hello
(:require phel\str))
(println "Hello, phel")
(as-> "The Phel Language" it
(str/upper-case it)
(str/pad-left it 30 " ")
(println it))
run に続けてhello.phelのパスを指定することで実行できます。
$ ./phel.phar run src/hello.phel
Hello, phel
THE PHEL LANGUAGE
hello.phelを実行することができました。
次は、別のファイルの関数を使う例を実行してみます。
src/module.phel
(ns module)
(defn get-title []
"from module.")
src/call.phel
(ns call
(:require module))
(println "call file")
(println (module/get-title))
上の2つのファイルを用意して、call.phelを実行します。
$ ./phel.phar run src/call.phel
call file
from module.
call.phelを実行して、module.phelの関数を利用できたことがわかります。
9件のピンバック
azithromycin tablets 250 mg
bnf metoprolol
lasix medicine for fluid
sildenafil mean
sildenafil price usa
semaglutide bijwerkingen lange termijn
doxycycline hyclate 100mg india
doxycycline use in kittens
doxycycline hyclate dry skin