Opa DocumentationのHello-wikiコードを編集しています。ウィキ トピックに、データベース内の既存のトピックのリストが必要です。デフォルトのトピックで呼び出される関数があります。
/**
* Collect all created topics from /wiki
* and present them in Markdown format
*/
function collect_topics(page) {
string collection = "#Available topics\n"
// Format as a list
Set.iter(function( topic ) {
collection = "{collection} *[{topic}](./{topic})\n"
}, [/wiki])
save_source(page, collection)
}
...
function start(url) {
match (url) {
case {path: [] ... } :
{ collect_topics("Topics") };
case {~path ... } :
{ display(String.capitalize(String.to_lower(String.concat("::", path)))) };
}
}
これにより、構文エラーが発生します。文字列は不変であるため、私の理解では、「条件としてバインディングが見つかりました」です。作成した文字列を変更する方法はありますか? 例えば:
string x = "foo"
x = x ^ x
これが不可能な場合、より良いアプローチは何でしょうか?