Example #1
0
func init() {
	s := term.InitS()
	s = dynamics.ExpectQuestion(s, Explicit, "Q", "t")
	s = dynamics.AddSimple(s, term.ViewS(term.Sr("t")))
	s.AppendTemplate(term.Quoted{}.Head())
	dynamics.AddNative(s, dynamics.Args1(makeExplicit), "t")
}
Example #2
0
func init() {
	s := dynamics.ExpectQuestion(term.InitS(), GetState, "Q")
	dynamics.AddNative(s, dynamics.Args0(getState))

	s = dynamics.ExpectQuestion(term.InitS(), SetState, "Q", "s")
	dynamics.AddNative(s, dynamics.Args1(setState), "s")
}
Example #3
0
func init() {
	s := term.InitS()
	s = dynamics.ExpectQuestion(s, Len, "Q", "s")
	s = dynamics.AddSimple(s, term.ViewS(term.Sr("s")))
	s.AppendTemplate(term.Str("").Head())
	dynamics.AddNative(s, dynamics.Args1(length), "s")

	s = term.InitS()
	s = dynamics.ExpectQuestion(s, Bracketed, "Q", "s")
	s = dynamics.AddSimple(s, term.ViewS(term.Sr("s")))
	s.AppendTemplate(term.Str("").Head())
	dynamics.AddNative(s, dynamics.Args1(bracketed), "s")

	s = term.InitS()
	s = dynamics.ExpectQuestion(s, Concat, "Q", "a", "b")
	s = dynamics.AddSimple(s, term.ViewS(term.Sr("a")))
	s.AppendTemplate(term.Str("").Head())
	s = dynamics.AddSimple(s, term.ViewS(term.Sr("b")))
	s.AppendTemplate(term.Str("").Head())
	dynamics.AddNative(s, dynamics.Args2(concat), "a", "b")

	dynamics.AddNativeResponse(GetChar, 2, dynamics.Args2(getChar))
}
Example #4
0
func init() {
	s := term.InitS()
	s = dynamics.ExpectQuestion(s, RepresentSetting, "Q", "s")
	dynamics.AddNative(s, dynamics.Args1(quote), "s")
}
Example #5
0
func init() {
	s := dynamics.ExpectQuestion(term.InitS(), SettingForChannel, "Q", "c")
	s = dynamics.AddSimple(s, term.ViewS(term.Sr("c")))
	s = s.AppendTemplate(term.Channel{}.Head())
	dynamics.AddNative(s, dynamics.Args1(settingForChannel), "c")
}
Example #6
0
func init() {
	dynamics.AddNativeResponse(GetID, 1, dynamics.Args1(getID))
	dynamics.AddNativeResponse(SettingFromID, 1, dynamics.Args1(settingFromID))
}
Example #7
0
func init() {
	dynamics.AddNativeResponse(RunShell, 1, dynamics.Args1(startWithPrompt))
}
Example #8
0
func init() {
	dynamics.AddNativeResponse(Run, 1, dynamics.Args1(run))
}
Example #9
0
func init() {
	//dynamics.AddNativeResponse(FallThrough, 1, dynamics.Args1(fallThrough))
	dynamics.AddNativeResponse(DisplayTemplate, 1, dynamics.Args1(displayTemplate))
	dynamics.AddNativeResponse(GetActionInput, 2, dynamics.Args2(getInput))
	dynamics.AddNativeResponse(ParseInputAsAction, 2, dynamics.Args2(parseInput))

	var s *term.SettingS
	s = dynamics.ExpectQuestion(term.InitS(), FallThrough, "Q", "setting")
	s = dynamics.AddSimple(s, term.AskS(GetTemplate.S(term.Sr("setting"))))
	s = dynamics.ExpectAnswer(s, core.Answer, "A", "template")
	s = dynamics.AddSimple(s, term.AskS(ElicitActionQ.S(term.Sr("template"))))
	s = dynamics.ExpectAnswer(s, core.Answer, "A2", "action")
	s = dynamics.AddSimple(s, term.AskS(MakeTransition.S(term.Sr("action"))))
	s = dynamics.ExpectAnswer(s, core.Answer, "A3", "transition")
	s = dynamics.AddSimple(s, term.AskS(ShouldRecord.S(term.Sr("action"))))
	s = dynamics.ExpectAnswer(s, core.Answer, "AA", "should")
	s = dynamics.AddSimple(s, term.ViewS(term.Sr("should")))
	s.AppendTemplate(core.Yes)
	s = dynamics.AddSimple(s, term.AskS(SetTransition.S(term.Sr("transition"), term.Sr("template"))))
	s = dynamics.ExpectAnswer(s, core.OK, "A4")
	s = dynamics.AddSimple(s, term.ReturnS(TakeTransition.S(term.Sr("transition"))))

	s = dynamics.ExpectQuestion(term.InitS(), ShouldRecord, "Q", "action")
	s = dynamics.AddSimple(s, term.ViewS(term.Sr("action")))
	s.AppendTemplate(represent.QuotedActionC, "act", "args", "indices")
	s = dynamics.AddSimple(s, term.ViewS(term.Sr("act")))
	for act, template := range represent.ActionLookup {
		t := s.Copy().AppendTemplate(template)
		switch act {
		case term.Replace, term.Correct, term.Replay:
			dynamics.AddSimple(t, term.ReturnS(core.Answer.S(core.No.S())))
		default:
			dynamics.AddSimple(t, term.ReturnS(core.Answer.S(core.Yes.S())))
		}
	}

	s = dynamics.ExpectQuestion(term.InitS(), MakeTransition, "Q", "action")
	s = dynamics.AddSimple(s, term.ReturnS(core.Answer.S(represent.QuotedSimpleTransition.S(term.Sr("action")))))

	s = dynamics.ExpectQuestion(term.InitS(), GetTemplate, "Q", "setting")
	t := dynamics.AddSimple(s, term.ViewS(term.Sr("setting")))
	s = t.Copy().AppendTemplate(represent.QuotedTemplate, "parts")
	s = dynamics.AddSimple(s, term.ReturnS(core.Answer.S(term.Sr("setting"))))
	s = t.Copy().AppendTemplate(represent.QuotedSettingT, "template", "args")
	s = dynamics.AddSimple(s, term.ReturnS(core.Answer.S(term.Sr("template"))))

	s = dynamics.ExpectQuestion(term.InitS(), ElicitActionQ, "Q", "setting")
	s = dynamics.AddSimple(s, term.AskS(GetTemplate.S(term.Sr("setting"))))
	s = dynamics.ExpectAnswer(s, core.Answer, "A", "template")
	s = dynamics.AddSimple(s, term.AskS(ElicitActionQTemplate.S(term.Sr("template"))))
	s = dynamics.ExpectAnswer(s, core.Answer, "A2", "action")
	s = dynamics.AddSimple(s, term.ReturnS(core.Answer.S(term.Sr("action"))))

	s = dynamics.ExpectQuestion(term.InitS(), ElicitActionQTemplate, "Q", "template")
	s = dynamics.AddSimple(s, term.AskS(similarity.GetHints.S(term.Sr("template"))))
	s = dynamics.ExpectAnswer(s, core.Answer, "A", "hints")
	s = dynamics.AddSimple(s, term.AskS(similarity.GetTools.S(term.Sr("template"))))
	s = dynamics.ExpectAnswer(s, core.Answer, "A2", "tools")
	s = dynamics.AddSimple(s, term.AskS(ElicitActionQTemplateHints.S(
		term.Sr("template"), term.Sr("hints"), term.Sr("tools"),
	)))
	s = dynamics.ExpectAnswer(s, core.Answer, "A3", "action")
	s = dynamics.AddSimple(s, term.ReturnS(core.Answer.S(term.Sr("action"))))

	s = dynamics.ExpectQuestion(term.InitS(), ElicitActionQTemplateHints, "Q", "template", "hints", "tools")
	s = dynamics.AddSimple(s, term.AskS(meta.Clear.S()))
	s = dynamics.ExpectAnswer(s, core.OK, "A")
	s = dynamics.AddSimple(s, term.AskS(DisplayTemplate.S(term.Sr("template"))))
	s = dynamics.ExpectAnswer(s, Names, "A2", "names")
	s = dynamics.AddSimple(s, term.AskS(similarity.DisplayTools.S(term.Sr("tools"))))
	s = dynamics.ExpectAnswer(s, similarity.ToolMapping, "A3", "toolmap")
	s = dynamics.AddSimple(s, term.AskS(similarity.DisplayHints.S(term.Sr("hints"), term.Sr("names"))))
	s = dynamics.ExpectAnswer(s, similarity.HintStrings, "A4", "hintstrings")
	s = dynamics.AddSimple(s, term.AskS(GetActionInput.S(term.Sr("hintstrings"), term.Sr("toolmap"))))
	s = dynamics.ExpectAnswer(s, core.Answer, "A5", "input")
	s = dynamics.AddSimple(s, term.AskS(ParseInputAsAction.S(term.Sr("input"), term.Sr("names"))))

	t = dynamics.ExpectAnswer(s.Copy(), core.Answer, "A6", "action")
	t = dynamics.AddSimple(t, term.ReturnS(core.Answer.S(term.Sr("action"))))

	t = dynamics.ExpectAnswer(s.Copy(), GoMeta, "A6")
	t = dynamics.AddSimple(t, term.MetaS())

	dynamics.AddNativeResponse(ActionQ, 1, dynamics.Args1(findAction))
	dynamics.AddNativeResponse(SetTransition, 2, dynamics.Args2(setTransition))
	dynamics.AddNativeResponse(GetTransition, 1, dynamics.Args1(getTransition))
	dynamics.AddNativeResponse(GetContinuations, 1, dynamics.Args1(getContinuations))
	dynamics.AddNativeResponse(AllSettings, 0, dynamics.Args0(allSettings))
}