summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2018-03-16 02:02:52 +0000
committerrsiddharth <s@ricketyspace.net>2018-03-16 02:02:52 +0000
commit1e85131ada02788971f7128ea3c25888d4d62b69 (patch)
treecb3ce14fd2c56d8ff56be56c3ecb9f44a2b4e9f8
parent87c3b28e3d2a32cf67b4d29d60d2b1df729f06c1 (diff)
net: Add (net ricketyspace sicp one fortytwo).
* net/ricketyspace/sicp/one/fortytwo.scm: New file.
-rw-r--r--net/ricketyspace/sicp/one/fortytwo.scm35
1 files changed, 35 insertions, 0 deletions
diff --git a/net/ricketyspace/sicp/one/fortytwo.scm b/net/ricketyspace/sicp/one/fortytwo.scm
new file mode 100644
index 0000000..5742588
--- /dev/null
+++ b/net/ricketyspace/sicp/one/fortytwo.scm
@@ -0,0 +1,35 @@
+;;;; Under Creative Commons Attribution-ShareAlike 4.0
+;;;; International. See
+;;;; <https://creativecommons.org/licenses/by-sa/4.0/>.
+;;;;
+;;;; _____
+;;;; < 42! >
+;;;; -----
+;;;; \ __
+;;;; \ (**)
+;;;; \ (U )
+;;;; \ /--\
+;;;; __ / \ \
+;;;; U**U\.'@@@@@@`.\ )
+;;;; \__/(@@@@@@@@@@) /
+;;;; (@@@@@@@@)((
+;;;; `YY~~~~YY' \\
+;;;; || || >>
+;;;;
+
+(define-module (net ricketyspace sicp one fortytwo)
+ #:export (sicp-compose inc square))
+
+(define (sicp-compose f g)
+ (lambda (x) (f (g x))))
+
+(define (inc x) (1+ x))
+(define (square x) (* x x))
+
+;;; GNU Guile REPL
+
+;;; scheme@(guile-user)> ,use (net ricketyspace sicp one fortytwo)
+;;; scheme@(guile-user)> ((sicp-compose square inc) 6)
+;;; $21 = 49
+;;; scheme@(guile-user)> ((sicp-compose square inc) 8)
+;;; $22 = 81