From 341b1bc381df588d0c1c69768c0d232a8c5edc24 Mon Sep 17 00:00:00 2001 From: Kan-Ru Chen Date: Sun, 29 Jan 2012 17:38:44 +0800 Subject: Add lambda spec for Common Lisp. --- specs/~lambdas.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/specs/~lambdas.yml b/specs/~lambdas.yml index b9fb4d0..f3f3b0b 100644 --- a/specs/~lambdas.yml +++ b/specs/~lambdas.yml @@ -22,6 +22,7 @@ tests: php: 'return "world";' python: 'lambda: "world"' clojure: '(fn [] "world")' + lisp: '(lambda () "world")' template: "Hello, {{lambda}}!" expected: "Hello, world!" @@ -36,6 +37,7 @@ tests: php: 'return "{{planet}}";' python: 'lambda: "{{planet}}"' clojure: '(fn [] "{{planet}}")' + lisp: '(lambda () "{{planet}}")' template: "Hello, {{lambda}}!" expected: "Hello, world!" @@ -50,6 +52,7 @@ tests: php: 'return "|planet| => {{planet}}";' python: 'lambda: "|planet| => {{planet}}"' clojure: '(fn [] "|planet| => {{planet}}")' + lisp: '(lambda () "|planet| => {{planet}}")' template: "{{= | | =}}\nHello, (|&lambda|)!" expected: "Hello, (|planet| => world)!" @@ -63,6 +66,7 @@ tests: php: 'global $calls; return ++$calls;' python: 'lambda: globals().update(calls=globals().get("calls",0)+1) or calls' clojure: '(def g (atom 0)) (fn [] (swap! g inc))' + lisp: '(let ((g 0)) (lambda () (incf g)))' template: '{{lambda}} == {{{lambda}}} == {{lambda}}' expected: '1 == 2 == 3' @@ -76,6 +80,7 @@ tests: php: 'return ">";' python: 'lambda: ">"' clojure: '(fn [] ">")' + lisp: '(lambda () ">")' template: "<{{lambda}}{{{lambda}}}" expected: "<>>" @@ -90,6 +95,7 @@ tests: php: 'return ($text == "{{x}}") ? "yes" : "no";' python: 'lambda text: text == "{{x}}" and "yes" or "no"' clojure: '(fn [text] (if (= text "{{x}}") "yes" "no"))' + lisp: '(lambda (text) (if (string= text "{{x}}") "yes" "no"))' template: "<{{#lambda}}{{x}}{{/lambda}}>" expected: "" @@ -104,6 +110,7 @@ tests: php: 'return $text . "{{planet}}" . $text;' python: 'lambda text: "%s{{planet}}%s" % (text, text)' clojure: '(fn [text] (str text "{{planet}}" text))' + lisp: '(lambda (text) (format nil "~a{{planet}}~a" text text))' template: "<{{#lambda}}-{{/lambda}}>" expected: "<-Earth->" @@ -118,6 +125,7 @@ tests: php: 'return $text . "{{planet}} => |planet|" . $text;' python: 'lambda text: "%s{{planet}} => |planet|%s" % (text, text)' clojure: '(fn [text] (str text "{{planet}} => |planet|" text))' + lisp: '(lambda (text) (format nil "~a{{planet}} => |planet|~a" text text))' template: "{{= | | =}}<|#lambda|-|/lambda|>" expected: "<-{{planet}} => Earth->" @@ -131,6 +139,7 @@ tests: php: 'return "__" . $text . "__";' python: 'lambda text: "__%s__" % (text)' clojure: '(fn [text] (str "__" text "__"))' + lisp: '(lambda (text) (format nil "__~a__" text))' template: '{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda}}' expected: '__FILE__ != __LINE__' @@ -145,5 +154,6 @@ tests: php: 'return false;' python: 'lambda text: 0' clojure: '(fn [text] false)' + lisp: '(lambda (text) (declare (ignore text)) nil)' template: "<{{^lambda}}{{static}}{{/lambda}}>" expected: "<>" -- cgit v1.2.1