map with lambda with non-matching argument-parameter
Running the example series_len.vm
in instant evaluation mode returns: 'len(s) =' 5
. But in deferred mode this error occurs:
Traceback (most recent call last):
File "vre-language/src/virtmat/language/utilities/errors.py", line 223, in wrapper
return func(*args, **kwargs)
File "vre-language/src/virtmat/language/cli/run_model.py", line 92, in evaluate_prog
print(f'program output: >>>\n{prog.value}\n<<<')
File "/usr/lib64/python3.8/functools.py", line 967, in __get__
val = self.func(instance)
File "vre-language/src/virtmat/language/utilities/errors.py", line 152, in wrapper
return func(*args, **kwargs)
File "vre-language/src/virtmat/language/interpreter/instant_executor.py", line 50, in program_value
vals = [p.value for p in get_children_of_type('Print', self) if p.value]
File "vre-language/src/virtmat/language/interpreter/instant_executor.py", line 50, in <listcomp>
vals = [p.value for p in get_children_of_type('Print', self) if p.value]
File "/usr/lib64/python3.8/functools.py", line 967, in __get__
val = self.func(instance)
File "vre-language/src/virtmat/language/utilities/errors.py", line 156, in wrapper
raise TextXError(str(err), **get_location_context(obj)) from err
textx.exceptions.TextXError: vre-language/examples/series_len.vm:2:1: map() must have at least two arguments. => 'print('len(s) =', sum(map((x: 1), s)))'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "jupyter-tensorflow-2023-01-02/bin/texts", line 8, in <module>
sys.exit(texts())
File "vre-language/src/virtmat/language/cli/__init__.py", line 25, in texts
clargs.func(clargs)
File "vre-language/src/virtmat/language/cli/run_model.py", line 125, in main
evaluate_prog(clargs, prog)
File "vre-language/src/virtmat/language/utilities/errors.py", line 225, in wrapper
process_error(err)
File "vre-language/src/virtmat/language/utilities/errors.py", line 213, in process_error
raise err.__cause__
File "vre-language/src/virtmat/language/utilities/errors.py", line 152, in wrapper
return func(*args, **kwargs)
File "vre-language/src/virtmat/language/utilities/types.py", line 200, in wrapper
return checktype_(func(obj), obj.type_)
File "vre-language/src/virtmat/language/interpreter/deferred_executor.py", line 919, in func_value
return func(*[p.value for p in pars])
File "vre-language/src/virtmat/language/interpreter/deferred_executor.py", line 62, in retfunc
values = [formatter(f(*a)) for f, a in zip(funcs, pargs)]
File "vre-language/src/virtmat/language/interpreter/deferred_executor.py", line 62, in <listcomp>
values = [formatter(f(*a)) for f, a in zip(funcs, pargs)]
File "vre-language/src/virtmat/language/interpreter/deferred_executor.py", line 521, in <lambda>
retfunc = (lambda *x: func(pfun(*x)), pars)
File "vre-language/src/virtmat/language/interpreter/deferred_executor.py", line 474, in get_map_val
return typemap['Series'](map(partial(nfunc, *pargs), *iterables), name=name)
TypeError: map() must have at least two arguments.