Skip to content

Instantly share code, notes, and snippets.

@tomohiro
Created June 14, 2010 05:50
Show Gist options
  • Save tomohiro/437324 to your computer and use it in GitHub Desktop.
Save tomohiro/437324 to your computer and use it in GitHub Desktop.
Gauche
;;;
;;; 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)
;;;
;;; 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