LoginSignup
0
0

More than 1 year has passed since last update.

Gauche を Ubuntu にインストール (also macos ?)

Last updated at Posted at 2022-02-22

30分で Gauche / Scheme にチョット慣れる
https://qiita.com/nanbuwks/items/fa784e5793cd8cfd2cb3

環境

  • Ubuntu 20.04 LTS / Ubuntu 22.04 LTS
  • Mac も同様? (未検証)
  • Gauche は Ubuntu レポジトリ / homebrew からインストール
    • Ubuntuレポジトリインストール ( Ubuntu20.04 2022年02月22日 )
    • Gauche scheme shell, version 0.9.6 [utf-8,pthreads], x86_64-pc-linux-gnu

本体と、rlwrapのインストール

インタープリター環境のREPL を使う場合、rlwrap を使うと入力補助ができる。gauche と一緒にrlwarp もインストールします。

Ubuntu の場合

レポジトリからインストール します。

$ sudo apt install gauche
$ sudo apt install rlwrap

macos の場合

homebrew からインストールします。

$ brew install gauche
$ brew install rlwrap

起動

$ gosh

で起動します。

(exit) で終了します。

以下のようにして起動すると、矢印で履歴が呼び出せるようになります。

$ rlwrap gosh

入力補完

「改めてGaucheとrlwrapの連携について - 再帰の反復blog」
https://lemniscus.hatenablog.com/entry/20100701/1277990269
に掲載されているプログラムを使いました。

コピペしてmake_gosh_completions.scm というファイルにし、


$ gosh make_gosh_completions.scm  > ~/.gosh_completions

として予約語ファイルを作ります。


$ vim ~/.bashrc

として、以下を末尾に追加


export RLWRAP_EDITOR='vim -c "set filetype=scheme"'
alias gosh='rlwrap -c -q '\''"'\'' -b "'\''\"\`(){}[],#@;|" gosh -i -I "."'

alias の書式は
「UbuntuにScheme処理系Gaucheをインストールする: いおりのプログラミングめも」
http://fanblogs.jp/iorisprogramming/archive/19/0
に掲載されているものを使いました。


$ source ~/.bashrc

として反映します。


$ gosh

で起動して、履歴や補完ができることを確認します。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0