Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r61481 - in trunk/libs/spirit/example/scheme: example/scheme scheme
From: joel_at_[hidden]
Date: 2010-04-22 05:05:42


Author: djowel
Date: 2010-04-22 05:05:42 EDT (Thu, 22 Apr 2010)
New Revision: 61481
URL: http://svn.boost.org/trac/boost/changeset/61481

Log:
blocks (begin ...)
Text files modified:
   trunk/libs/spirit/example/scheme/example/scheme/some_scheme.scm | 3 +--
   trunk/libs/spirit/example/scheme/scheme/compiler.hpp | 16 +++++++++++++++-
   trunk/libs/spirit/example/scheme/scheme/intrinsics.hpp | 4 ++--
   3 files changed, 18 insertions(+), 5 deletions(-)

Modified: trunk/libs/spirit/example/scheme/example/scheme/some_scheme.scm
==============================================================================
--- trunk/libs/spirit/example/scheme/example/scheme/some_scheme.scm (original)
+++ trunk/libs/spirit/example/scheme/example/scheme/some_scheme.scm 2010-04-22 05:05:42 EDT (Thu, 22 Apr 2010)
@@ -1,4 +1,3 @@
-(define (display-all . args)
- (display args))
+(define (display-all first . rest) (display first) (display rest))
 
 (display-all 123 456 999 666)
\ No newline at end of file

Modified: trunk/libs/spirit/example/scheme/scheme/compiler.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/scheme/compiler.hpp (original)
+++ trunk/libs/spirit/example/scheme/scheme/compiler.hpp 2010-04-22 05:05:42 EDT (Thu, 22 Apr 2010)
@@ -243,7 +243,21 @@
                 else
                     local_env.define(args[i], boost::bind(arg, i), 0, false);
             }
- return protect(compile(body[0], local_env, fragments, line, source_file));
+
+ if (body.size() == 1)
+ {
+ return protect(compile(body[0], local_env, fragments, line, source_file));
+ }
+ else
+ {
+ actor_list flist;
+ BOOST_FOREACH(utree const& item, body)
+ {
+ flist.push_back(
+ compile(item, local_env, fragments, line, source_file));
+ }
+ return protect(block(flist));
+ }
         }
 
         function define_function(

Modified: trunk/libs/spirit/example/scheme/scheme/intrinsics.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/scheme/intrinsics.hpp (original)
+++ trunk/libs/spirit/example/scheme/scheme/intrinsics.hpp 2010-04-22 05:05:42 EDT (Thu, 22 Apr 2010)
@@ -104,9 +104,9 @@
         utree eval(args_type args) const
         {
             BOOST_ASSERT(!elements.empty());
- actor_list::const_iterator end = elements.end();
+ actor_list::const_iterator end = elements.end(); --end;
             boost::iterator_range<actor_list::const_iterator>
- head_elements(elements.begin(), end--);
+ head_elements(elements.begin(), end);
             BOOST_FOREACH(function const& element, head_elements)
             {
                 element(args);


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk