Skip to content

Commit

Permalink
fix apply for nested arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
briangu committed Jul 20, 2023
1 parent d447bdc commit 56ea6d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions klongpy/dyads.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ def eval_dyad_at_index(klong, a, b):
"""
if isinstance(a, (KGFn, KGSym)):
# TODO: fix arity
return klong.eval(KGCall(a, b.tolist() if np.isarray(b) else b, arity=2))
b = [x for x in b] if np.isarray(b) else b
return klong.eval(KGCall(a, b, arity=1))
j = isinstance(a,str)
a = str_to_chr_arr(a) if j else a
if is_list(b):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_extra_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ class TestExtraCoreSuite(unittest.TestCase):
def assert_eval_cmp(self, a, b, klong=None):
self.assertTrue(eval_cmp(a, b, klong=klong))

@unittest.skip
def test_apply_range(self):
klong = KlongInterpreter()
r = klong("{x}@,!100")
self.assertTrue(kg_equal(r, np.arange(100)))
klong("avg::{(+/x)%#x}")
r = klong("avg@,!100")
self.assertEqual(r,49.5)
Expand Down

0 comments on commit 56ea6d5

Please sign in to comment.