Skip to content
This repository

Add lambda spec for Common Lisp #36

Open
wants to merge 1 commit into from

1 participant

Kan-Ru Chen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jan 29, 2012
Kan-Ru Chen Add lambda spec for Common Lisp. 341b1bc
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 10 additions and 0 deletions. Show diff stats Hide diff stats

  1. 10  specs/~lambdas.yml
10  specs/~lambdas.yml
@@ -22,6 +22,7 @@ tests:
22 22
         php:     'return "world";'
23 23
         python:  'lambda: "world"'
24 24
         clojure: '(fn [] "world")'
  25
+        lisp:    '(lambda () "world")'
25 26
     template: "Hello, {{lambda}}!"
26 27
     expected: "Hello, world!"
27 28
 
@@ -36,6 +37,7 @@ tests:
36 37
         php:     'return "{{planet}}";'
37 38
         python:  'lambda: "{{planet}}"'
38 39
         clojure: '(fn [] "{{planet}}")'
  40
+        lisp:    '(lambda () "{{planet}}")'
39 41
     template: "Hello, {{lambda}}!"
40 42
     expected: "Hello, world!"
41 43
 
@@ -50,6 +52,7 @@ tests:
50 52
         php:     'return "|planet| => {{planet}}";'
51 53
         python:  'lambda: "|planet| => {{planet}}"'
52 54
         clojure: '(fn [] "|planet| => {{planet}}")'
  55
+        lisp:    '(lambda () "|planet| => {{planet}}")'
53 56
     template: "{{= | | =}}\nHello, (|&lambda|)!"
54 57
     expected: "Hello, (|planet| => world)!"
55 58
 
@@ -63,6 +66,7 @@ tests:
63 66
         php:     'global $calls; return ++$calls;'
64 67
         python:  'lambda: globals().update(calls=globals().get("calls",0)+1) or calls'
65 68
         clojure: '(def g (atom 0)) (fn [] (swap! g inc))'
  69
+        lisp:    '(let ((g 0)) (lambda () (incf g)))'
66 70
     template: '{{lambda}} == {{{lambda}}} == {{lambda}}'
67 71
     expected: '1 == 2 == 3'
68 72
 
@@ -76,6 +80,7 @@ tests:
76 80
         php:     'return ">";'
77 81
         python:  'lambda: ">"'
78 82
         clojure: '(fn [] ">")'
  83
+        lisp:    '(lambda () ">")'
79 84
     template: "<{{lambda}}{{{lambda}}}"
80 85
     expected: "<&gt;>"
81 86
 
@@ -90,6 +95,7 @@ tests:
90 95
         php:     'return ($text == "{{x}}") ? "yes" : "no";'
91 96
         python:  'lambda text: text == "{{x}}" and "yes" or "no"'
92 97
         clojure: '(fn [text] (if (= text "{{x}}") "yes" "no"))'
  98
+        lisp:    '(lambda (text) (if (string= text "{{x}}") "yes" "no"))'
93 99
     template: "<{{#lambda}}{{x}}{{/lambda}}>"
94 100
     expected: "<yes>"
95 101
 
@@ -104,6 +110,7 @@ tests:
104 110
         php:     'return $text . "{{planet}}" . $text;'
105 111
         python:  'lambda text: "%s{{planet}}%s" % (text, text)'
106 112
         clojure: '(fn [text] (str text "{{planet}}" text))'
  113
+        lisp:    '(lambda (text) (format nil "~a{{planet}}~a" text text))'
107 114
     template: "<{{#lambda}}-{{/lambda}}>"
108 115
     expected: "<-Earth->"
109 116
 
@@ -118,6 +125,7 @@ tests:
118 125
         php:     'return $text . "{{planet}} => |planet|" . $text;'
119 126
         python:  'lambda text: "%s{{planet}} => |planet|%s" % (text, text)'
120 127
         clojure: '(fn [text] (str text "{{planet}} => |planet|" text))'
  128
+        lisp:    '(lambda (text) (format nil "~a{{planet}} => |planet|~a" text text))'
121 129
     template: "{{= | | =}}<|#lambda|-|/lambda|>"
122 130
     expected: "<-{{planet}} => Earth->"
123 131
 
@@ -131,6 +139,7 @@ tests:
131 139
         php:     'return "__" . $text . "__";'
132 140
         python:  'lambda text: "__%s__" % (text)'
133 141
         clojure: '(fn [text] (str "__" text "__"))'
  142
+        lisp:    '(lambda (text) (format nil "__~a__" text))'
134 143
     template: '{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda}}'
135 144
     expected: '__FILE__ != __LINE__'
136 145
 
@@ -145,5 +154,6 @@ tests:
145 154
         php:     'return false;'
146 155
         python:  'lambda text: 0'
147 156
         clojure: '(fn [text] false)'
  157
+        lisp:    '(lambda (text) (declare (ignore text)) nil)'
148 158
     template: "<{{^lambda}}{{static}}{{/lambda}}>"
149 159
     expected: "<>"
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.