Simple, clean and easy to implement.
R5RS has only 23 s-exps.
(define (my-apply f x1 x2) (f x1 x2)) (my-apply + 1 2) ;; 3 (my-apply (lambda (x y) (+ x (* 2 y))) 1 2) ;; 5
Different with common-lisp.
(define (my-complex-construct x y) (let ((r x) (i y)) (lambda (m) (if (eq? m 'r) r i)))) (define c (my-complex-construct 1 3)) (c 'r) ;; 1 (c 'i) ;; 3
(define-syntax let (syntax-rules () ((let ((var expr) ...) body ...) ((lambda (var ...) body ...) expr ...))))
* Codes from wikipedia
(define (fact n) (define (iter n x) (cond ((= n 0) x) (#t (iter (- n 1) (* n x))))) (iter n 1) ) (fact 4) ;; 24 (fact 100000) ;; Output is intentially omitted
Contination is a snapshot of the current state of running process, call/cc will let process return to a saved snapshot.
First-class continuations enable the programmer to create non-local control constructs such as iterators, coroutines, and backtracking.
(let* ((yin ((lambda (cc) (display "@") cc) (call-with-current-continuation (lambda (c) c)))) (yang ((lambda (cc) (display "*") cc) (call-with-current-continuation (lambda (c) c))))) (yin yang))
More easier to use and control. (Full-continuation considered harmful)
Layered infrastucture , from high language to middle layer then virtual machine with JITs(in-development).
elisp compiled using Guile.
And theres is someone in doing [http://www.emacswiki.org/emacs/GuileEmacs].
[https://github.com/mwitmer/guile-xcb]
X11 protocal compiled using Guile!
Window Manager! [https://github.com/mwitmer/guile-wm]
A very lightweight and fastest web-framework of Scheme language:
[https://github.com/NalaGinrut/artanis]
[https://github.com/ijp/pfds/]
From WikiPedia:
Scheme Shell, Unix Shell using s-exps and scheme language. [http://scsh.net/]
[https://gitorious.org/guile-scsh]
BSD-license.
scheme@(guile-user)> (run (ls)) COPYING docs examples INSTALL install.scm pkg-list.scm scsh temp.scm test test-suite TODO USAGE $2 = 0
scheme@(guile-user)> (run (| (ls) (grep COPY))) COPYING $1 = 0 scheme@(guile-user)>
scheme@(guile-user)> (& (| (ls) (grep COP))) $4 = #{proc 3084} scheme@(guile-user)> COPYING
scheme@(guile-user)> (define ls '(ls --color=auto)) scheme@(guile-user)> (run ,ls) COPYING guile-scsh.scm scsh test USAGE $3 = 0
scheme@(guile-user)> (run (wc -l ) (< /etc/issue)) 2 $2 = 0 scheme@(guile-user)> (run (cat ) (< /etc/issue)) Arch Linux \r (\l) $3 = 0 scheme@(guile-user)> (run (grep Arch ,@(glob /etc/*)) (> 2 /dev/null)) /etc/issue:Arch Linux \r (\l) ... /etc/os-release:PRETTY_NAME="Arch Linux" $4 = 512 scheme@(guile-user)>
scheme@(guile-user)> (call/temp-file (lambda () (run (ls ) (= 1 (current-output-port)))) (lambda (x) (run (,@ls -l ,x)))) -rw------- 1 chaos chaos 44 Mar 6 15:41 /tmp/5310.61038 $12 = 0
scheme@(guile-user)> (run (ls ,@(glob /bin/l*))) /bin/l2ping /bin/ld.gold /bin/lex /bin/l2test /bin/ld_iscsi.so /bin/lexgrog /bin/labltk /bin/ldns-chaos /bin/lftp