diff options
author | Marion <marion.zepf@gmail.com> | 2013-08-11 16:45:28 (GMT) |
---|---|---|
committer | Marion <marion.zepf@gmail.com> | 2013-08-11 16:45:28 (GMT) |
commit | 6f0bd6bec7e548cd1d031ce413a24f4b842b3fdf (patch) | |
tree | 03eb916ab03c0d222f00bdaf3b4130bdc5ec6f50 /TurtleArt/tabasics.py | |
parent | d0d0dc017d95ac958b29cd4b492d67741f2af20a (diff) |
add Primitive for the '==' ('equals') block
- Exported code does not yet do what it should.
Diffstat (limited to 'TurtleArt/tabasics.py')
-rw-r--r-- | TurtleArt/tabasics.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/TurtleArt/tabasics.py b/TurtleArt/tabasics.py index 2b5b1fb..7702ad5 100644 --- a/TurtleArt/tabasics.py +++ b/TurtleArt/tabasics.py @@ -97,7 +97,9 @@ class Palettes(): self.prim_cache = { "check_number": Primitive(self.check_number, export_me=False), "convert_value_for_move": Primitive(self.convert_value_for_move, - export_me=False) + export_me=False), + "convert_for_cmp": Primitive(Primitive.convert_for_cmp, + constant_args={'decimal_point': self.tw.decimal_point}) } # avoid several Primitives of the same function self._turtle_palette() @@ -754,8 +756,9 @@ operators')) logo_command='equal?', help_string=_('logical equal-to operator')) self.tw.lc.def_prim('equal?', 2, - lambda self, x, y: - primitive_dictionary['equal'](x, y)) + Primitive(Primitive.equals, + slot_wrappers={0: self.prim_cache["convert_for_cmp"], + 1: self.prim_cache["convert_for_cmp"]})) palette.add_block('not', style='not-style', @@ -1447,7 +1450,7 @@ variable')) # Utilities def _string_to_num(self, x): - ''' Try to comvert a string to a number ''' + ''' Try to convert a string to a number ''' if isinstance(x, (int, float)): return(x) try: |