Skip to content

Commit

Permalink
Updated (display) to use interpreter's instance of Sexpistol.
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongough committed Mar 5, 2011
1 parent 778be17 commit 1f139de
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/flea/interpreter.rb
@@ -1,7 +1,9 @@
module Flea
class Interpreter

attr_accessor :base_environment, :current_environment
attr_accessor :base_environment,
:current_environment,
:parser

def initialize(options = {})
options = {
Expand Down
2 changes: 1 addition & 1 deletion lib/flea/standard_library/display.scm
@@ -1,6 +1,6 @@
(define display
(native_function "
output = interpreter.evaluate(arguments[0])
print Sexpistol.new.to_sexp(output)
print interpreter.parser.to_sexp(output)
output
"))
5 changes: 5 additions & 0 deletions spec/flea/standard_library/display_spec.rb
Expand Up @@ -19,6 +19,11 @@
@buffer.string.should == "(1 2 3)"
end

it "should output true and false using Scheme external representation" do
@interpreter.run('(display #t)(display #f)')
@buffer.string.should == "#t#f"
end

it "should return the same value that it displayed" do
result = @interpreter.run('(display "abc")')
result.should == "abc"
Expand Down

0 comments on commit 1f139de

Please sign in to comment.