[Draft] permyscript - adamjgrant/permutations GitHub Wiki

Say you had this permutation

  • I’m
    • looking for, hiring a
      • creative, art
      • director

The “a” as in “hiring a” would be “an” if followed by “art” but not creative. But we don’t want to slip in an “n” to accompany the “a” if we start with “looking for.” How do you solve for this? You could use a placeholder that is resolved by a callback in the next level. Let’s make “a” the default but give the next level the option to specify an alternative.

{  
  "main": [
    "I'm ", {
      "branch": "searching-for", "then": {
        "branch": "creative-director"
      }
    }
  ],
  "searching-for": [["looking for "], { "set_callback": ["hiring ", "$a", "a"] }],
  "creative-director": [
    "creative ", { "callback": ["art ", "$a", "an"] }, [
      "director"
    ]
  ]
}

This is one way to do it, but is probably a little inflexible for other use cases.

Then branching

Similar to { "branch": "something", "then": [a, b, c] }, The then directive can be used in permyscript

[Thursday March 18, 2021 01:30 PM] Note: This has not been implemented.