Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reshape error #10

Open
semperos opened this issue Dec 16, 2024 · 0 comments
Open

Reshape error #10

semperos opened this issue Dec 16, 2024 · 0 comments

Comments

@semperos
Copy link

I observe the following behavior in KlongPy v0.6.8:

?> [3 3]:^"abcd"
["abc" "dab" "cda"]
?> [2 2]:^"abcd"
Error: ('sequence item 0: expected str instance, numpy.ndarray found',)

Here is the fuller stack trace with the -v flag set:

?> [2 2]:^"abcd"
Traceback (most recent call last):
  File "/opt/homebrew/bin/kgpy", line 179, in repl_eval
    r = klong(p)
        ^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/klongpy/interpreter.py", line 653, in __call__
    r = self.exec(x)
        ^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/klongpy/interpreter.py", line 664, in exec
    return [self.call(y) for y in self.prog(x)[1]]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/klongpy/interpreter.py", line 664, in <listcomp>
    return [self.call(y) for y in self.prog(x)[1]]
            ^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/klongpy/interpreter.py", line 596, in call
    return self.eval(KGCall(x.a, x.args, x.arity) if isinstance(x, KGFn) else x)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/klongpy/interpreter.py", line 622, in eval
    return f(_x) if x.a.arity == 1 else f(_x, _y)
                                        ^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/klongpy/dyads.py", line 835, in eval_dyad_reshape
    return "".join(r) if j else r
           ^^^^^^^^^^
TypeError: sequence item 0: expected str instance, numpy.ndarray found
Error: ('sequence item 0: expected str instance, numpy.ndarray found',)

I observe the following with arguments of different sizes:

?> [2 2]:^"a"
["aa" "aa"]
?> [2 2]:^"ab"
["ab" "ab"]
?> [2 2]:^"abc"
["ab" "ca"]
?> [2 2]:^"abcd"
Error: ('sequence item 0: expected str instance, numpy.ndarray found',)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant