Skip to content

Commit c62db03

Browse files
committed
fix #571: Dictionaries and Symbolic Indexing
1 parent a50105f commit c62db03

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/tests.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ Z I tests02()
313313
TC( -1, 4: (.((`a;1);(`b;2)))(,`a) ) // issue 561
314314
TC_( "1 2", "(1 2 1)\\1" ) // issue 572
315315
TC_( "12 6 3", "0 1 1 3 2 5 3 7 4 9 5 11 6\\ 12" ) // issue 572
316+
TC( 1, d:.((`a;0);(`b;1)); `d .`b ) // issue 571
316317

317318
//Error trap: {[a;b][c;d] a+b} -> parse error ; { {[a][b] }} -> parse error
318319
TC(.[*; (3;4); :], (0;12) )

src/vd.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ K dot(K a, K b) //NB: b can be a cheating 0-type with NULLs .. ?
118118
//TODO: create dename without path-creation effect. will lookup correct handle or return a _n to use ... but won't create path. K at() also needs this.
119119
//if(4==a->t)a=retrieveByHandle(a);
120120

121+
if(4==a->t && 4==b->t)
122+
{ S s=(char*)malloc(2+strlen(*kS(a))+strlen(*kS(b)));
123+
s=strcpy(s,*kS(a)); strcat(s,"."); strcat(s,*kS(b));
124+
R *inKtree(&kK((kK(KTREE))[0])[1],s,0); }
121125
if(7==a->t) R vf_ex(&a,b); //Verb: "Apply" //TODO: my guess is this fails everywhere vf_ex does (derived verbs?) (|+) . (0;1) ???
122126
R of(a,b); //TODO: vf_ex might/could implement this itself ?
123127
}

src/vd.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ K kcloneI(K a,const char*f,int n);
66
#define kclone(a) kcloneI(a,__FILE__,__LINE__)
77
extern S d_;
88
extern I fbs;
9-
K *denameS(S dir_string,S t,I create);
9+
extern K*inKtree(K*d, S t, I create);
10+
extern K *denameS(S dir_string,S t,I create);
1011
extern C errmsg[256];
1112
I isColonDyadic(K x);
1213
K dot_tetradic(K a,K b,K c,K y);

0 commit comments

Comments
 (0)