This commit is contained in:
Scott Richmond 2023-12-12 15:38:16 -05:00
parent adf7c4e9e3
commit 075f7e8f9e
4 changed files with 272 additions and 258 deletions

File diff suppressed because one or more lines are too long

View File

@ -20,7 +20,7 @@
(defn escape-punctuation [the-str] (string/replace the-str #"[\!\?]" "")) (defn escape-punctuation [the-str] (string/replace the-str #"[\!\?]" ""))
(defn toc-entry [name] (let [escaped (escape-underscores name)] (str "[" escaped "](#" (escape-punctuation escaped) ")"))) (defn toc-entry [name] (let [escaped (escape-underscores name)] (str "[" escaped "](#" (escape-punctuation escaped) ")")))
(def toc (string/join "    " (map toc-entry sorted-names))) (def toc (string/join "    " (map toc-entry sorted-names)))
@ -34,7 +34,7 @@
pattern-lines (subvec lines 2) pattern-lines (subvec lines 2)
patterns (string/join "\n" pattern-lines) patterns (string/join "\n" pattern-lines)
] ]
(str header "\n" description "```\n" patterns "\n```") (str header description "\n```\n" patterns "\n```")
)))) ))))
(def entries (string/join "\n\n" (map compose-entry sorted-names))) (def entries (string/join "\n\n" (map compose-entry sorted-names)))
@ -55,6 +55,12 @@ or they are variations on a function, e.g. `div/0` as a variation on `div`.
**How entries are formatted.** Each entry has a brief (sometimes too brief!) description of what it does. **How entries are formatted.** Each entry has a brief (sometimes too brief!) description of what it does.
It is followed by the patterns for each of its function clauses. It is followed by the patterns for each of its function clauses.
This should be enough to indicate order of arguments, types, and so on.
**Patterns often, but do not always, indicate types.** Typed patterns are written as `foo as :bar`,
where the type is indicated by the keyword. Possible ludus types are: `:nil`, `:boolean`, `:number`, `:keyword` (i.e., atomic values);
`:string` (strings are their own beast)'' `:tuple` and `:list` (indexed collections); `:set` (again, their own beast),
`:dict` and `:ns` (associative collections); and `:ref` (references).
" "
toc toc

View File

@ -1,5 +1,12 @@
& this file, uniquely, gets `base` loaded as context. See src/ludus/base.cljc for exports & this file, uniquely, gets `base` loaded as context. See src/ludus/base.cljc for exports
&&& TODO
& functions to add:
& true?
& set?
& tuple?
& ref?
& the very base: know something's type & the very base: know something's type
fn type { fn type {
"Returns a keyword representing the type of the value passed in." "Returns a keyword representing the type of the value passed in."
@ -19,7 +26,7 @@ fn eq? {
} }
} }
& TODO: add not_eq & TODO: add neq?
&&& functions: getting things done &&& functions: getting things done
fn fn? { fn fn? {

1
target/repl-port Normal file
View File

@ -0,0 +1 @@
54180