summaryrefslogtreecommitdiff
path: root/bench
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2007-01-01 16:26:17 +0000
committermurphy <murphy@rubychan.de>2007-01-01 16:26:17 +0000
commitda09c7c6bb1267996db7751e775d08742256f3f2 (patch)
treedd5029385fb87f04cd242857f0c833d0db6cca6a /bench
parent74c9a0d2b32e45c0692b4cdad4eddcab1e6a74e3 (diff)
downloadcoderay-da09c7c6bb1267996db7751e775d08742256f3f2.tar.gz
New Scanner: Scheme (thanks closure!)
Test and example added. Token changed: operator_fat instead of operator_name (for use with LISP-like parentheses). Added file_extension for Scanners. Improved CodeRay::Suite: - uses scanners file extension now - example parameter is now named "only" - only param overwrite MAX_CODE_SIZE_TO_HIGHLIGHT
Diffstat (limited to 'bench')
-rw-r--r--bench/example.scheme38
1 files changed, 38 insertions, 0 deletions
diff --git a/bench/example.scheme b/bench/example.scheme
new file mode 100644
index 0000000..4cb9c18
--- /dev/null
+++ b/bench/example.scheme
@@ -0,0 +1,38 @@
+
+("")
+(string=? "K. Harper, M.D." ;; Taken from Section 6.3.3. (Symbols) of the R5RS
+ (symbol->string
+ (string->symbol "K. Harper, M.D.")))
+;; BEGIN Factorial
+(define factorial
+ (lambda (n)
+ (if (= n 1)
+ 1
+ (* n (factorial (- n 1))))))
+;; END Factorial
+
+ ;; BEGIN Square
+ (define square
+ (lambda (n) ;; My first lambda
+ (if (= n 0)
+ 0
+ ;; BEGIN Recursive_Call
+ (+ (square (- n 1))
+ (- (+ n n) 1)))))
+ ;; END Recursive_Call
+ ;; END Square
+
+;;LIST OF NUMBERS
+(#b-1111 #xffa12 #o755 #o-755 +i -i +2i -2i 3+4i 1.6440287493492101i+2 1.344 3/4 #i23/70)
+
+;;a vector
+#('(1 2 3) #\\a 3 #t #f)
+
+;;macros (USELESS AND INCORRECT, JUST TO CHECK THAT IDENTIFIERS ARE RECOGNIZED RIGHT)
+(syntax-case ()
+ ((_ name field ...)
+ (with-syntax
+ ((constructor (gen-id (syntax name) "make-" (syntax name)))
+ (predicate (gen-id (syntax name) (syntax name) "?"))
+ ((access ...)
+ (map (lambda (x) (gen-id x "set-" (syntax name) "-" x "!")))))))) \ No newline at end of file