@@ -196,13 +196,14 @@ func quote(args Value, scope *Scope) Value {
196
196
197
197
func replace (args Value , scope * Scope ) Value {
198
198
argsList := getArgsList (args )
199
- expression := argsList [0 ]
199
+ expression := interpretExpression ( argsList [0 ], scope )
200
200
symbol := argsList [1 ]
201
- replacement := argsList [2 ]
201
+ replacement := interpretExpression ( argsList [2 ], scope )
202
202
203
203
if symbol , ok := symbol .(* Symbol ); ok {
204
204
return subSymbol (expression , symbol , replacement , false )
205
205
}
206
+
206
207
return & Nil {}
207
208
}
208
209
@@ -343,15 +344,18 @@ func def(args Value, scope *Scope) Value {
343
344
344
345
func write2Output (args Value , scope * Scope ) Value {
345
346
argsList := getArgsList (args )
346
- config .OutputFile .WriteString (interpretExpression (argsList [0 ], scope ).String ())
347
+ message := interpretExpression (argsList [0 ], scope ).String ()
348
+ if config .OutputEnabled {
349
+ config .OutputFile .WriteString (message )
350
+ }
347
351
return & Nil {}
348
352
}
349
353
350
354
351
355
func writeByte2Output (args Value , scope * Scope ) Value {
352
356
argsList := getArgsList (args )
353
357
result := interpretExpression (argsList [0 ], scope )
354
- if number , ok := result .(* Integer ); ok {
358
+ if number , ok := result .(* Integer ); ok && config . OutputEnabled {
355
359
config .OutputFile .Write ([]byte {byte (number .Value )})
356
360
}
357
361
return & Nil {}
0 commit comments