Ver Fonte

upd readme

txlyre há 4 semanas atrás
pai
commit
61acdbc299
1 ficheiros alterados com 39 adições e 31 exclusões
  1. 39 31
      readme.md

+ 39 - 31
readme.md

@@ -12,6 +12,9 @@ nil udf                   / special, nil and undefined
 'a'%2                     / = nan, nan used to denote illegal numeric operation
 +1 2 3                    / = udf, attempt to transpose flat vector, udf/undefined used to denote illegal operation
 5 5.5 -5 42               / number (double-precision floats)
+1`000 1`000`000           /
+.5 .429                   /
+0xff 0o4 0b0101           /
 nan inf                   /
 'a' 'b' 'g'               / chars (bytes)
 4t.0                      / 0 NUL byte
@@ -49,6 +52,7 @@ f 5                       / = -5
 
 :  monadic const         create a function that always yields x
 :  dyadic  bind          bind y to symbol x
+:: monadic unbind        unbind symbol x
 :: dyadic  obverse       insert inverse for x
 +  monadic flip          transpose matrix
 +  dyadic  plus          add numbers
@@ -105,7 +109,8 @@ f 5                       / = -5
 >: dyadic  nudgeright    shift elts of y to the right filling gap with x
 ,  monadic enlist        put x into 1-elt array
 ,  dyadic  join          concat x and y
-,. monadic enfile        ame as , enlist but with infinite rank, ,.1 2 3 is (,1),:(,2),:(,3)
+,. monadic enfile        same as , enlist but with infinite rank, ,.1 2 3 is (,1),:(,2),:(,3)
+,. dyadic  enpair        put x and y into 2-elt array
 #  monadic count         yield count of elts of x
 #  dyadic  take          take x first elts of y (or last if x < 0)
 #. monadic where         #.0 0 1 0 1 0 is 2 4
@@ -131,7 +136,8 @@ _: dyadic  base          10_:4242 is 4 2 4 2
 @  monadic abs           |x|
 @  dyadic  at            pick elts from x by indices from y
 @. monadic shuffle       shuffle elts of x
-@. dyadicn member        check whether x is in y
+@. dyadic  member        check whether x is in y
+@: dyadic  indexof       yield index of x in y or #y if x not in y
 {  monadic head          first two elts of x, same as 2#
 {  dyadic  bin           bin search, e.g. 1 3 5 7 9{8 9 0 yields 3 4 -1
 {. monadic tail          last elt of x
@@ -179,42 +185,44 @@ i. monadic import        load and eval source file
 y. monadic system        exec system command (yields output)
 y. dyadic  system2       exec system command with input
 E. monadic exit          exit with exit code
+L. dyadic  tackleft      prepend x to y
+R. dyadic  tackright     append x to y
 
-f"       each          >"1 2 3 yields 2 3 4
-xf"      merge         1 2 3,"a b c yields (1,.a),:(2,.b),:(3,.c)
-f".      eachprior     -".1 2 2 3 5 6 yields 1 0 1 2 1
-xf".     eachpriorwith 0-".1 2 2 3 5 6 yields 1 1 0 1 2 1
-f/       fold          +/1 2 3 yields 6
-xf/      foldwith      1+/1 2 3 yields 7
-f\       scan          +\1 2 3 yields 1 3 6
-xf\      scanwith      1+\1 2 3 yields 1 2 4 7
-f/.      converge      1;_/.1 2 3 yields ()
-f\.      converges     1;_\.1 2 3 yields 1 2 3,:2 3,:(,3),:()
-xf/.     eachright     1-/.1 2 3 yields 0 1 2
-xf\.     eachleft      1-\.1 2 3 yields 0 -1 -2
-f":      rank          #":1 2 3$1 yields 3 3, #":inf 2 3$1 yields 1 1 1,:1 1 1
-xf":     rank          1 2 3 *:":1 1 2 3 yields (,1),:2 2,:3 3 3
-n`       amend         'gw'0 3`'cross' yields 'grows'
-f&.      filter        >;0&.-2!.2 yields 1 2, basically shortcut for ]#.f
-f/:      span          =;' '/:'x y z' yields (,'x'),:(,'y'),:(,'z')
-xf/:     stencil       3+//:!10 yields 3 6 9 12 15 18 21 24, shortcut for f"x|:
-f;.      reflex        *;.5 yields 25, 5%;.2 yields 0.4
+f"         each          >"1 2 3 yields 2 3 4
+xf"        merge         1 2 3,"a b c yields (1,.a),:(2,.b),:(3,.c)
+f".        eachprior     -".1 2 2 3 5 6 yields 1 0 1 2 1
+xf".       eachpriorwith 0-".1 2 2 3 5 6 yields 1 1 0 1 2 1
+f/         fold          +/1 2 3 yields 6
+xf/        foldwith      1+/1 2 3 yields 7
+f\         scan          +\1 2 3 yields 1 3 6
+xf\        scanwith      1+\1 2 3 yields 1 2 4 7
+f/.        converge      1;_/.1 2 3 yields ()
+f\.        converges     1;_\.1 2 3 yields 1 2 3,:2 3,:(,3),:()
+xf/.       eachright     1-/.1 2 3 yields 0 1 2
+xf\.       eachleft      1-\.1 2 3 yields 0 -1 -2
+f":        rank          #":1 2 3$1 yields 3 3, #":inf 2 3$1 yields 1 1 1,:1 1 1
+xf":       rank2         1 2 3 *:":1 1 2 3 yields (,1),:2 2,:3 3 3
+n`         amend         'gw'0 3`'cross' yields 'grows'
+f&.        filter        >;0&.-2!.2 yields 1 2, basically shortcut for ]#.f
+f/:        span          =;' '/:'x y z' yields (,'x'),:(,'y'),:(,'z')
+xf/:       stencil       3+//:!10 yields 3 6 9 12 15 18 21 24, shortcut for f"x|:
+f;.        reflex        *;.5 yields 25, 5%;.2 yields 0.4
 
-f;g      bond      */;!.5 yields 120, +;1 5 yields 6, 5;- 1 yields 4
-f?.x     pick      >;5?.((2*),:<)"3 6 yields 6 5
-f?:F     while     <;5?:>0 yields 5
-n?:f     repeat    5?:*;2 1 yields 32
-f&:F     if        1+&:+2 yields 2
-f;:F     monaddyad -;:+5 yields -5, 1-;:+5 yields 6
+f;g        bond          */;!.5 yields 120, +;1 5 yields 6, 5;- 1 yields 4
+f?.x       pick          >;5?.((2*),:<)"3 6 yields 6 5
+f?:F       while         <;5?:>0 yields 5
+n?:f       repeat        5?:*;2 1 yields 32
+f&:F       if            1+&:+2 yields 2
+f;:F       monaddyad     -;:+5 yields -5, 1-;:+5 yields 6
 
 inverse of a function f is a function ~f that undoes the effect of f
 
 f::~f  obverse  define inverse ~f for f
 
-f-:x   inverse  ~fx
-xf-:y  inverse  (~fx)~f~fx
-f^:Fx  under    ~FfFx
-xf^:Fx under    ~F(Fx)f(Fx)
+f-:x       inverse       ~fx
+xf-:y      inverse2      (~fx)~f~fx
+f^:Fx      under         ~FfFx
+xf^:Fx     under2        ~F(Fx)f(Fx)
 ```
 
 # Prebuilt binaries