Beispiel #1
0
func fallThrough(d dynamics.Dwimmer, s *term.SettingT, quotedSetting term.T) term.T {
	settingT, err := represent.ToSettingT(d, quotedSetting)
	if err != nil {
		return term.Make("asked to decide what to do in setting [], "+
			"but while converting to a setting received []").T(quotedSetting, err)
	}
	transition := ElicitAction(d, s, settingT.Setting)
	if shouldSave(transition) {
		d.Save(settingT.Setting, transition)
	}
	return TakeTransition.T(represent.Transition(transition))
}
Beispiel #2
0
func getTransition(d dynamics.Dwimmer, s *term.SettingT, quotedSetting term.T) term.T {
	setting, err := represent.ToSetting(d, quotedSetting)
	if err != nil {
		return term.Make("asked to get a transition in setting [], "+
			"but while converting to a setting received []").T(quotedSetting, err)
	}
	result, ok := d.Get(setting)
	if !ok {
		return NoCompiledAction.T()
	}
	return core.Answer.T(represent.Transition(result))
}
Beispiel #3
0
func findAction(d dynamics.Dwimmer, s *term.SettingT, quotedSetting term.T) term.T {
	setting, err := represent.ToSetting(d, quotedSetting)
	if err != nil {
		return term.Make("asked to decide what to do in setting [], "+
			"but while converting to a setting received []").T(quotedSetting, err)
	}
	transition, ok := d.Get(setting)
	if !ok {
		transition := ElicitAction(d, s, setting)
		d.Save(setting, transition)
	}
	return core.Answer.T(represent.Transition(transition))
}