all repos — min @ 9115c9dac34de13ea15d214035dc3436d493175c

A small but practical concatenative programming language.

Added quotesym symbol.
h3rald h3rald@h3rald.com
Sun, 07 Feb 2021 08:12:35 +0000
commit

9115c9dac34de13ea15d214035dc3436d493175c

parent

6e1d32a14f45e70f30f8cbc8172836c8d6fc25cf

3 files changed, 20 insertions(+), 8 deletions(-)

jump to
M minpkg/lib/min_lang.nimminpkg/lib/min_lang.nim

@@ -1089,12 +1089,15 @@ i.push "$ ".newVal

else: i.eval(""""[$1]\n$$ " (.) => %""") + def.symbol("quotesym") do (i: In): + let vals = i.expect("str") + let s = vals[0] + i.push(@[i.newSym(s.strVal)].newVal) + # Sigils def.sigil("'") do (i: In): - let vals = i.expect("str") - let s = vals[0] - i.push(@[i.newSym(s.strVal)].newVal) + i.pushSym("quotesym") def.sigil(":") do (i: In): i.pushSym("define")

@@ -1141,7 +1144,7 @@ def.symbol("~") do (i: In):

i.pushSym("lambda-bind") def.symbol("'") do (i: In): - i.pushSym("quote") + i.pushSym("quotesym") def.symbol("->") do (i: In): i.pushSym("dequote")
M next-release.mdnext-release.md

@@ -1,7 +1,12 @@

+### Breaking changes + +* #141 - The **'** symbol is now an alias of the **quotesym** symbol (but its behavior remains the same: it can be used to created quotes symbols from a string), and the **'** sigil is equivalent to the new **quotesym** symbol, not **quote**. + ### Fixes * Now adding **help.json** to installation folder when installing via nimble. -### New Features +### New features -* The symbol **type?** is now able to check if a value satisfies a type expression, not only a simple type (#144). Note however that it is now necessary to prepend dictionary types with `dict:` (as in type expressions). +* #144 - The symbol **type?** is now able to check if a value satisfies a type expression, not only a simple type. Note however that it is now necessary to prepend dictionary types with `dict:` (as in type expressions). +* #141 - A new **quotesym** symbol has been added to transform a string into a quoted symbol. This is equivalent to the behavior of the **'** sigil.
M site/contents/reference-lang.mdsite/contents/reference-lang.md

@@ -4,9 +4,9 @@ title: "lang Module"

----- {@ _defs_.md || 0 @} -{#sig||'||quote#} +{#sig||'||quotesym#} -{#alias||'||quote#} +{#alias||'||quotesym#} {#sig||:||define#}

@@ -362,6 +362,10 @@ Exits the program or shell with 0 as return code. #}

{#op||quote||{{any}}||({{any}})|| Wraps {{any}} in a quotation. #} + +{#op||quotesym||{{str}}||({{sym}})|| +Creates a symbol with the value of {{str}} and wraps it in a quotation. #} + {#op||raise||{{e}}||{{none}}|| Raises the error specified via the dictionary {{e}}.#}