BindQE - Bind Intersection to a Value Point

Usage

  value = BindQE ( isct value tagarg ... )
  value = BindQQ ( isct value tagarg ... )
  value = BindEQ ( isct value tagarg ... )
  value = BindEE ( isct value tagarg ... )

Parameters

  value The value bound to the intersection is also the returned value.
  isct An intersection (quoted) to be bound to the value.
  value The point to be bound as the value of the intersection.

Tagged Arguments

  Out::id Write the binding into the area specified by id. This refers to an area previously opened with the Id tag (V4) or option ( Area).
  Weight::delta Adjust the calculated binding weight by plus or minus delta.
  Weight::num Create the binding a binding weight of num.

Description

The BindQE modules performs the same function as the Bind command in the V4 evaluator. It binds the value point to the (quoted) intersection and returns that value point as it's result. This module may be used to save the result of an expensive computation so that future requests do not have to go through all the work.

The variations of this module have to do with the evaluation of the first and second arguments. BindQE does not evaluate the first argument but does the second. BindQQ does not evaluate either argument. BindEQ evaluates the first but not the second, and BindEE evaluates both arguments. BindQE is most often used and is identical to the Bind command of the V4 interpreter.

Examples

  Bind [AverageDaysToPay Cus..]
BindQE( [AverageDaysToPay Cus*] [ExpensiveCalc Cus*] )

This example defines the AverageDaysToPay for any customer. The outer binding (from the V4 evaluator) invokes the Bind module which then binds the AverageDaysToPay for that particular customer to the result of the ExpensiveCalc for that customer. Future evaluations of [AverageDaysToPay] for this particular customer would simple return the previously calculated result. (An alternative way of optimizing this is with the CBind command).

The next example demonstrates the use of BindQE. The need for the BindQE is due to the fact that the nested MakeI (make intersection) would normally be evaluated when it is the intersection itself that needs to be the first argument of the Bind/BindQ.

  MakeI( IntMod:BindQ MakeI( MakeP( [Dim All*] Special::All ) EvalPt* ) 0)

Bits - Perform Various Bit-Level Operations

Usage

  value = Bits ( num tagval ... )
  value = Bits ( bitmap tagval ... )

Parameters

  value The resulting 32/64 bit integer result.
  num The base number (32/64 bit integer)
  tagval One or more tagged arguments.
  bitmap A bitmap implemented as a Binary V4 point type. See also the Column Hex4 option. The only tagged argument type supporting a bitmap is the Nth option.

Tagged Arguments

  All::arg All bits in arg must also be set in num.
  And::arg Logically andarg to num.
  AndC::arg Logical and the one's complement of arg to num.
  Any::arg Returns TRUE if any of the bits in arg are also set in num.
  Else::value Used to return an 'else' result if all prior tests resulted in FALSE or 0. If used it should be the last argument.
  None::arg None of the bits in arg can be set.
  Nth::arg Return Logical:True if the argth bit of num is set. If the first argument is an integer then arg must be between 1 and 64. If the first argument is a bitmap then arg may be 1 through the number of bits in the map. This arg may also contain multiple values. If so then the test succeeds if any of the specified bits are set.
  Num::value Same as the Result tag.
  Or::arg Logically or arg to num.
  Result::value This option can be used chain a series of tests and return a value as soon as a test evaluates to TRUE or non-zero value. See examples below.
  Rotate::arg Rotate bits to the left if arg is positive, to the right if negative. The sign bit is shifted into the low order bits on a left rotate, the low order bit is shifted into the sign bit on a right rotate.
  Shift::arg Shift bits to the left if arg is positive, to the right if negative.
  XOr::arg Logically exclusive-or arg to num.

Tagged Results

  ListOf?? Returns a list of bits set in the first argument. If no bits are set (the first argument is 0) then an empty list is returned.
  Not? Return the one's complement of num.

Description

Bits is a general purpose module for performing bit-wise operations on an integer value. More than one tagged argument can be given with the results being chained left to right.

Examples

  Bits(16 Nth::5) results in Int:1
  Bits(^xf0000000 Rotate::4) results in 15
  Bits(^xf0000000 Rotate::-28) identical to above, results in 15
  Bits(1 Shift::3) results in 8
  Bits(3 And::2) results in Int:2
  Bits(16 Nth::Int:1,2,3) results in Logical:False
  Bits(16 Nth::Int:4,5,6) results in Logical:True
  Bits(Cus.Attr Nth::3 Num::Type:A Nth::8 Num::Type:B Num::Type:C) Tests the third bit of Cus.Attr and if set returns Type:A as the value. If not then tests eighth bit and if set returns Type:B otherwise Type:C
  Bits(1234 All::^N(1,2,3,4)) returns Int:0 (bits 1, 2, 3, and 4 are not all set in 1234)
  Bits(^xf0f listof?) returns (1 2 3 4 9 10 11 12)
  Bits(Int* Nth::3 Result::3rd Nth::5 Result::5th Else::nobits) Returns 3rd or 5th if corresponding bits set, otherwise nobits is returned
  Bits(Int* Nth::3 Result::3rd Nth::5 Result::5th) Returns 3rd or 5th if corresponding bits set, otherwise 0 is returned