diff options
author | Marion <marion.zepf@gmail.com> | 2013-09-12 16:37:53 (GMT) |
---|---|---|
committer | Marion <marion.zepf@gmail.com> | 2013-09-12 16:37:53 (GMT) |
commit | 4c4e63bc7928d239a8881990fdae1a2eca4757e2 (patch) | |
tree | de0768c7ad325741b160e7bcad624d3d7f3a48ad /plugins | |
parent | 5ebec1534aa4bb59a3ee3261ad44ea1c0c08bd26 (diff) |
add Primitive for 'clear/ empty heap' block
- Use LogoCode's heap in the exported code.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/turtle_blocks_extras/turtle_blocks_extras.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/turtle_blocks_extras/turtle_blocks_extras.py b/plugins/turtle_blocks_extras/turtle_blocks_extras.py index 04f83ff..d986b85 100644 --- a/plugins/turtle_blocks_extras/turtle_blocks_extras.py +++ b/plugins/turtle_blocks_extras/turtle_blocks_extras.py @@ -501,8 +501,7 @@ end\n') logo_command='taclearheap', help_string=_('emptys FILO (first-in-last-out \ heap)')) - self.tw.lc.def_prim('clearheap', 0, - lambda self: primitive_dictionary['clearheap']()) + self.tw.lc.def_prim('clearheap', 0, Primitive(self.tw.lc.reset_heap)) define_logo_function('taclearheap', 'to taclearheap\nmake "taheap []\n\ end\n') @@ -530,7 +529,12 @@ make "tmp first :taheap\nmake "taheap butfirst :taheap\noutput :tmp\nend\n') value_block=True, help_string=_('returns True if heap is empty')) self.tw.lc.def_prim('isheapempty', 0, - lambda self: primitive_dictionary['isheapempty']()) + Primitive(int, return_type=TYPE_INT, + arg_descs=[ConstantArg( + Primitive(Primitive.not_, return_type=TYPE_BOOL, + arg_descs=[ConstantArg( + Primitive(self.tw.lc.get_heap, + return_type=TYPE_BOOL))]))])) primitive_dictionary['isheapempty2'] = self._prim_is_heap_empty_bool palette.add_block('isheapempty2', |