[சனி மார்ச் 16, 2024] Ihor Radchenko wrote: > Visuwesh writes: > >> Attached patch adds support for passing tables as matrices (or vector) >> to a Calc source block through the :var parameter. There might be a >> better way to do it than manually construct the data structure expected >> by Calc for a matrix but given that it rarely sees changes in this area, >> it shouldn't be a bother. >> I also added tests for this feature, and other simple tests to ensure >> everything works. I checked that all the tests passed on my side. > > Thanks! > Since you are adding a new feature, may you also add an entry to etc/ORG-NEWS? Now done. >> - (calc-push-list (list (cdr pair))) >> + (let ((val (cdr pair))) >> + (calc-push-list >> + (list (if (listp val) >> + (cons 'vec >> + (if (null (cdr val)) >> + (car val) >> + (mapcar (lambda (x) (if (listp x) (cons 'vec x) x)) >> + val))) >> + val)))) > > It would be nice to add code comments explaining the Calc's internal > format. Ideally, with references to Calc's manual or source code. > Otherwise, this code looks like black magic :) I hope the comment I added in the attached patch is clear enough. >> +++ b/testing/examples/ob-calc-test.org >> @@ -0,0 +1,57 @@ >> +#+TITLE: Tests for ob-calc >> +#+OPTIONS: ^:nil > > Thanks a lot for adding many tests! > Would you mind using `org-test-with-temp-text' instead of > `org-test-at-id' as much as possible? Otherwise, looking at tests like OK, I wasn't sure what test style to use since the README in testing/ does not talk about writing new tests. Now I have adapted the tests to use org-test-with-temp-text.