Browse Source

add it; upd help; fix scanwith

txlyre 4 months ago
parent
commit
f5832813ba
1 changed files with 16 additions and 2 deletions
  1. 16 2
      jk.c

+ 16 - 2
jk.c

@@ -1798,7 +1798,7 @@ Vt*_advscan_d(St*st,vt*self,Vt*x,Vt*y){if(yt!=ARRAY||le(ya))R y;
   vt*v=_v->val.verb;
   Lst*r=ln();
   Vt*t=x;
-  Lst*ty=ya->next;
+  Lst*ty=ya;
   lp(r,t);
   WH(ty){t=tgth(st,v,t,ty->value,0,0,v->rank[1],v->rank[2]);
     lp(r,t);
@@ -2284,6 +2284,10 @@ cS VHELP =\
 ":  dyadic  bind          bind y to symbol x" "\n"\
 "+  monadic flip          transpose matrix" "\n"\
 "+  dyadic  plus          add numbers" "\n"\
+"+. monadic fibonacci     compute xth fibonacci number" "\n"\
+"+. dyadic  gcd           compute gcd(x, y)" "\n"\
+"+: monadic sin           compute sin(x)" "\n"\
+"+: dyadic  combine       combine digits of x and y, same as 10_.(10_:),(10_:)" "\n"\
 "-  monadic negate        negate number" "\n"\
 "-  dyadic  minus         subtract numbers" "\n"\
 "*  monadic first         yield first element of x" "\n"\
@@ -2313,6 +2317,8 @@ cS VHELP =\
 "#  dyadic  take          take x first elts of y (or last if x < 0)" "\n"\
 "_  monadic nub           mark all unique elts of x, e.g. _'abracadabra' yields 1 1 1 0 1 0 1 0 0 0 0" "\n"\
 "_  dyadic  drop          remove first x elts of y (or last if x < 0)" "\n"\
+"_. monadic unbits        _.1 0 1 is 5" "\n"\
+"_: monadic bits          _:5 is 1 0 1" "\n"\
 "?  monadic unique        distinct elts of x, same as ]#._" "\n"\
 "?  dyadic  find          find all indices of x in y" "\n"\
 "&  monadic flatten       flatten an array, same as ,//." "\n"\
@@ -2336,6 +2342,8 @@ cS V2HELP =\
 "f. monadic selfref1      monadic reference to current function or rhs of bind" "\n"\
 "f. dyadic  selfref2      dyadic reference to current function or rhs of bind" "\n"\
 "t. monadic type          type of x, array=0, verb=1, symbol=2, number=3, char=4, nil=5, udf=6" "\n"\
+"r. monadic deal          yield random elt of x" "\n"\
+"r. dyadic  roll          roll xdy (note: y is 0-based, so >xr.y for 1-based)" "\n"\
 "";
 cS AHELP =\
 "f\"       each          >\"1 2 3 yields 2 3 4" "\n"\
@@ -2346,6 +2354,11 @@ cS AHELP =\
 "\n"\
 "f/       fold          +/1 2 3 yields 6" "\n"\
 "xf/      foldwith      1+/1 2 3 yields 7" "\n"\
+"\n"\
+"f\\       scan          +/1 2 3 yields 1 3 6" "\n"\
+"xf\\      scanwith      1+\\1 2 3 yields 1 2 4 7" "\n"\
+"\n"\
+"f/.      converge      _;1/.1 2 3 yields ()" "\n"\
 "";
 cS CHELP =\
 "f;g      bond     */;!.5 yields 120, +;1 5 yields 6, 5;- 1 yields 4" "\n"\
@@ -2492,6 +2505,7 @@ I main(I argc,S*argv){GC_INIT();
     s=Bread(buffer);
     Vt*v=Srun(st,s);
     FR(s);s=NULL;
-    if(v->tag!=NIL){S s=Vshow(v);
+    if(v->tag!=NIL){Tset(st->env,"it",v);
+      S s=Vshow(v);
       fputs(s,stdout);
       if(Iin)putc('\n',stdout);}}}