Skip to content

Commit 8ee4ea5

Browse files
committed
Rename write built-in function as print
1 parent b584786 commit 8ee4ea5

29 files changed

+271
-271
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Go 1.8+ is required.
3636
### Hello, world!
3737

3838
```
39-
(write "Hello, world!")
39+
(print "Hello, world!")
4040
```
4141

4242
### HTTP server

examples/collections.feature

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Feature: Collections
33
Given a file named "main.cloe" with:
44
"""
55
(seq!
6-
(write (@ [123 [456 789] "foo" true nil false] 2))
7-
(write (@ {123 [456 789] "foo" "It's me." nil false} "foo"))
8-
(write (@ "Hello, world!" 6)))
6+
(print (@ [123 [456 789] "foo" true nil false] 2))
7+
(print (@ {123 [456 789] "foo" "It's me." nil false} "foo"))
8+
(print (@ "Hello, world!" 6)))
99
"""
1010
When I successfully run `cloe main.cloe`
1111
Then the stdout should contain exactly:
@@ -18,15 +18,15 @@ Feature: Collections
1818
Scenario: Chain indexing
1919
Given a file named "main.cloe" with:
2020
"""
21-
(write (@ {"foo" {"bar" 42}} "foo" "bar"))
21+
(print (@ {"foo" {"bar" 42}} "foo" "bar"))
2222
"""
2323
When I successfully run `cloe main.cloe`
2424
Then the stdout should contain exactly "42"
2525

2626
Scenario: Convert a dictionary to a list
2727
Given a file named "main.cloe" with:
2828
"""
29-
(write (toList {123 456 "foo" "bar"}))
29+
(print (toList {123 456 "foo" "bar"}))
3030
"""
3131
When I successfully run `cloe main.cloe`
3232
Then the stdout should contain exactly:
@@ -37,7 +37,7 @@ Feature: Collections
3737
Scenario: Convert a list to a list
3838
Given a file named "main.cloe" with:
3939
"""
40-
(write (toList [123 nil 456 "foo" true "bar" false]))
40+
(print (toList [123 nil 456 "foo" true "bar" false]))
4141
"""
4242
When I successfully run `cloe main.cloe`
4343
Then the stdout should contain exactly:
@@ -48,7 +48,7 @@ Feature: Collections
4848
Scenario: Convert a string to a list
4949
Given a file named "main.cloe" with:
5050
"""
51-
(write (toList "Cloe is good."))
51+
(print (toList "Cloe is good."))
5252
"""
5353
When I successfully run `cloe main.cloe`
5454
Then the stdout should contain exactly:

examples/comparison.feature

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,39 @@ Feature: Comparison
22
Scenario: Use < operator
33
Given a file named "main.cloe" with:
44
"""
5-
(write (if (< 1 2 3) "OK" "Not OK"))
5+
(print (if (< 1 2 3) "OK" "Not OK"))
66
"""
77
When I successfully run `cloe main.cloe`
88
Then the stdout should contain exactly "OK"
99

1010
Scenario: Use <= operator
1111
Given a file named "main.cloe" with:
1212
"""
13-
(write (if (<= 1 1 3) "OK" "Not OK"))
13+
(print (if (<= 1 1 3) "OK" "Not OK"))
1414
"""
1515
When I successfully run `cloe main.cloe`
1616
Then the stdout should contain exactly "OK"
1717

1818
Scenario: Use > operator
1919
Given a file named "main.cloe" with:
2020
"""
21-
(write (if (> 3 2 1) "OK" "Not OK"))
21+
(print (if (> 3 2 1) "OK" "Not OK"))
2222
"""
2323
When I successfully run `cloe main.cloe`
2424
Then the stdout should contain exactly "OK"
2525

2626
Scenario: Use >= operator
2727
Given a file named "main.cloe" with:
2828
"""
29-
(write (if (>= 3 1 1) "OK" "Not OK"))
29+
(print (if (>= 3 1 1) "OK" "Not OK"))
3030
"""
3131
When I successfully run `cloe main.cloe`
3232
Then the stdout should contain exactly "OK"
3333

3434
Scenario: Cannot use < operator for boolean values
3535
Given a file named "main.cloe" with:
3636
"""
37-
(write (< false true))
37+
(print (< false true))
3838
"""
3939
When I run `cloe main.cloe`
4040
Then the exit status should not be 0

examples/data_types.feature

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ Feature: Data types
2424
Scenario: Expand dictionaries into a dictionary
2525
Given a file named "main.cloe" with:
2626
"""
27-
(write (@ {"foo" 123 ..{"bar" 456} ..{42 2049} ..{nil true true false}} 42))
27+
(print (@ {"foo" 123 ..{"bar" 456} ..{42 2049} ..{nil true true false}} 42))
2828
"""
2929
When I successfully run `cloe main.cloe`
3030
Then the stdout should contain exactly "2049"
3131

3232
Scenario: Use a newline character in a string
3333
Given a file named "main.cloe" with:
3434
"""
35-
(write "Hello,\nworld!")
35+
(print "Hello,\nworld!")
3636
"""
3737
When I successfully run `cloe main.cloe`
3838
Then the stdout should contain exactly:

examples/effects.feature

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ Feature: Effects
22
Scenario: Evaluate multiple effects
33
Given a file named "main.cloe" with:
44
"""
5-
(write 123)
6-
(write 456)
7-
(write 789)
5+
(print 123)
6+
(print 456)
7+
(print 789)
88
"""
99
When I successfully run `cloe main.cloe`
1010
Then the stdout should contain "123"
@@ -14,7 +14,7 @@ Feature: Effects
1414
Scenario: Evaluate an expanded effect
1515
Given a file named "main.cloe" with:
1616
"""
17-
..[(write 123) (write 456) (write 789)]
17+
..[(print 123) (print 456) (print 789)]
1818
"""
1919
When I successfully run `cloe main.cloe`
2020
Then the stdout should contain "123"
@@ -24,7 +24,7 @@ Feature: Effects
2424
Scenario: Purify an effect value
2525
Given a file named "main.cloe" with:
2626
"""
27-
(write (pure (write "Hello, world!")))
27+
(print (pure (print "Hello, world!")))
2828
"""
2929
When I successfully run `cloe main.cloe`
3030
Then the stdout should contain exactly:

examples/errors.feature

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ Feature: Errors
22
Scenario: Run an erroneous code
33
Given a file named "main.cloe" with:
44
"""
5-
(write (+ 1 true))
5+
(print (+ 1 true))
66
"""
77
When I run `cloe main.cloe`
88
Then the exit status should not be 0
99
And the stdout should contain exactly ""
1010
And the stderr should contain "Error"
1111
And the stderr should contain "main.cloe"
12-
And the stderr should contain "(write (+ 1 true))"
12+
And the stderr should contain "(print (+ 1 true))"
1313

1414
Scenario: Bind 2 values to an argument
1515
Given a file named "main.cloe" with:
@@ -20,7 +20,7 @@ Feature: Errors
2020
h)
2121
g)
2222
23-
(write (((f 123) 456) . x 0))
23+
(print (((f 123) 456) . x 0))
2424
"""
2525
When I run `cloe main.cloe`
2626
Then the exit status should not be 0
@@ -30,7 +30,7 @@ Feature: Errors
3030
Scenario: Catch an error
3131
Given a file named "main.cloe" with:
3232
"""
33-
(write (catch (+ 1 true)))
33+
(print (catch (+ 1 true)))
3434
"""
3535
When I successfully run `cloe main.cloe`
3636
Then the stdout should contain "name"
@@ -39,7 +39,7 @@ Feature: Errors
3939
Scenario: Catch an error passed by match expression
4040
Given a file named "main.cloe" with:
4141
"""
42-
(write (@ (catch (match (error "FooError" "") x (error "BarError" ""))) "name"))
42+
(print (@ (catch (match (error "FooError" "") x (error "BarError" ""))) "name"))
4343
"""
4444
When I successfully run `cloe main.cloe`
4545
Then the stdout should contain "FooError"

examples/functions.feature

+19-19
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Feature: Functions
33
Given a file named "main.cloe" with:
44
"""
55
(def (f x) x)
6-
(write (f 42))
6+
(print (f 42))
77
"""
88
When I successfully run `cloe main.cloe`
99
Then the stdout should contain exactly "42"
@@ -12,7 +12,7 @@ Feature: Functions
1212
Given a file named "main.cloe" with:
1313
"""
1414
(def (f x) x)
15-
(write (f 123))
15+
(print (f 123))
1616
"""
1717
When I successfully run `cloe main.cloe`
1818
Then the stdout should contain exactly "123"
@@ -21,7 +21,7 @@ Feature: Functions
2121
Given a file named "main.cloe" with:
2222
"""
2323
(def (f x y) (+ x y))
24-
(write (f 123 456))
24+
(print (f 123 456))
2525
"""
2626
When I successfully run `cloe main.cloe`
2727
Then the stdout should contain exactly "579"
@@ -32,9 +32,9 @@ Feature: Functions
3232
(def (func . x nil) x)
3333
3434
(seq!
35-
(write (func . x nil ..{"x" 42}))
36-
(write (func . ..{"x" nil} x 42))
37-
(write (func . ..{"x" 42} ..{"x" nil} x 42)))
35+
(print (func . x nil ..{"x" 42}))
36+
(print (func . ..{"x" nil} x 42))
37+
(print (func . ..{"x" 42} ..{"x" nil} x 42)))
3838
"""
3939
When I successfully run `cloe main.cloe`
4040
Then the stdout should contain exactly:
@@ -48,7 +48,7 @@ Feature: Functions
4848
Given a file named "main.cloe" with:
4949
"""
5050
(def (f x ..args . foo 4 ..kwargs) (+ x ..args foo))
51-
(write (f 1 2 . foo 3))
51+
(print (f 1 2 . foo 3))
5252
"""
5353
When I successfully run `cloe main.cloe`
5454
Then the stdout should contain exactly "6"
@@ -59,7 +59,7 @@ Feature: Functions
5959
(def (func x1 x2 ..args . y1 0 y2 1 ..kwargs)
6060
(+ x1 x2 ..args y1 y2))
6161
62-
(write (func 1 1 1 ..[1 1 1] . y1 1 1 100000000 ..{"y2" 1}))
62+
(print (func 1 1 1 ..[1 1 1] . y1 1 1 100000000 ..{"y2" 1}))
6363
"""
6464
When I successfully run `cloe main.cloe`
6565
Then the stdout should contain exactly "8"
@@ -68,7 +68,7 @@ Feature: Functions
6868
Given a file named "main.cloe" with:
6969
"""
7070
(let foo 123)
71-
(write foo)
71+
(print foo)
7272
"""
7373
When I successfully run `cloe main.cloe`
7474
Then the stdout should contain exactly "123"
@@ -78,9 +78,9 @@ Feature: Functions
7878
"""
7979
(let l [42 ..l])
8080
81-
(write (l 1))
82-
(write (l 2))
83-
(write (l 3))
81+
(print (l 1))
82+
(print (l 2))
83+
(print (l 3))
8484
"""
8585
When I run `cloe main.cloe`
8686
Then the exit status should not be 0
@@ -92,7 +92,7 @@ Feature: Functions
9292
(let bar (+ x x))
9393
bar)
9494
95-
(write (foo 21))
95+
(print (foo 21))
9696
"""
9797
When I successfully run `cloe main.cloe`
9898
Then the stdout should contain exactly "42"
@@ -105,7 +105,7 @@ Feature: Functions
105105
(let baz (- x y))
106106
(* bar baz (+ x y)))
107107
108-
(write (foo 2 3))
108+
(print (foo 2 3))
109109
"""
110110
When I successfully run `cloe main.cloe`
111111
Then the stdout should contain exactly "-20"
@@ -117,7 +117,7 @@ Feature: Functions
117117
(def (g y) (+ x y))
118118
(g 42))
119119
120-
(write (f 2007))
120+
(print (f 2007))
121121
"""
122122
When I successfully run `cloe main.cloe`
123123
Then the stdout should contain exactly "2049"
@@ -132,7 +132,7 @@ Feature: Functions
132132
h)
133133
((g 456) 789))
134134
135-
(write (f 123))
135+
(print (f 123))
136136
"""
137137
When I successfully run `cloe main.cloe`
138138
Then the stdout should contain exactly "1368"
@@ -145,7 +145,7 @@ Feature: Functions
145145
(let x (+ x 1))
146146
x)
147147
148-
(write (f 1))
148+
(print (f 1))
149149
"""
150150
When I successfully run `cloe main.cloe`
151151
Then the stdout should contain exactly "3"
@@ -157,15 +157,15 @@ Feature: Functions
157157
(def (g x) x)
158158
(g 42))
159159
160-
(write (f 123456))
160+
(print (f 123456))
161161
"""
162162
When I successfully run `cloe main.cloe`
163163
Then the stdout should contain exactly "42"
164164

165165
Scenario: Call an anonymous function
166166
Given a file named "main.cloe" with:
167167
"""
168-
(write ((\ (x) x) "Hello, world!"))
168+
(print ((\ (x) x) "Hello, world!"))
169169
"""
170170
When I successfully run `cloe main.cloe`
171171
Then the stdout should contain exactly "Hello, world!"

0 commit comments

Comments
 (0)