summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/samples
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2013-01-03 07:41:02 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2013-01-03 07:41:02 +0000
commit157ca678dee75e7881a0198425d0c8328f0bee04 (patch)
tree3c63c23b4948b2ee923c0b2027fbb5ac525a1b85 /sca-cpp/trunk/samples
parent36adc76235fb0a38e7042bc751f988b71627e2a0 (diff)
Improve handling of nested lists, trees, null and floating point values.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1428191 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-cpp/trunk/samples/store-constdb/shopping-cart.scm10
-rw-r--r--sca-cpp/trunk/samples/store-cpp/htdocs/test/items-result.txt24
-rw-r--r--sca-cpp/trunk/samples/store-python/htdocs/test/items-result.txt24
-rw-r--r--sca-cpp/trunk/samples/store-scheme/shopping-cart.scm10
-rw-r--r--sca-cpp/trunk/samples/store-sql/shopping-cart.scm10
5 files changed, 17 insertions, 61 deletions
diff --git a/sca-cpp/trunk/samples/store-constdb/shopping-cart.scm b/sca-cpp/trunk/samples/store-constdb/shopping-cart.scm
index e653f1e33c..3dff67e99c 100644
--- a/sca-cpp/trunk/samples/store-constdb/shopping-cart.scm
+++ b/sca-cpp/trunk/samples/store-constdb/shopping-cart.scm
@@ -23,7 +23,7 @@
; Return an empty cart if not found
(define (getcart id cache)
(define cart (cache "get" (list id)))
- (if (nul cart)
+ (if (null? cart)
(list)
cart)
)
@@ -39,7 +39,7 @@
; Find an item in the cart
(define (find id cart)
- (if (nul cart)
+ (if (null? cart)
(list (list 'entry (list 'title "Item") (list 'id "0")))
(if (= id (cadr (caddr (car cart))))
(list (car cart))
@@ -48,7 +48,7 @@
; Get items from the cart
(define (get id cache)
- (if (nul id)
+ (if (null? id)
(list (append (list 'feed (list 'title "Your Cart") (list 'id cartId)) (getcart cartId cache)))
(find (car id) (getcart cartId cache))
)
@@ -56,7 +56,7 @@
; Delete items from the cart
(define (delete id cache)
- (if (nul id)
+ (if (null? id)
(cache "delete" (list cartId))
true
)
@@ -69,7 +69,7 @@
; Sum the prices of a list of items
(define (sum items)
- (if (nul items)
+ (if (null? items)
0
(+ (price (car items)) (sum (cdr items))))
)
diff --git a/sca-cpp/trunk/samples/store-cpp/htdocs/test/items-result.txt b/sca-cpp/trunk/samples/store-cpp/htdocs/test/items-result.txt
index 0b456ea9d0..56f87d2778 100644
--- a/sca-cpp/trunk/samples/store-cpp/htdocs/test/items-result.txt
+++ b/sca-cpp/trunk/samples/store-cpp/htdocs/test/items-result.txt
@@ -1,23 +1 @@
-{
- "id": 1,
- "result": [
- {
- "name": "Apple",
- "currencyCode": "USD",
- "currencySymbol": "$",
- "price": 2.99
- },
- {
- "name": "Orange",
- "currencyCode": "USD",
- "currencySymbol": "$",
- "price": 3.55
- },
- {
- "name": "Pear",
- "currencyCode": "USD",
- "currencySymbol": "$",
- "price": 1.55
- }
- ]
-} \ No newline at end of file
+{"id":1,"result":[{"name":"Apple","currencyCode":"USD","currencySymbol":"$","price":2.99},{"name":"Orange","currencyCode":"USD","currencySymbol":"$","price":3.55},{"name":"Pear","currencyCode":"USD","currencySymbol":"$","price":1.55}]} \ No newline at end of file
diff --git a/sca-cpp/trunk/samples/store-python/htdocs/test/items-result.txt b/sca-cpp/trunk/samples/store-python/htdocs/test/items-result.txt
index d6aaf4d44a..788b7cdf89 100644
--- a/sca-cpp/trunk/samples/store-python/htdocs/test/items-result.txt
+++ b/sca-cpp/trunk/samples/store-python/htdocs/test/items-result.txt
@@ -1,23 +1 @@
-{
- "id": 1,
- "result": [
- {
- "name": "Mango",
- "currencyCode": "USD",
- "currencySymbol": "$",
- "price": 2.99
- },
- {
- "name": "Passion",
- "currencyCode": "USD",
- "currencySymbol": "$",
- "price": 3.55
- },
- {
- "name": "Kiwi",
- "currencyCode": "USD",
- "currencySymbol": "$",
- "price": 1.55
- }
- ]
-} \ No newline at end of file
+{"id":1,"result":[{"name":"Mango","currencyCode":"USD","currencySymbol":"$","price":2.99},{"name":"Passion","currencyCode":"USD","currencySymbol":"$","price":3.55},{"name":"Kiwi","currencyCode":"USD","currencySymbol":"$","price":1.55}]} \ No newline at end of file
diff --git a/sca-cpp/trunk/samples/store-scheme/shopping-cart.scm b/sca-cpp/trunk/samples/store-scheme/shopping-cart.scm
index e653f1e33c..3dff67e99c 100644
--- a/sca-cpp/trunk/samples/store-scheme/shopping-cart.scm
+++ b/sca-cpp/trunk/samples/store-scheme/shopping-cart.scm
@@ -23,7 +23,7 @@
; Return an empty cart if not found
(define (getcart id cache)
(define cart (cache "get" (list id)))
- (if (nul cart)
+ (if (null? cart)
(list)
cart)
)
@@ -39,7 +39,7 @@
; Find an item in the cart
(define (find id cart)
- (if (nul cart)
+ (if (null? cart)
(list (list 'entry (list 'title "Item") (list 'id "0")))
(if (= id (cadr (caddr (car cart))))
(list (car cart))
@@ -48,7 +48,7 @@
; Get items from the cart
(define (get id cache)
- (if (nul id)
+ (if (null? id)
(list (append (list 'feed (list 'title "Your Cart") (list 'id cartId)) (getcart cartId cache)))
(find (car id) (getcart cartId cache))
)
@@ -56,7 +56,7 @@
; Delete items from the cart
(define (delete id cache)
- (if (nul id)
+ (if (null? id)
(cache "delete" (list cartId))
true
)
@@ -69,7 +69,7 @@
; Sum the prices of a list of items
(define (sum items)
- (if (nul items)
+ (if (null? items)
0
(+ (price (car items)) (sum (cdr items))))
)
diff --git a/sca-cpp/trunk/samples/store-sql/shopping-cart.scm b/sca-cpp/trunk/samples/store-sql/shopping-cart.scm
index e653f1e33c..3dff67e99c 100644
--- a/sca-cpp/trunk/samples/store-sql/shopping-cart.scm
+++ b/sca-cpp/trunk/samples/store-sql/shopping-cart.scm
@@ -23,7 +23,7 @@
; Return an empty cart if not found
(define (getcart id cache)
(define cart (cache "get" (list id)))
- (if (nul cart)
+ (if (null? cart)
(list)
cart)
)
@@ -39,7 +39,7 @@
; Find an item in the cart
(define (find id cart)
- (if (nul cart)
+ (if (null? cart)
(list (list 'entry (list 'title "Item") (list 'id "0")))
(if (= id (cadr (caddr (car cart))))
(list (car cart))
@@ -48,7 +48,7 @@
; Get items from the cart
(define (get id cache)
- (if (nul id)
+ (if (null? id)
(list (append (list 'feed (list 'title "Your Cart") (list 'id cartId)) (getcart cartId cache)))
(find (car id) (getcart cartId cache))
)
@@ -56,7 +56,7 @@
; Delete items from the cart
(define (delete id cache)
- (if (nul id)
+ (if (null? id)
(cache "delete" (list cartId))
true
)
@@ -69,7 +69,7 @@
; Sum the prices of a list of items
(define (sum items)
- (if (nul items)
+ (if (null? items)
0
(+ (price (car items)) (sum (cdr items))))
)