Two Basic Functions to Include Letters into M Language ($$eXtract and $$Width)

Kensuke Baba, MD Department of Clinical Research, National Hospital, Saitama


In order to systematically describe the extraction capability, a concept "distance" to defined position employed. The position at the distance from the left edge of the string is called "distance position" which is the contrast concept to the "(character-by-character) counting position" employed by the $EXTRACT function. The distance has dimension but distance position has no size in any sense.

$$X^%(String{:Font},Distance) returns a character which is located at the Distance from the origin of the String, where Font is rate of width of Letter and Type. Font can be defined by %FONT local variable for sub-argumentless system. When character is not present at the Distance (in other words, when the Distance terminated just at the character-character border or exceed the String), that returns null. $$X^%(String{:Font},Dist,dist) returns the string within at the Distance and at the distance from the origin of String which excludes both $$X^%(String{:Font},Dist) and $$X^%(String{:Font},dist) .

$$W^%(String{:Font}) returns the distance between the origin of the String and the terminal of the String. $$W^%(String{Font},Distance) returns $$W($$X(String{:Font},Distance){:Font}). In other words, that returns the width of the character located at the Distance from the origin of the String.

Processes which can be done by the two extrinsic function also can be done by $zposition, $zwidth and/or $extract. However, easiness in use exceeds clearly. For example, the most frequent and simplest request, $e(String,1, $zp(String,x)) can be shortly described by $$X(String,0,x) without duplicative coding of String. The reason why this extrinsic functions makes easier procedure is explained on the view of computer language design.

[FIGURE]

Figure: Schema of $$W^% and $$X^% by an Example when %FONT=1.5