From 1837e71bc2bfabf04ad9a13be99b52bc7782662a Mon Sep 17 00:00:00 2001 From: crc Date: Wed, 25 Oct 2017 01:10:58 +0000 Subject: [PATCH] add a little commentary on `does` FossilOrigin-Name: 79c8127fb44594ca2dd97da51fca9dfa7908d6b8905bd2742aeb8e79eab4325b --- literate/RetroForth.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/literate/RetroForth.md b/literate/RetroForth.md index cc10413..4580b34 100644 --- a/literate/RetroForth.md +++ b/literate/RetroForth.md @@ -532,8 +532,8 @@ workable approach. Temporary strings are allocated in a circular pool (at STRINGS). ~~~ -:TempStrings ; &class:data reclass #32 !TempStrings -:TempStringMax ; &class:data reclass #512 !TempStringMax +:TempStrings ; data #32 !TempStrings +:TempStringMax ; data #512 !TempStringMax :STRINGS EOM @TempStrings @TempStringMax * - ; {{ @@ -694,6 +694,9 @@ Copy a string, including the terminator. :s:copy (ss-) over s:length n:inc copy ; ~~~ +RETRO provides string constants for several ranges of characters that +are of some general interest. + ~~~ :s:DIGITS (-s) '0123456789 ; :s:ASCII-LOWERCASE (-s) 'abcdefghijklmnopqrstuvwxyz ; @@ -911,8 +914,12 @@ Rather than using a lot of shufflers, `reorder` simplfies this into: }} ~~~ -I need to describe these and provide some examples of where they are -useful. +`does` is intended to be paired with `d:create` to attach an action to a +newwly created data structure. An example use might be something like: + + :constant (ns-) d:create , [ fetch ] does ; + +In a traditional Forth this is similar in spirit to DOES>. ~~~ :curry (vp-p) here [ swap compile:lit compile:call compile:ret ] dip ;