Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Paul E Bennett Newsgroups: comp.lang.forth Subject: Re: A poor mans memoizer. Date: Thu, 04 Dec 2014 10:19:04 +0000 Organization: Hidecs Consultancy Lines: 55 Message-ID: References: <547db280$0$6898$e4fe514c@dreader36.news.xs4all.nl> <547f0d79$0$15861$e4fe514c@dreader35.news.xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Trace: individual.net OO+UqnwpdxNXVzF8XPRSpweolwcSgDtFS8lUPrhIcG8Mz0WtrG Cancel-Lock: sha1:k3vPpeJDC/dRgQVUlg3kBSNYltE= User-Agent: KNode/4.11.4 Xref: csiph.com comp.lang.forth:34771 Albert van der Horst wrote: [%X] >>*sigh* No stack comments anywhere. Very hard to read, even though the >>definitions are short and look well-factored, because it's unclear what >>the inputs and outputs are. > > The BAG is in library format, i.e. it is intended > to be loaded. It is not part of the memoization I > present and not intended to be documented or discussed. > > But .. > > There are stack comments, but not in a format > familiar to you. My stack comments reveal more about the > actual working of the words than the silly (my opinion!) > ( n n -- ud ) diagrams. > > What is unclear about > > ( For VALUE and BAG : ADDRESS of value in bag/nill.) > > If I compress that to ( n addr -- addr ) are you happy? > > Let's see: > I use > BAG ( Create a bag "x" with X items. ) > !BAG ( Make the BAG empty ) > BAG-WHERE ( For VALUE and BAG : ADDRESS of value in bag/nill.) > BAG+! ( Push ITEM to the BAG ) > > I'm pretty sure a competent Forther can recreate the > BAG-package inasfar needed for memoize from this spec in any > Forth in no time. > > That is my goal, which only comes into play if just > clipping the BAG screens and load it fails. In following my coding style standard, I have two types of commenting for each word. The first is the normal stack comment in the standardised style used within the standards document. The second is a glossary text entry, again in the style of the standards document. I include both types in each definitions source code. Such documentation style works with products like DocGen to assist in extracting just the names and comments for use in other documentation. -- ******************************************************************** Paul E. Bennett IEng MIET..... Forth based HIDECS Consultancy............. Mob: +44 (0)7811-639972 Tel: +44 (0)1235-510979 Going Forth Safely ..... EBA. www.electric-boat-association.org.uk.. ********************************************************************