Ypsilon

Ypsilon Scheme System

Ypsilon Scheme System(イプシロン・スキーム・システム)はプログラミング言語Schemeの最新規格R6RS*に準拠する実装です。インタープリタの特性を活かしてスピーディーでインタラクティブなアプリケーション/ユーザーライブラリーの開発を可能にします。またマルチコアCPU用に最適化したMostly Concurrent Garbage Collectionを実装することにより、極めて短いGC停止時間と並列実行によるパフォーマンスの向上を達成しています。

SRFIへの対応状況

公式サイトより、対応しているのは、
srfi-1, 6, 8, 26, 28, 39, 41, 42

srfi-1, 6, 8, 26, 28, 39, 42の使い方

(import (srfi srfi-N))

srfi-41の使い方

(import (streams))

Trace

> (import (trace))
> (define (factorial n)
(if (= n 0) 1 (* (factorial (- n 1)))))
> (trace factorial)
(#<closure factorial>)
> (factorial 3)
C (factorial 3)
C : (factorial 2)
C : : (factorial 1)
C : : : (factorial 0)
R : : : 1
R : : 1
R : 1
R 1 ; #<closure factorial> call:4 level:4
1

.emacs

gaucheでの設定を参考と言うかgoshの部分をypsilonに置き換えただけ。
(autoload 'scheme-mode "cmuscheme" "Major mode for Scheme." t)
(autoload 'run-scheme "cmuscheme" "Run an inferior Scheme process." t)
(eval-after-load
  'scheme
  '(progn
     ;; scheme-smart-complete
     (define-key scheme-mode-map "\e\t" 'scheme-smart-complete)
     ;; scheme-complete-or-indent
     (define-key scheme-mode-map "\t" 'scheme-complete-or-indent)
     (setq scheme-program-name "ypsilon")
     (setq process-coding-system-alist (cons '(scheme-program-name utf-8 . utf-8) process-coding-system-alist))
     (define-key global-map "\C-cS" 'scheme-other-window)
     (define-key global-map "\C-cI" 'gauche-info)
     (defun scheme-other-window ()
       "Run scheme on other window"
       (interactive)
       (switch-to-buffer-other-window
	 (get-buffer-create "*scheme*"))
       (run-scheme scheme-program-name)
       )
     (add-hook 'scheme-mode-hook
	       (lambda ()
		 (defun load-and-switch ()
		   (interactive)
		   (scheme-load-file (buffer-file-name (current-buffer)))
		   (switch-to-buffer-other-window "*scheme*")
		   )
		 (define-key scheme-mode-map "\C-c\C-l" 'load-and-switch) 
		 ))
     (require 'scheme-complete)
     ))
(eval-after-load
  'scheme-complete
  '(progn
    (add-hook 'scheme-mode-hook
	       (lambda ()
		 ;; eldoc-mode
		 (setq default-scheme-implementation 'gauche)
		 (setq *current-scheme-implementation* 'gauche)
		 (make-local-variable 'eldoc-documentation-function)
		 (setq eldoc-documentation-function 'scheme-get-current-symbol-info)
		 (eldoc-mode t)
		 ))

    (add-hook 'inferior-scheme-mode-hook
	       '(lambda()
		  ;; eldoc-mode
		  (setq default-scheme-implementation 'gauche)
		  (setq *current-scheme-implementation* 'gauche)
		  (make-local-variable 'eldoc-documentation-function)
		  ;(setq eldoc-documentation-function 'scheme-get-current-symbol-info)
		  (eldoc-mode t)
		  ;;key-bind
		  (define-key inferior-scheme-mode-map "\C-p" 'comint-previous-input)
		  (define-key inferior-scheme-mode-map [up] 'comint-previous-input)
		  (define-key inferior-scheme-mode-map "\C-n" 'comint-next-input)
 		  (define-key inferior-scheme-mode-map [down] 'comint-next-input)))


     (defadvice do-completion (around set-completion-window-height activate)
		(let* ((buff-height 8)
		       (temp-buffer-show-function
			 (lambda (x) (save-selected-window
				       (pop-to-buffer x)
				       (shrink-window (- (window-height) (+ buff-height 1)))))))
		  ad-do-it))
     ))

タグ:

+ タグ編集
  • タグ:
最終更新:2008年10月09日 22:03
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。