-
Ubuntu 10.04 LTS
$ sudo aptitude install gauche gauche-dev gauche-doc
-
Mac OS X Snow Leopard
$ sudo port install gauche gauche-readline
Created
June 14, 2010 05:50
-
-
Save tomohiro/437324 to your computer and use it in GitHub Desktop.
Gauche
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; | |
;;; First Gauche Program | |
;;; | |
;;; $ gosh hello.scm hello | |
;;; (hello.scm hello) | |
;;; (hello) | |
;;; hello.scm | |
;;; Hello, World! | |
;;; | |
(define (main args) | |
(print args) | |
(print *argv*) ;; *argv* is command line args list | |
(print *program-name*) ;; *program-name* is script file name | |
(print "Hello, World!") | |
0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; | |
;;; list reverse | |
;;; ループを使わないでリストを逆順にするコード | |
;;; | |
;; recursive reverse | |
(define (reverse lis) | |
(define (reverse-iter lis rev) | |
(if (null? lis) | |
rev | |
(reverse-iter (cdr lis) (cons (car lis) rev)))) | |
(reverse-iter lis '())) | |
;; main | |
(define (main args) | |
(print "Recursive reverse => " (reverse '(0 1 2 3 4 5))) | |
0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment