aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-119/abigail/README.md1
-rw-r--r--challenge-119/abigail/scheme/ch-1.scm24
2 files changed, 25 insertions, 0 deletions
diff --git a/challenge-119/abigail/README.md b/challenge-119/abigail/README.md
index 8a78d90c19..2fc20d5e68 100644
--- a/challenge-119/abigail/README.md
+++ b/challenge-119/abigail/README.md
@@ -45,6 +45,7 @@ decimal `33`.
* [Python](python/ch-1.py)
* [R](r/ch-1.r)
* [Ruby](ruby/ch-1.rb)
+* [Scheme](scheme/ch-1.scm)
* [Tcl](tcl/ch-1.tcl)
### Blog
diff --git a/challenge-119/abigail/scheme/ch-1.scm b/challenge-119/abigail/scheme/ch-1.scm
new file mode 100644
index 0000000000..8202ca7aaf
--- /dev/null
+++ b/challenge-119/abigail/scheme/ch-1.scm
@@ -0,0 +1,24 @@
+;;;
+;;; See ../README.md
+;;;
+
+;;;
+;;; Run as: guile --no-auto-compile ch-1.scm < input-file
+;;;
+
+
+(use-modules (ice-9 format))
+
+(define (main)
+ (define num (read))
+ (if (not (eof-object? num))
+ (begin
+ (format #t "~d\n" (logior (logand num (lognot #xFF))
+ (ash (logand num #x0F) 4)
+ (ash (logand num #xF0) -4)))
+ (main)
+ )
+ )
+)
+
+(main)