diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-01 14:05:10 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-01 14:05:10 -0400 |
| commit | 4d59fc2987e52da0274e6b204a9d2885613f74b7 (patch) | |
| tree | 8c262f99cb6ae9b550b9f8abf0ab0477044d087a /docs/langs.md | |
| parent | 7a2c99de74f5870e1dea5b59d049678ad0ef8e44 (diff) | |
Move patterns into a module
Diffstat (limited to 'docs/langs.md')
| -rw-r--r-- | docs/langs.md | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/docs/langs.md b/docs/langs.md index 0e6242db..d7225ae5 100644 --- a/docs/langs.md +++ b/docs/langs.md @@ -11,12 +11,12 @@ where a different type of string is needed. ```tomo lang HTML: convert(t:Text -> HTML): - t = t:replace_all({ - $/&/ = "&", - $/</ = "<", - $/>/ = ">", - $/"/ = """, - $/'/ = "'", + t = t:translate({ + "&" = "&", + "<" = "<", + ">" = ">", + '"' = """, + "'" = "'", }) return HTML.from_text(t) @@ -75,7 +75,7 @@ instead of building a global function called `execute()` that takes a ```tomo lang Sh: convert(text:Text -> Sh): - return Sh.from_text("'" ++ text:replace($/'/, "''") ++ "'") + return Sh.from_text("'" ++ text:replace("'", "''") ++ "'") func execute(sh:Sh -> Text): ... @@ -94,7 +94,7 @@ another type's block or at the top level. ```tomo lang Sh: convert(text:Text -> Sh): - return Sh.from_text("'" ++ text:replace($/'/, "''") ++ "'") + return Sh.from_text("'" ++ text:replace("'", "''") ++ "'") struct Foo(x,y:Int): convert(f:Foo -> Sh): |
