vscode scheme開発環境構成

16573 ワード

概要
最近SICPを勉強するつもりですが、Schemeの開発環境を設定する必要があります.ネット上のブログを見て、以下の環境を採用することにしました.
OS:Windows 10
解釈器:Chez Scheme(公式サイト、もしダウンロードするのが遅いならば直接私のアップロードしたwindowsインストーラをダウンロードすることができますhttps://download.csdn.net/download/weixin_43972675/12529778)
エディタ:Visual Studioコード(プラグインvscode-scheme,Code Runnerを構成する必要があります)
環境変数の構成
Schemeのインストール後、環境変数を設定し、Pathに追加
C:\Program Files\Chez Scheme 9.5\bin\ta6nt          #64 windows
C:\Program Files (x86)\Chez Scheme 9.5\bin\ti3nt    #32 windows

保存後CMDにSchemeを入力するとSchemeインタラクティブ実行環境に入る
C:\Users\shadowgully>scheme
Chez Scheme Version 9.5
Copyright 1984-2017 Cisco Systems, Inc.

> (define pow (lambda (x) (* x x)))   # 
> (define xdof (lambda (f x) (f x)))  # x f 
> (xdof pow 7)                        # 7 
49                                    # 
> (exit)                              # 

VSCode構成
Extensionsにschemeを入力し、vscode-schemeを選択してinstallをクリックします.
完了したらExtensionsにcode runnerを入力し、code runnerを選択してinstallをクリックします.
code runnerのインストールが完了したら、必要な構成が必要です.
Vscode左下のギアをクリックしてsettingを選択し、(グラフィックインタフェースなら右上のOpen Settings(JSON)をクリック)、設定ファイルを編集します.私はvscodeでpythonを書いたことがあるので、プロファイルにはすでに一部の内容があります.
{
    "python.pythonPath": "C:\\Python\\Python38\\python.exe"
}

私たちが参加しなければならない内容は
{
    "code-runner.runInTerminal": true,
    "code-runner.executorMapByFileExtension": {
    ".ss": "scheme"
    }
}

追加されたフォーマットは次のとおりです(2つの構成の間にカンマ間隔が必要です).
{
    "python.pythonPath": "C:\\Python\\Python38\\python.exe",
    "code-runner.runInTerminal": true,
    "code-runner.executorMapByFileExtension": {
    ".ss": "scheme"
    }
}

しかし、この時点で私たちは実行します.ss接尾辞のschemeコードには、次のエラーが表示されます.
PS D:\Desktop\lisp\scheme> csi -script "d:\Desktop\lisp\scheme\try.ss"
csi :  “csi”  cmdlet、 、 。 , , , 。
   :1  : 1
+ csi -script "d:\Desktop\lisp\scheme\try.ss"
+ ~~~
    + CategoryInfo          : ObjectNotFound: (csi:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

schemeのコマンドラインパラメータは期待するschemeではなくcsi-scriptです.どうすればいいですか.さっきのsettingsで.jsonに「code-runner.executorMap」と入力と、一連の異なる言語のコマンドライン構成が自動的にポップアップされ、「scheme」:「csi-script」を見つけ、それを「scheme」:「scheme」に変更して保存し、vscodeで実行することができる.ss接尾辞のschemeコード
{
    "python.pythonPath": "C:\\Python\\Python38\\python.exe",
    "code-runner.runInTerminal": true,
    "code-runner.executorMapByFileExtension": {
    ".ss": "scheme"
    },
    "code-runner.executorMap": {
        "javascript": "node",
        "java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
        "c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "objective-c": "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "php": "php",
        "python": "python -u",
        "perl": "perl",
        "perl6": "perl6",
        "ruby": "ruby",
        "go": "go run",
        "lua": "lua",
        "groovy": "groovy",
        "powershell": "powershell -ExecutionPolicy ByPass -File",
        "bat": "cmd /c",
        "shellscript": "bash",
        "fsharp": "fsi",
        "csharp": "scriptcs",
        "vbscript": "cscript //Nologo",
        "typescript": "ts-node",
        "coffeescript": "coffee",
        "scala": "scala",
        "swift": "swift",
        "julia": "julia",
        "crystal": "crystal",
        "ocaml": "ocaml",
        "r": "Rscript",
        "applescript": "osascript",
        "clojure": "lein exec",
        "haxe": "haxe --cwd $dirWithoutTrailingSlash --run $fileNameWithoutExt",
        "rust": "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",
        "racket": "racket",
        "scheme": "scheme",
        "ahk": "autohotkey",
        "autoit": "autoit3",
        "dart": "dart",
        "pascal": "cd $dir && fpc $fileName && $dir$fileNameWithoutExt",
        "d": "cd $dir && dmd $fileName && $dir$fileNameWithoutExt",
        "haskell": "runhaskell",
        "nim": "nim compile --verbosity:0 --hints:off --run",
        "lisp": "sbcl --script",
        "kit": "kitc --run",
        "v": "v run",
        "sass": "sass --style expanded",
        "scss": "scss --style expanded"
    }
}


サンプルコード:
(define pow (lambda (x) (* x x)))
(display (pow 49))
(exit)

Ctrl+Alt+Nが実行され、コンソールの結果は以下の通りです.
PS D:\Desktop\lisp\scheme> scheme "d:\Desktop\lisp\scheme\a.ss"
Chez Scheme Version 9.5
Copyright 1984-2017 Cisco Systems, Inc.

2401

成功しました~、これからLispの奇妙な旅が始まります!
参考資料
Windows 10でのScheme開発環境の導入