all repos — min @ af73f53cdf2b31962defff0a09c820712636a9e1

A small but practical concatenative programming language.

Doc updates.
h3rald h3rald@h3rald.com
Fri, 29 Jan 2021 03:01:17 +0000
commit

af73f53cdf2b31962defff0a09c820712636a9e1

parent

fcaf01a5f2ed3fdf96fdc6a32585ec5b2ee87492

3 files changed, 11 insertions(+), 24 deletions(-)

jump to
M next-release.mdnext-release.md

@@ -1,6 +1,7 @@

* Implemented "auto-popping" by adding **!** at the end of any symbol. * Removed all symbols ending with **!** as auto-popping will work instead. * Improved contrast and readability of the min web site. +* Removed **typeclass** and extended **operator** to create tupe classes as well. * Renamed **string** and **float** type names (used in operator signatures) to **str** and **flt** respectively. * Removed **define-sigil**, use **operator** instead. * Removed **module** and **+** (sigil); use **require** to create modules.

@@ -14,4 +15,4 @@ * `delete` -> `delete-symbol`

* `defined?` -> `defined-symbol?` * `seal` -> `seal-symbol` * `sealed?` -> `sealed-symbol?` - * `unseal` -> `unseal-symbol`+ * `unseal` -> `unseal-symbol`
M site/contents/learn-operators.mdsite/contents/learn-operators.md

@@ -135,9 +135,13 @@ Besides standard base types, you can define your own *type classes* to express custom constraints/validations for operator input and output values.

Consider the following type class definition validating a quotation containing strings: - ((string?) all?) 'strquot typeclass + ( + typeclass strquot + (quot :q ==> bool :o) + (q (string?) all? @o) + ) :: -The {#link-operator||lang||typeclass#} operator defines a symbol prefixed with `type:` (`type:strquot` in this case) corresponding to a type class that can be used in operator signatures in place of a type, like this: +The {#link-operator||lang||operator#} operator can be used to define a symbol prefixed with `typeclass:` (`typeclass:strquot` in this case) corresponding to a type class that can be used in operator signatures in place of a type, like this: ( symbol join-strings

@@ -152,7 +156,7 @@

> %tip% > Tip > -> `type:`-prefixed symbols are just like ordinary shmbols: they are lexically scoped, they can be sealed, unsealed and deleted. +> `typeclass:`-prefixed symbols are just like ordinary shmbols: they are lexically scoped, they can be sealed, unsealed and deleted. ### Generics
M site/contents/reference-lang.mdsite/contents/reference-lang.md

@@ -277,11 +277,11 @@ {#op||loglevel?||{{none}}||{{s}}||

Returns the current log level (debug, info, notive, warn, error or fatal). #} {#op||operator||{{q}}||{{a0p}}|| -> Provides a way to define a new operator (symbol or sigil) on the current scope performing additional checks (compared to `define` and `define-sigil`), and automatically mapping inputs and outputs. +> Provides a way to define a new operator (symbol, sigil, or typeclass) on the current scope performing additional checks (compared to `define` and `define-sigil`), and automatically mapping inputs and outputs. > > {{q}} is a quotation containing: > -> * A symbol identifying the type of operator to define (`symbol` or `sigil`). +> * A symbol identifying the type of operator to define (`symbol`, `sigil`, or `typeclass`). > * A symbol identifying the name of the operator. > * A quotation defining the signature of the operatorm containing input and output values identified by their type and a capturing symbol, separated by the `==>` symbol. > * A quotation identifying the body of the operator.

@@ -500,24 +500,6 @@ > > (pop)

> > (format-error puts) > > (0) > > ) try #} - -{#op||typeclass||{{q}} {{sl}}||{{none}}|| -> Defines a new type class {{sl}} set to quotation {{q}}, which can be used in operator signatures. -> -> > %sidebar% -> > Example -> > -> > Consider the following type class which defines a natural number: -> > -> > (:n ((n integer?) (n 0 >)) &&) 'natural typeclass -> > -> > It can now be used in operator signatures, like this: -> > -> > ( -> > symbol natural-sum -> > (natural :n natural :m ==> natural :result) -> > (n m + @result) -> > ) :: #} {#op||unless||{{q1}} {{q2}}||{{a0p}}|| If {{1}} evaluates to {{f}} then evaluates {{2}}.#}