Reckon

 

 

Reckon[expr] interprets expr and returns the result.

Reckon[Sequence[first,..., last]] evaluates first,..., last in sequence returning the evaluated result of last.

Reckon[env][expr] evaluates expr using the ContextSequence, env.

Not[Reckon][expr] is a wrapper which protects expr from whatever evaluation it is subject to.

Reckon[Name][name] returns "name"s Definition.

Reckon[String]["input"] attempts to interpret the String["input"] as an Expression.

Reckon[Expression[Branch]][exprBranchSequence__] executes each ExpressionAtom in exprBranchSequence.

Reckon[Stream[n]] returns the current position in Stream[n] and increments the StreamSlot.

 

See definition for "reckon".

 



Introduction

 

(1)                    Reckon[expr]

 

...interprets expr, and returns the result. 

What it means for expr to be "interpreted" is developed below and in NameRecognition & SymbolProcessing.

 

If expr is a simple expression (without square brackets or arguments), its assignment is returned. 

An assignment is made to expr when Name[expr, assignment] is reckoned.

 

If expr has a Head and square brackets holding zero or more arguments, E.G.

 

                        head[arg1, arg2,...],

 

...then head is interpreted first, and each argument is interpreted in order from left to right.

"Interpreted" means Reckon[...]'s argument is compared with ElicitationForms which match in the CurrentContext or match in another Context on the ContextSequence.  If there is a matching ElicitationForm, the substitutions are made according to the requirements its Type[_,_] constructions.  The elicitation's assignment is returned with these substitutions.  No further evaluation is made unless the elicitation's assignment is wrapped in a Reckon[...], Function[...], Compile[...], or a Compute[...] construct.

 

(2)                    Reckon[Sequence[expr1, expr2,...]]

 

...evaluates expr1, and then evaluates expr2, and so on.  The last element in the Sequence is evaluated and its result is returned. 

 

[The above form requires that Reckon be a NamePattern.  (Name[Reckon[Pattern]] = True)  Otherwise the significance of the "Sequence[expr1, expr2,...]" would be lost in sequence's merge with "expr1, expr2,...".]

 

 

Suppose env is assigned to a ContextSequence.  Then...

 

(3)                    Reckon[env][expr]

 

...evaluates expr using the environment defined by env

The first element in the ContextSequence, env, is the CurrentContext wherein expr is evaluated.

 



NotReckon

 

If expr is any Expression, then...

 

(4)                    Not[Reckon][expr]

 

...causes expr to not be reckoned if it is encountered as part of a containing Expression which is being reckoned. (4) is a wrapper which protects expr from whatever evaluation it is subject to.  A SubstitutionName assigned in an ElicitationForm is the only exception.  "Not[Reckon][expr]" could be part of a construct that installs a SubstitutionName into expr which will otherwise be unevaluated.

 

Suppose patForm is a PatternSet. Normally, if patForm is a subExpression in a larger PatternForm it is not treated literally. (Pattern[expr] treats everything in expr literally except "Pattern[...]" subPatterns.) The patForm subPattern is interpreted as part of the PatternForm that must match patForm for the larger Pattern to match. 

 

However, if...

 

(5)                    Not[Reckon][patForm]

 

...is a subExpression in a PatternForm, then patForm will be treated literally, (like everything else in the PatternForm that is not a PatternSet). By wrapping patForm in Not[Reckon][patForm], patForm is literally matched, rather then being interpreted as a PatternSet.


 

 


NameRecognition & SymbolProcessing

 

In Grok32`, language processing occurs whenever an Expression is Reckoned, Computed, Compiled or Functions.  In all cases, NameRecognition is central

 

Expressions are interpreted very differently in Reckon[...] versus the way a Function[...] is executed exhaustively. The way NameRecognition is realized distinguishes an executive Function[...] versus an interpreted Reckon[...]ing.

 

When an Expression is reckoned, (or executed in the sense that a Function executes its body), it is compared with ElicitationForms which match in the CurrentContext or match in another Context on the ContextSequence.  If there is a matching ElicitationForm, the substitutions, if any, are made (according to the requirements of the Type[_,_] constructions).  The elicitation's assignment is returned with these substitutions.  No further evaluation is made unless the elicitation's assignment is wrapped in a Reckon[...], Function[...], Compile[...], or a Compute[...] construct.

 

Reckon[expr] performs NameRecognition on the elicitations on-the-face of expr

Substitutions are made with SubstitutionNames, and then the superficial assignment of every Elicitation Form is returned. No further evaluation occurs unless the "assignment" has Head matching one of: {Compile, Reckon, Function, Compute}. These each are reckoned differently:

            Compile[args...]      ...performs the indicated compilation.

            Reckon[args...]        ...interprets "args...".

            Function[body]        ...exhaustively evaluates body.

            Compute[expr]        ...Reckons expr , evaluating every contained Compute[...] subExpression.

 

The above 4 exceptions to Reckon's rule of simply returning Name assignments, means that Reckon can invoke exhaustive program execution, although it defaults to returning the literal Name assignment.

 

In a Reckon[expr]-construct like (1), the consequence of limiting elicitations to those on-the-face of expr, is that Expressions can be symbolically manipulated.  Algebra-processing, mathematical-identity-transformation, linguistic, and other language processing systems use linguistic structured code as input.  SymbolProcessing algorithms must use Compile, Function, or Compute in assignment Heads with particular care.  Compile, Function, and Compute are generally antithetical to algorithms that branch according to identities governing Expression-transformations.

 

By contrast, Function[body][input] installs input through Slot[...]s within body, which then exhausts all recognized ElicitationForms in all subExpressions in body in the creation of the returned Expression.  This is why we say, "A Function body is executed exhaustively".

 

 

 


Definition

 If nam is a Name, then...

 

(6)                    Reckon[Name][nam]

 

...returns each elicitation form and Attribute associated with nam, in order of precedence. 

This is the definition of nam in Grok32`.

 

 


Reckon[String]["input"]

 

(7)                    Reckon[String]["input"]

 

The above elicitation attempts to interpret the String "input" as an Expression.

 

The first step in Reckoning "input", is to apply the CharacterSet's RuleList to the Characters comprising "input".  Each character in a String has an associated CharacterSet.  This step renders an ExpressionBranch structure from "input" without polluting the environment with Name assignments.

 

The next step in the Reckoning of "input" is to evaluate the ExpressionBranch as an Expression.  If (7) fails to interpret "input", informative messages explain the reason(s) for the failure, and the String position where the Reckoning failed is returned.

 

The ReckonString document has detailed specification for the system used to evaluate Strings as Expressions.  See also ExpressionBranch.

 

 


Reckon[Expression[Branch]][exprBranchSequence]

 

If exprBranchSequence is a Sequence of ExpressionBranchs then...

 

(8)                    Reckon[Expression[Branch]][exprBranchSequence]

 

...invokes or assigns each recognized Name or creates NewNames as required by the ordered execution of each ExpressionAtom in "exprBranchSequence" and the environmental facts.

 

 

 


ReckonStream

 

A freshly created StreamObject begins at StreamSlot (position) 0.

 

Each time a StreamObject is Reckoned (read), as in...

 

(9)                    Reckon[strmObj]

 

...where strmObj is a StreamObject, it returns an element from the Stream and increments the  StreamSlot.

 

 


English Definition of "reckon"

 

reckon v.

1. To name in order; to recite; specify.  Obs.

2. To count; now usually, to compute; calculate; as, to reckon the days before Christmas, the size of an audience, one's total indebtedness.

3. To account; consider; regard; repute; as, to reckon him the richest man hereabouts; this business is generally reckoned as prosperous.

4. To count in, as part of a total, one of a class, or the like; to place; to class; also, to sum (up); to evaluate; as, he is not reckoned among the leaders.

5. To conclude, as after an enumerating or balancing of chances; hence, Colloq., to think; suppose; --with an object clause.

            I reckon that for ten thousand dollars you can travel for two years.         Edith Wharton.

6. To  attribute, or assign (a quality, a relationship, etc.); to impute.  Obs.

            Faith was reckoned to Abraham for righteousness.               Rom. iv 9.

--, Intransitive;

1. To make items in order.  Obs.

2. To make an enumeration or computation; to engage in numbering or computing.   Shak.

3. To come to an accounting; to make up accounts; to settle; to examine and strike the balance of debt and credit; to adjust relations of desert or penalty.

            Parfay sayst thou, sometimes he reckon shall.   Chaucer.

4. Now Dial. a To expect; intend.  b To claim; pretend.

5. To place dependence on; to rely; count; --followed by on; as, to reckon on one's coming.

6. To think, suppose; guess; --usually in I reckon, often used parenthetically.  Chiefly Dial.

7. To explain or account for one's conduct. Obs.

Syn. Number, include, estimate.  See CALCULATE.

 

reckon for. To answer for; to pay the account for.

 

reckon with...

   a To settle accounts or claims with; --also figuratively.

            After a long time the lord of those servants cometh, and reckoneth with them.     Matt. xxv. 19.

   b To take into account; as, to reckon with a danger.

                                                           [From Websters1949Unabridged.]

 

 


Grok32`

(c)  2004-2007 by
John Van Wie Bergamini.

All rights reserved.

 

Hosted by www.Geocities.ws

1