Slot 

Slot is the whole EVALUATED input Expression.
Slot
[] is the whole UNEVALUATED input Expression (or WholeSlot).

Slot[0] specifies an Expression's Head.

Slot[i] specifies  input's ith  argument.

 

Slot[Sequence] (a.k.a. SlotSequence) returns input's argument Sequence (without the Head).

Slot[startI…endI ] uses startI and endI to specify the start and end (respectively) of a SlotSequenceSelect.

 

A generic SlotSpecification (called "slotSpec"), is a SlotPosition, a SlotSequenceSelect or a sequence of either.

 

Slot[Cardinal] returns the length of the input.

More generally…

Slot[slotSpec][Cardinal]

…returns the length of the argument sequence from the input  subExpression specifed by slotSpec.

 

Reckoning a nonexistent Slot[slotSpec] returns unchanged.

In other words, "True[Slot[slotSpec]]" evaluates as True if slotSpec specifies a nonexistent input Slot.

 

Slot[Stream[n]] returns the Cardinal position of Stream[n].

Stream elements are accessed by position with the following SlotStream construction:

Slot[slotSpec][Stream[n]]

 

Slot[Cardinal][Stream[n]]

…returns Noop[] while a Stream[n]'s length is unknown, and returns a Cardinal when it is known.

 

Slot[Pattern[patrn]] returns the SlotSpecification of each subExpression in input matching patrn.

 



See English definition of "slot".


Used without bracketsSlot is assigned to Tally's iterator argument.

Within a Function's body, the unbracketed Slot and the bracketed Slot[] both designate the (whole) input, except Slot designates the evaluated input and Slot[] designates the unevaluated input.


By contrast, bracketed "Slot[…]"-expressions are used to index (and select) an Expression's subExpressions.

An Expression can, in principle, have any degree of depth and complexity.

 

 


input

 

The "Slot" keyword is used to specify subcomponents of an Expression's, or a Function's argument.

 

Slots specify a Function's input, or an Expression's subExpressions.
Functions are normally parameterized with Slots operating implictly on the Function's input.


Outside a FunctionSlot operates on Expressions to explicitly extract SubExpressions in input as follows:


            Slot[…slotSpecs…][input]


…where "…slotSpecs…" is a coded sequence of position indexii called the "SlotSpecification", that specify subExpressions in "input".


In the Slot Elicitations heading this page and thoughout this document, the Expression operated on by a Slot is called the "input".


The "input" may designate the Function's implicit argument, or the explicit rightmost bracketed Expression of a Slot-SubExpression-extractor. 

 

 


Slot syntax, elicitation & Operators

 

Slot has the NamePattern Attribute, which means it has its own, obligatory syntax. (See also Slot's NamePattern discussed in "Name".)

There are three different types of Slot operators, each with their own elicitation pattern

 

In particular, evey SlotSpecification is a sequence of one or more Cardinals or SlotSequences.
SlotSequences are, in the Standard ASCII RuleList, two Cardinal numbers conjoined by an ellipsis.
E.G., "Slot[3, 4…9, 3]".

 

Slot[…] elicitations enforce this syntax of Cardinals and Cardinal-sequence-pairs, (which, together are called a "SlotSpecification"), to specify input subcomponent position.  The enforced syntax does not guarantee that the Slot-expression will elicit a subExpression from input.  All that is guaranteed is that the "SlotSpecification" is correctly formed.

 

 Slot-operators work with the implicit Function input (in the Function "body"), or they operate explicitly in "Slot[slotSpec][input]" constructions.  Slot-operators specify subExpressions in the input either by position or PatternSet membership

 

A subExpression's Slot is its indexed position.  Suppose slotSpec is a SlotSpecification indicating one or more subExpressions in inputSlot-operators have one of three forms:

 

Slot[slotSpec]

…returns a subExpression of input (if it exists).

 

Slot[slotSpec][Cardinal]

…returns the argument length of the subExpression (of input) specified by slotSpec.

 

If ptrnSet is a PatternSet, then

Slot[ptrnSet]

…scans the input returning a list of SlotSpecifications for subExpressions in ptrnSet.

 

 

 

 


SlotSpecification 

 

Functions do not use SubstitutionNames; they use Slot expressions to parameterize the Function body.  The input operated on by a Slot[…] is either explicitly written in the rightmost bracketed argument, or the Slot is within a Function body, and refers to the Function's argument.  Whether a SlotOperator is in a Function or not, Slot's input has the same meaning. 

 

A SlotSpecification is a means of specifying one or more subExpression(s) in the input with an index or an index-sequence.  Here are the rules:

  1. Within a Function, the keyword "Slot" returns the EVALUATED result invoked by input.
  2. "Slot[]" is the SlotSpecification for the whole UNEVALUATED input
  3. A Cardinal index specifies the input's argument counted from left to right.
  4. "Sequence", or "…", specifies the whole argument sequence at any depth in input.
  5. A SlotSequence with the ASCII form, "firstCardinallastCardinal", specifies the sequence of subExpression positions from firstCardinal to lastCardinal.  This lexical device is called the index-sequence-pair.  It specifies subsequences at any depth.
  6. A SlotSpecification is a sequence whose elements are either an index or an index-sequence-pair.
  7. Each successive element in the SlotSpecification sequence signifies a deeper Expression level. 

 

For example, "Slot[2]" elicit the second argument in input

"Slot[2, 0…1]" elicits the head and the first argument, taken from the 2nd argument of input.

 

If "Slot[slotSpec]" elicits a nonexistent subExpression in input, "Slot[slotSpec]" returns unevaluated.  Since Slot has the NamePattern Attribute, it has an enforced syntax.  If "slotSpec" specifies a nonexistent subExpression in input, "Slot[slotSpec]" returns unchanged.  All that is guaranteed is that "slotSpec" could be a specification for some input.





Slot



TallySlot
-constructs map each source element by substituting it into a Sloted iterator which is evaluated sequentially to form the output.


If
source is a List, Set, or String, then "iterator" operates on each element in source in left-to-right sequence in the following:

        Tally[iterator, source]

TallyIncrement constructions interpret Slot, with no argument or brackets, as the current EVALUATED source element. By contrast, each occurance of Slot[] in TallyIncrements is replaced by the current UNEVALUATED source element.
 

In a TallyIncrement's function-body, which we will call "func" in the forms below, "Slot" is a numeric value, with an unambiguous interpretation.


        Tally
[n][func]        


… increments Slot starting with 1, and ending with n substituting this iterating Cardinal in each evaluation of func to generate a Tally-Sequence of func evaluations.

        Tally
[n1, n2][func]


….substitutes (the Cardinal) n1 everywhere "Slot" appears in func, returning the result as the first iteration, and repeats this procedure progressing through each Cardinal value between and including n2. This generates a Tally-Sequence of func evaluations.


"Slot" designates the real-interval values in the following. The construct…


                   Tally[{r1, r2}, d][func]


…substitutes Real values spanning the interval {r1, r2} wherever Slot appears in "func", thereby generating a Sequence of "func" evaluations.


The Slot iterations are formed differently depending on whether d is Real or Cardinal or positive or negative number. For a complete description of {{r1, r2}, d}, see real interval specifications. But in all real interval tallysSlot takes a real-interval value.




SlotString

 
A String can either be simple or an aggregate of simple Strings from several CharacterSets.
This means that decomposition of a non-simple String with Tally or Slot generates simple substring sequences, whereas decomposition of a simple String with Tally or Slot generates individual Characters.
Specifically the following…

            Tally[Slot, "string"]


…generates the sequence, 


            "s", "t", "r", "i", "g"


…if "string" is simple.

On the other hand, if the String has more then one CharacterSet, it is decomposed into simple substrings before it is decomposed into individual Characters. For example,


            Tally[Slot, "string"]


…returns the following sequence of two simple Strings…
 
           "str", "ing"



Slot[]

 

(1)                    Slot[]

 

…returns the containing Function's unevaluated input.  For example, "Slot[][input]" returns "input".



 

 


Head

 

(2)                    Slot[0]

 

…returns the input Head.

 

If the input Expression is a Sequence, "Sequence" is the Head returned by Slot[0].

 

 


SlotSequence

 

(4)                    Slot[Sequence]

 

…returns input's argument Sequence (without the Head).

Where (4) operates directly on input, it returns input's argument Sequence.  E.G.

 

                        Slot[Sequence][hed[arg1, … , argN]]

 

returns…

                        arg1, … , argN

 

When the above is interpreted as a single Expression, (as when it is the input to Slot), its Head is "Sequence".

 

If startI and endI are both Cardinals, then a SlotSequence is elicited as follows:

 

(5)                    Slot[Sequence[startI, endI ]]

 

…or equivalently,

 

(6)                    Slot[startI…endI ]                   *

 

The SlotSequenceSelect can have either form (5) or (6).  This form is also called a Slot Cardinal-sequence-pair.  It specifies the ordered sequence of arguments starting from startI and ending at endI

 

 

*NOTE: The ellipsis in (6) is a shorthand for a Cardinal Sequence in the Standard ASCII RuleList.  It depends upon the appropriate operator assigned to the CharacterSet.  As such, it is a lexical device and not a necessary feature of the Language Specification.

 

 


SlotPosition

 

An Expression's Head has SlotPosition 0.

The first argument of an Expression has SlotPosition 1, the 2nd argument has SlotPosition 2, etc.  If i is a Cardinal, then…

 

(7)                    Slot[i]

 

…designates input's ith argument (if it exists).

 

The sub-Slot is defined by a sequence of Cardinals, "i1, i2,…, iN", which specify a SlotPosition at depth, N, with the following form…

 

(8)                    Slot[i1, i2,…, iN]

 

Each progressive Cardinal in the sequence, "i1, i2,…, iN", specifies a subExpression at a deeper level in the input.  For example, "Slot[ i, j]" specifies the jth part in the ith argument in input.

 

This SlotPositionelicitation, (Slot parameterized by a sequence of Integers), specifies subExpressions in a Function's argument to any depth.

 

 


SlotSpecification

 

The SlotPosition and the SlotSequenceSelect can be combined in sequence for a fully general SlotSpecification

 

If slotSpec matches Cardinal SlotPositions or a "startI…endI", (called a "SlotSequenceSelect"), then a SlotSpecification has the form:

 

(9)                    Slot[…slotSpec…]

 

For example, Slot[1, 2…4], takes the first slot (argument) in input, and then returns the 2nd through the 4th subExpressions of that first slot.  For example,

 

                        Slot[1, 2…4][{{a, b, c, d}, e, f}]

 

…returns…

                        Sequence[b, c, d].

 

 


SlotCardinal

 

 

SlotCardinals measure an Expression's argument sequence length

 

(10)                  Slot[Cardinal]

 

…returns the number of slots in the input

More generally, if slotSpec is a SlotSpecification, then…

 

(11)                  Slot[slotSpec][Cardinal]

 

…returns the argument sequence length of the subExpression in input specifed by slotSpec.

 

 


SlotStream

 

Stream elements can be accessed by their position using Slot[slotSpec].

 

Stream[n] is a StreamObjectStream[n]'s "Slot", or current position, is given by…

 

(12)                  Slot[Stream[n]]

 

…which returns the Cardinal position of Stream[n] (or Stream[Noop] if Stream[n] is at its end).

 

Aside from (12), Slot[…]-constructs operate normally on Stream[n], except that "Stream[n]" has indefinite extent.  This fact has consequence for Slots operating on StreamObjects.

 

If slotSpec is a SlotSpecification, for Stream[n], then its elements may be accessed by position with the construction…

 

(13)                  Slot[slotSpec][Stream[n]]

 

This specifies the position(s) of the desired Stream element(s) in Stream[n].  The first element in the slotSpec specifies the Stream element(s).  Subsequent elements in slotSpec specify slots within the selected element(s).

 

Since a StreamObject has indefinite extent, an attempt to access a Stream beyond its extent returns Stream[Noop].  For any other Type of Expresion, an attempt to specify a nonexistent Slot position returns the unassigned Slot-Expresion.


In a similar vein,

(14)                  Slot[Cardinal][Stream[n]]

…returns Null while a Stream[n]'s extent is unknown. 


When a Stream[n]'s length is known, and its elements are not subject to "editing", then (14) will return Stream[n]'s length.  A
StreamObject presents itself as a fully realized Expression to the extent this can be realized with the information made available over the course of the StreamObject's life.  Slot[…]-Expressions do not access Stream[n] positions; they access accumulated information on Stream[n]. The only exception to this rule are actual Stream reckonings like (13).  Stream[n]'s length is only discovered when Stream[n] reckons the last element, or "Slot[slotSpec][Stream[n]]" uses too large a value for n, and thereby attempts to access beyond the last element.



Slot[Pattern[patrn]]


If ptrnSet is a
PatternSet, then

(15)                  Slot[ptrnSet][input]

…returns a list of SlotSpecifications for subExpressions in input matching ptrnSet.

 


"slot" English definition

 

slot n.

1. A hollow or depression; specif. the hollow running down the middle of the breast.  Obs.

2. An aperture, now esp. one comparatively long and narrow, as a seating for a key or feather, the narrow opening through which passes the connection for the plow of a conduit railway car, or a narrow opening through which a coin can be pushed.

3. A depression in the surface of an armature or stator of an electrical machine into which a portion of the winding is placed.

4. Theatre.  Trap door opening in a stage.  Rare.

5. The track of a deer; hence, any track or trail.

 

slot v.t.

1. To stab in the midbreast.  Obs.

2. To cut a slot in; to cut or shape by means of slotting machine; --sometimes with out or off; as to slot out a keyway.

3. To provide with a slot or slots.

4. To pass through a slot.

5. To follow the slot, or trail, of; to track.

                                                            [From Websters1949Unabridged.]

 


Grok32`

(c) 2004-2008 by
John Van Wie Bergamini



Hosted by www.Geocities.ws

1