From 5d97c1df86fb3c8439a44252b533c4847f200411 Mon Sep 17 00:00:00 2001 From: vaclavt Date: Tue, 1 Feb 2022 23:47:05 +0100 Subject: [PATCH] doc updates --- Readme.md | 2 +- debug.lsp | 16 ++++++++++------ doc/Doc.md | 2 +- stdlib/doc.lsp | 6 +++--- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Readme.md b/Readme.md index 9d83a19..65e6836 100644 --- a/Readme.md +++ b/Readme.md @@ -71,7 +71,7 @@ utils/local_install.sh ### TODO - add test for >>> (range 1.5 (inc 5.5)) => (1.500000 2.500000 3.500000 4.500000 5.500000) -- better formating of help +- ml_utils.cpp add all commands into const std::vector commands - unify -f and -run options - add debug support, at least call stack - multiline editing (see kilocpp editor) diff --git a/debug.lsp b/debug.lsp index 98bf1cb..444bd25 100644 --- a/debug.lsp +++ b/debug.lsp @@ -1,11 +1,15 @@ -(defn concat-lists (seq1 seq2) - (do (def l seq1) - (dotimes i (len seq2) - (set! l (push l (index seq2 i)))) - )) +(doc::man "string-regex-list") +(doc::man "string-split") +(doc::man "string-trim") -(print (concat-lists '(1 2 3) '(4 5 6))) +;; (defn concat-lists (seq1 seq2) +;; (do (def l seq1) +;; (dotimes i (len seq2) +;; (set! l (push l (index seq2 i)))) +;; )) + +;; (print (concat-lists '(1 2 3) '(4 5 6))) ;; (1 2 3 4 5 6) ; pridat example diff --git a/doc/Doc.md b/doc/Doc.md index 081afa1..9a82245 100644 --- a/doc/Doc.md +++ b/doc/Doc.md @@ -120,7 +120,7 @@ |`(string-pad str len char rpad_lpad)`|Pad string from start or to end with char to length||String manipulation| |`(string-lpad str len char)`|Pad string from start with char to length len|`>>> (string-lpad "0" 10 "x") => "xxxxxxxxx0"`|String manipulation| |`(string-rpad str len char)`|Pad string from righ with char to length len|`>>> (string-rpad "0" 10 "x") => "0xxxxxxxxx"`|String manipulation| -|`(string-split str separator)`|Splits string into list by regexp|`>>> (string-split "split me by space" "\s+") => ("split" "me" "by" "space")`| +|`(string-split str separator)`|Splits string into list by regexp|`>>> (string-split "split me by space" "\s+") => ("split" "me" "by" "space")`|String manipulation| |`(string-rltrim str len RKRRKR)`|Removes " \n\r\t" from the begininfg or end or both ends of str||Regex| |`(string-ltrim str)`|Removes " \n\r\t" from the begininfg of str||String manipulation| |`(string-rtrim str)`|Removes " \n\r\t" from the end of str||String manipulation| diff --git a/stdlib/doc.lsp b/stdlib/doc.lsp index 3281223..d4feed5 100644 --- a/stdlib/doc.lsp +++ b/stdlib/doc.lsp @@ -28,9 +28,9 @@ (defn doc::print (entry) (do (print (term-green (doc::strip-backticks (second entry))) "-" (third entry)) - ; (print (last entry) "\n") ; doc section - (if (> (string-len (fourth entry)) 2) - (do (def examp (doc::strip-backticks (fourth entry))) + (if (> (string-len (fourth entry)) 2) ; example + (for example (string-regex-list (fourth entry) "(`.*?`)" "token") + (def examp (doc::strip-backticks (first example))) (def pos (string-find examp "=>" 0)) (if (and pos (> pos 0)) (print (term-magenta