From 54b7657e1aa5ee5442c3959bbea7c76e4644acbc Mon Sep 17 00:00:00 2001 From: Andy C Date: Wed, 6 Nov 2024 20:39:36 -0500 Subject: [PATCH] [doc/ref] Update methods, e.g. Dict.accum() and clear() We're missing substring search, e.g. mystr.find('foo') and so forth --- doc/ref/chap-index.md | 10 ++++++++++ doc/ref/chap-type-method.md | 29 ++++++++++++++++++++++++----- doc/ref/toc-ysh.md | 21 +++++++++++---------- 3 files changed, 45 insertions(+), 15 deletions(-) diff --git a/doc/ref/chap-index.md b/doc/ref/chap-index.md index 20c1ddaca..3021ea5fd 100644 --- a/doc/ref/chap-index.md +++ b/doc/ref/chap-index.md @@ -29,6 +29,16 @@ The name `append` can refer to: [cmd/append]: chap-builtin-cmd.html#cmd/append [List/append]: chap-type-method.html#List/append +### clear + +The name `clear` can refer to: + +- The [List method clear][List/clear] +- The [Dict method clear][Dict/clear] + +[List/clear]: chap-type-method.html#List/clear +[Dict/clear]: chap-type-method.html#Dict/clear + ### false The name `false` can refer to: diff --git a/doc/ref/chap-type-method.md b/doc/ref/chap-type-method.md index cef54f3f5..6687e2b39 100644 --- a/doc/ref/chap-type-method.md +++ b/doc/ref/chap-type-method.md @@ -140,7 +140,19 @@ An `Obj` instance representing the string type. ### find() -TODO +TODO: + + var i = mystr.find('foo') + +Similar to + + = 'foo' in mystr + +Both of them do substring search. + +Also similar to `mystr.search(eggex)`. + + ### replace() @@ -453,7 +465,7 @@ Reverses a list in place. call fruits->reverse() echo @fruits # => pear banana apple -### clear() +### List/clear() TODO: @@ -489,11 +501,18 @@ Ensures that the given key does not exist in the dictionary. = book # => (Dict) {title: "The Histories"} -### Dict/append() +### accum() + +TODO: + + call mydict->accum('key', 'string to append') + +Similar: + + setvar mydict['k'] += 3 # TODO: default value of 0 -TODO -### clear() +### Dict/clear() TODO: diff --git a/doc/ref/toc-ysh.md b/doc/ref/toc-ysh.md index 63c0f6546..3a4833f6b 100644 --- a/doc/ref/toc-ysh.md +++ b/doc/ref/toc-ysh.md @@ -45,29 +45,31 @@ error handling, and more. Float Range [String] Str X find() replace() - trim() trimStart() trimEnd() + trim() trimStart() trimEnd() startsWith() endsWith() upper() lower() search() leftMatch() + split() [Patterns] Eggex - Match group() start() end() + Match group() start() end() X groups() X groupDict() - [Containers] List List/append() pop() extend() - indexOf() X insert() X remove() - reverse() X clear() - Dict erase() X clear() X Dict/append() + [Containers] List List/append() pop() extend() + indexOf() X insert() X remove() + reverse() X List/clear() + Dict erase() X Dict/clear() X accum() Place setValue() [Code Types] Func BuiltinFunc BoundFunc Proc BuiltinProc [Objects] Obj __invoke__ new - X __call__ __index__ X __str__ + X __call__ __index__ X __str__ [Reflection] Command CommandFrag Expr Frame io stdin evalExpr() - eval() evalToDict() captureStdout() + eval() evalToDict() + captureStdout() promptVal() - X time() X strftime() X glob() + X time() X strftime() X glob() vm getFrame() id() ``` @@ -89,7 +91,6 @@ error handling, and more. [Word] glob() maybe() [Serialize] toJson() fromJson() toJson8() fromJson8() -X [J8 Decode] J8.Bool() J8.Int() ... [Pattern] _group() _start() _end() [Introspection] shvarGet() getVar() setVar() parseCommand() X parseExpr() X bindFrame()