0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Racket言語(Scheme方言)をMacBookに入れる

Posted at

##brew installで入れる (成功)

Terminal
electron@diynoMacBook-Pro ~ % brew install racket
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
==> Updated Casks
Updated 1 cask.

Warning: Treating racket as a formula. For the cask, use homebrew/cask/racket
==> Downloading https://ghcr.io/v2/homebrew/core/minimal-racket/manifests/8.2
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/minimal-racket/blobs/sha256:a79ff7f036256aae9159f89897e32629641d889b4bd37c98e91b216a7f3085f5
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:a79ff7f036256aae9159f89897e32629641d889b4bd37c98e91b216a7f3
######################################################################## 100.0%
==> Pouring minimal-racket--8.2.catalina.bottle.tar.gz
==> Caveats
This is a minimal Racket distribution.
If you want to build the DrRacket IDE, you may run:
  raco pkg install --auto drracket

The full Racket distribution is available as a cask:
  brew install --cask racket
==> Summary
🍺  /usr/local/Cellar/minimal-racket/8.2: 1,953 files, 114.6MB
electron@diynoMacBook-Pro ~ % 

##brew install --cask で入れる (成功)

Terminal
electron@diynoMacBook-Pro ~ % brew install racket --cask
==> Downloading https://mirror.racket-lang.org/installers/8.2/racket-8.2-x86_64-macosx-cs.dmg
######################################################################## 100.0%
==> Installing Cask racket

==> Moving App Suite 'Racket v8.2' to '/Applications/Racket v8.2'
==> Linking Binary 'drracket' to '/usr/local/bin/drracket'
==> Linking Binary 'gracket' to '/usr/local/bin/gracket'
==> Linking Binary 'gracket-text' to '/usr/local/bin/gracket-text'
==> Linking Binary 'mred' to '/usr/local/bin/mred'
==> Linking Binary 'mred-text' to '/usr/local/bin/mred-text'
==> Linking Binary 'mzc' to '/usr/local/bin/mzc'
==> Linking Binary 'mzpp' to '/usr/local/bin/mzpp'
==> Linking Binary 'mzscheme' to '/usr/local/bin/mzscheme'
==> Linking Binary 'mztext' to '/usr/local/bin/mztext'
==> Linking Binary 'pdf-slatex' to '/usr/local/bin/pdf-slatex'
==> Linking Binary 'plt-games' to '/usr/local/bin/plt-games'
==> Linking Binary 'plt-help' to '/usr/local/bin/plt-help'
==> Linking Binary 'plt-r5rs' to '/usr/local/bin/plt-r5rs'
==> Linking Binary 'plt-r6rs' to '/usr/local/bin/plt-r6rs'
==> Linking Binary 'plt-web-server' to '/usr/local/bin/plt-web-server'
==> Unlinking Binary '/usr/local/bin/plt-web-server'
==> Unlinking Binary '/usr/local/bin/plt-r6rs'
==> Unlinking Binary '/usr/local/bin/plt-r5rs'
==> Unlinking Binary '/usr/local/bin/plt-help'
==> Unlinking Binary '/usr/local/bin/plt-games'
==> Unlinking Binary '/usr/local/bin/pdf-slatex'
==> Unlinking Binary '/usr/local/bin/mztext'
==> Unlinking Binary '/usr/local/bin/mzscheme'
==> Unlinking Binary '/usr/local/bin/mzpp'
==> Unlinking Binary '/usr/local/bin/mzc'
==> Unlinking Binary '/usr/local/bin/mred-text'
==> Unlinking Binary '/usr/local/bin/mred'
==> Unlinking Binary '/usr/local/bin/gracket-text'
==> Unlinking Binary '/usr/local/bin/gracket'
==> Unlinking Binary '/usr/local/bin/drracket'
==> Backing App Suite 'Racket v8.2' up to '/usr/local/Caskroom/racket/8.2/Racket v8.2'
==> Removing App Suite '/Applications/Racket v8.2'
==> Purging files for version 8.2 of Cask racket
Error: It seems there is already a Binary at '/usr/local/bin/raco'.
electron@diynoMacBook-Pro ~ % 

##入れたRacket環境のバージョン表示

Terminal
electron@diynoMacBook-Pro ~ % racket -v
Welcome to Racket v8.2 [cs].
electron@diynoMacBook-Pro ~ % 

##対話インタプリタの動作確認(問題なし)

Terminal
electron@diynoMacBook-Pro ~ % racket
Welcome to Racket v8.2 [cs].
> (for ([i (in-range 26)])
  (display
   (integer->char
    (+ i (char->integer #\a)))))
abcdefghijklmnopqrstuvwxyz> 



^Cuser break
  context...:
   /usr/local/Cellar/minimal-racket/8.2/share/racket/collects/racket/repl.rkt:11:26
> 
> (exit)
electron@diynoMacBook-Pro ~ % 

###定義した自作関数の引数への適用(成功)

Terminal
electron@diynoMacBook-Pro ~ % racket
Welcome to Racket v8.2 [cs].
> (define/contract (foo a b)
  (-> integer? real? real?)  ; compare:  foo : int real -> re
  (+ a b))
> 
(foo 3 4.2)
7.2
> (foo 4.2 3)
foo: contract violation
  expected: integer?
  given: 4.2
  in: the 1st argument of
      (-> integer? real? real?)
  contract from: (function foo)
  blaming: top-level
   (assuming the contract is correct)
  at: stdin::31972-31975
  context...:
   /usr/local/Cellar/minimal-racket/8.2/share/racket/collects/racket/contract/private/blame.rkt:346:0: raise-blame-error
   /usr/local/Cellar/minimal-racket/8.2/share/racket/collects/racket/contract/private/arrow-higher-order.rkt:379:33
   /usr/local/Cellar/minimal-racket/8.2/share/racket/collects/racket/repl.rkt:11:26
> 
> (exit)

##スクリプトファイル読込・実行の動作確認(問題なし)

Terminal
electron@diynoMacBook-Pro ~ % vim test.rkt
electron@diynoMacBook-Pro ~ % cat test.rkt 
#lang racket
;; Print the Greek alphabet
(for ([i (in-range 26)])
  (display
   (integer->char
    (+ i (char->integer #\a)))))
electron@diynoMacBook-Pro ~ % 
electron@diynoMacBook-Pro ~ % racket test.rkt
abcdefghijklmnopqrstuvwxyz%                                                                                                                     electron@diynoMacBook-Pro ~ % 
0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?