summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/ricketyspace/sicp/one/fortyone.scm18
1 files changed, 18 insertions, 0 deletions
diff --git a/net/ricketyspace/sicp/one/fortyone.scm b/net/ricketyspace/sicp/one/fortyone.scm
new file mode 100644
index 0000000..df3baa9
--- /dev/null
+++ b/net/ricketyspace/sicp/one/fortyone.scm
@@ -0,0 +1,18 @@
+;;;; Under Creative Commons Attribution-ShareAlike 4.0
+;;;; International. See
+;;;; <https://creativecommons.org/licenses/by-sa/4.0/>.
+
+(define-module (net ricketyspace sicp one fortyone)
+ #:export (double inc))
+
+(define (double func)
+ (lambda (x) (func (func x))))
+
+(define (inc x) (1+ x))
+
+;;; GNU Guile REPL
+
+;;; scheme@(guile-user)> ,use (net ricketyspace sicp one fortyone)
+;;; scheme@(guile-user)> (((double (double double)) inc) 5)
+;;; $9 = 21
+