old_test_quick.sh 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. .function_flag_ignorant # args ... {.nop $args}
  2. .function if_only {.if $* {.argfunction}; .else {.nop}}
  3. .function_flag_ignorant c args ... {.combine $args$}
  4. .function_flag_ignorant cc args {.combine $args$}
  5. .function_all_flags a [-*] [-x b ...] c {
  6. .for &&{.list_locals}$ {.combine $1 \( $$1 \) \ }}
  7. .whence_function a
  8. a first
  9. a -x first
  10. a -x (fi rst) second
  11. a -x first (sec ond) third
  12. a -x (fi rst) (sec ond) third fourth
  13. .function_all_flags a [-*] [-x ... b] c {
  14. .for &&{.list_locals}$ {.combine $1 \( $$1 \) \ }
  15. .combine $nl
  16. if_only .test_not_empty $-* {c (-*: ) $-*$ $nl}
  17. if_only .var_exists -x {c (-x: ) $-x$ $nl}
  18. if_only .var_exists b {c (b: ) $b$ $nl}
  19. if_only .var_exists c {c (c: ) $c$ $nl}
  20. }
  21. .whence_function a
  22. a first
  23. a -x first
  24. a -x (fi rst) second
  25. a -x first (sec ond) third
  26. a -x (fi rst) (sec ond) third fourth
  27. .whence_function if_only
  28. .combine &{c (sec ond)} x $nl x
  29. .combine &{c (sec ond)}$ x $nl x
  30. .combine &{cc (sec ond)} x $nl x
  31. .combine &{cc (sec ond)}$ x $nl x
  32. .combine &{.combine &{.combine ((sec ond))}}$ x $nl x
  33. .combine &{.combine &{.combine ((sec ond))}$}$ x $nl x
  34. .global nest 0
  35. .set MAX_NESTING 90
  36. .function_flag_ignorant rx lhs rhs ... {
  37. .for &&{.list_locals}$ {.combine $1 \( $$1 \) \ }
  38. .combine $nl
  39. recurse $lhs $rhs}
  40. .function_flag_ignorant recurse lhs ... rhs {
  41. .for &&{.list_locals}$ {.combine $1 \( $$1 \) $nl}
  42. .combine $nl
  43. .var_add nest 1
  44. .if .test_less $nest 5 {recurse $lhs $rhs$}
  45. .else_if .test_less $nest 10 {recurse $lhs$ $rhs}
  46. .else_if .test_less $nest 15 {rx $lhs$ $rhs}
  47. .else_if .test_less $nest 20 {rx $lhs$ $rhs}
  48. .else {.nop}
  49. .var_subtract nest 1}
  50. .whence_function recurse
  51. recurse a b c d e f g h i j k l m n o p q r s t u v w x y z
  52. # recurse ((((((((a b))) (c d)) (e f)) (g h)) (i j)) k l) m n (o (p (q (r (s (t (u (v (w (x (y z)))))))))))
  53. recurse (a b) ((c d e) ((f g h) ((i j k) ((l m n) ((o p q) ((r s t) ((u v w) ((x y z)))))))))
  54. .function_all_flags a [-*] x [... y z] {
  55. .for &&{.list_locals}$ {.combine $1 \( $$1 \) \ }
  56. .combine $nl
  57. .echo (\\$x$: ) $x$1 $nl
  58. .echo (\\$x$: ) $x$ $nl}
  59. a \( (sec ond) third fourth
  60. # if (nesting) throw Signal_argm (Argm::Mismatched_parenthesis, in);
  61. # and that line is what thows the earlier parenthesis. i don't know why the
  62. # semicolon causes a mismatched brace error
  63. .nop $A $FIGNORE