From f37c88c174105874de9a7799aa22776948af3f69 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Sat, 28 Jun 2014 11:32:23 +0900 Subject: [PATCH] add for macro library --- contrib/20.for/CMakeLists.txt | 2 ++ contrib/20.for/piclib/for.scm | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 contrib/20.for/CMakeLists.txt create mode 100644 contrib/20.for/piclib/for.scm diff --git a/contrib/20.for/CMakeLists.txt b/contrib/20.for/CMakeLists.txt new file mode 100644 index 00000000..ebe66a42 --- /dev/null +++ b/contrib/20.for/CMakeLists.txt @@ -0,0 +1,2 @@ +file(GLOB FOR_FILES ${PROJECT_SOURCE_DIR}/contrib/20.for/piclib/*.scm) +list(APPEND PICLIB_CONTRIB_LIBS ${FOR_FILES}) diff --git a/contrib/20.for/piclib/for.scm b/contrib/20.for/piclib/for.scm new file mode 100644 index 00000000..bd421ef8 --- /dev/null +++ b/contrib/20.for/piclib/for.scm @@ -0,0 +1,18 @@ +(define-library (picrin control list) + (import (scheme base) + (picrin control) + (scheme write)) + + (define-syntax for + (syntax-rules () + ((_ expr) + (reset (lambda () expr))))) + + (define (in m) + (shift (lambda (k) + (apply append (map k m))))) + + (define (yield x) + (list x)) + + (export for in yield))