From 84d6e99891e77ea394b07f0cd6915c67a9e35915 Mon Sep 17 00:00:00 2001 From: Alex Komoroske Date: Tue, 4 Jul 2023 16:03:41 -0700 Subject: [PATCH] Add a complex example, remember-favorite-things. It shows off using the associative memory. Part of #36. --- seeds/example-complex.json | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/seeds/example-complex.json b/seeds/example-complex.json index b7f7b14..02bf61e 100644 --- a/seeds/example-complex.json +++ b/seeds/example-complex.json @@ -1,6 +1,51 @@ { "version": 0, "seeds": { + "remember-favorite-things": { + "type": "let", + "name": "memory", + "value": "komoroske.com:favorite_things", + "block": { + "type": "let", + "id": "ask-favorite-thing", + "name": "komoroske.com:new_favorite_thing", + "value": { + "type": "input", + "question": "Enter a favorite thing, or hit Enter if done" + }, + "block": { + "type": "if", + "test": { + "type": "==", + "a": { + "type": "var", + "name": "komoroske.com:new_favorite_thing" + }, + "b": "" + }, + "then": { + "type": "log", + "value": "OK, done adding favorite things." + }, + "else": { + "type": "array", + "return": "last", + "items": [ + { + "type": "memorize", + "value": { + "type": "var", + "name": "komoroske.com:new_favorite_thing" + } + }, + { + "id": "ask-favorite-thing" + } + ] + } + } + } + }, "name-limerick":{ "type": "prompt", "prompt": {