Topic: Calculating rows (1 of 23), Read 47 times
Conf: VEDIT Macro Language Support
From: Fritz Heberlein
Date: Monday, March 31, 2003 03:37 PM

Sorry for my second intruding in the calmness of this forum in a single day:

I have written a simple macro to calculate integers in a table row by row:

// linecalc.vdm
// Fritz Heberlein Date: 31.03.2003 Time: 22:36:50
// Calcutates values in rows of tables
// see also: addcol.vdm by Scott Labmert

#1 = #2 = 0
Goto_Pos(Block_End)
#8=CP()
Goto_Pos(Block_Begin)
while(Cur_Pos<=#8){
Begin_Of_Line()
repeat(ALL){#1=Search_Block("|d",BOL_Pos,EOL_Pos,ERRBREAK)
#1=numeval(ADVANCE)
#2+=#1 }
instext(" ")
(num_ins(#2,NOCR)
#1=0
#2=0
Line()
}
break


It works like expected as long as I have "simple" tables of the format

1 2 3
4 4 4


But if i add TeX-style cell delimiters

1 & 2 & 3
4 & 4 & 4

all results are "0".

Any explanation?

Fritz

 


Topic: Calculating rows (2 of 23), Read 41 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Tuesday, April 01, 2003 01:31 AM

Fritz:

On 3/31/2003 3:37:39 PM, you wrote:
>Sorry for my second intruding in the calmness of this forum
>in a single day:

;-) Yes, very quiet here...

>I have written a simple macro to calculate integers in a
>table row by row:
>...
>It works like expected as long as I have "simple" tables of
>the format
>
>1 2 3
>4 4 4
>
>But if i add TeX-style cell delimiters
>
>1 & 2 & 3
>4 & 4 & 4
>
>all results are "0".


The results in your example are "0" and "4".
The "&" is not only a TeX delimiter but also a numerical operator in VEDIT (See Macro language manual p.73).

And you are using Num_Eval() without the SUPPRESS option.
So Num_Eval evaluates the whole expression: a bitwise AND operation: e.g. 1&2&3.
That is in binary syntax:
0001
0010
0011
-----
0000 (AND)

If you use Num_Eval(SUPPRESS+ADVANCE) it works as expected.

BTW: Num_Eval() without SUPPRESS seems to be very aggressive in trying to evaluate. More aggressive than in earlier versions. Take care!


Christian

 


Topic: Re: Calculating rows (3 of 23), Read 38 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Tuesday, April 01, 2003 09:20 AM

At 01:31 AM 4/1/2003, you wrote:
>And you are using Num_Eval() without the SUPPRESS option.
>...
>BTW: Num_Eval() without SUPPRESS seems to be very aggressive in trying to evaluate. More aggressive than in earlier versions. Take care!

I have been thinking of changing Num_Eval(), without options, to work the same as with the SUPPRESS option. To evaluate expressions, you would then need a new option Num_Eval(EXTRA). Please give me feedback on that; obviously all libraries of VEDIT macros would need to be checked.

Sincerely,


Ted.
-------------------------------------------------------------------------
Ted Green (ted@...) Greenview Data, Inc.
Web: http://www.... PO Box 1586, Ann Arbor, MI 48106
Tel: (734) 996-1300 Fax: (734) 996-1308 VEDIT - Text/Data/Binary Editor

 


Topic: Re: Calculating rows (5 of 23), Read 38 times
Conf: VEDIT Macro Language Support
From: Fritz Heberlein
Date: Tuesday, April 01, 2003 11:10 AM

>I have been thinking of
>changing Num_Eval(), without
>options, to work the same as
>with the SUPPRESS option. To
>evaluate expressions, you
>would then need a new option
>Num_Eval(EXTRA). Please give
>me feedback on that;

As for me, the present state is perfect. My problem was only caused by my ignorance of "&" being a numeric operator.


> obviously all libraries of VEDIT macros
>would need to be checked.

Which seems to be a strong argument against such a change.

Thanks to both of you.

Fritz

 


Topic: Re: Calculating rows (6 of 23), Read 39 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Tuesday, April 01, 2003 11:31 AM

Ted:

On Tue, 1 Apr 2003 09:22:02 -0500, you wrote

>I have been thinking of changing Num_Eval(), without
>options, to work the same as with the SUPPRESS option.
>To evaluate expressions, you would then need a
>new option Num_Eval(EXTRA).
>Please give me feedback on that;

The switched options would be much more intuitive!

But that is a real significant modification.
Unchanged macros may produce nonsense without being obvious.

Personally I would be able to check/modify all my macros.
And I would prefer this change.

But generally... I'm not sure.

It's hard to say how many VEDIT users are writing macros by themself.
The amount of posters here may not representative for that?!


Christian

 


Topic: Re: Calculating rows (7 of 23), Read 39 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Tuesday, April 01, 2003 12:51 PM

At 11:32 AM 4/1/2003, you wrote:
>>I have been thinking of changing Num_Eval(), without
>>options, to work the same as with the SUPPRESS option.
>>To evaluate expressions, you would then need a
>>new option Num_Eval(EXTRA).
>>Please give me feedback on that;
>
>The switched options would be much more intuitive!
>
>But that is a real significant modification.
>Unchanged macros may produce nonsense without being obvious.

You and Fritz are correct; this change would cause problems.

A better solution would be to replace the Num_Eval() command with a new,
more intuitive command which acts like Num_Eval(SUPPRESS). We would then suggest everyone switch to the new command, but we would leave the old Num_Eval() command in VEDIT, but no longer document it. That way, old macros will still work, but we will have a better command.

So please give me suggestions for the name of the new Num_Eval() command.

Ted.

 


Topic: Re: Calculating rows (8 of 23), Read 41 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Tuesday, April 01, 2003 02:18 PM

On Tue, 1 Apr 2003 12:53:54 -0500, you wrote:

>You and Fritz are correct; this change would cause problems.
>
>A better solution would be to replace the Num_Eval() command with a new,
>more intuitive command which acts like Num_Eval(SUPPRESS).
>We would then suggest everyone switch to the new command,
>but we would leave the old Num_Eval() command in VEDIT,
>but no longer document it.
>That way, old macros will still work, but we will have a better command.
>
>So please give me suggestions for the name of the new Num_Eval()
command.

Uuuh, I think you too has thought about a name in the last hour...
Not easy! Num_Eval() is a real good name and unfortunately there are
several related commands (Num_Eval_Reg etc.), which should be fitting
to the new name also.
So a *completely* different name like Num_Get() or Num_Read() wouldn't
be good and not consistent, IMHO.


What about
Num_Eval_Text() like "Evaluate number from text"

And I would still document the old Num_Eval(), with a short hint about
the reason for the new one.
Otherwise users may ask (I would do it ;-) : "Why did you implement
such a long command name and not Num_Eval()?" ...
And so it's easier to understand "old" macros.


Christian

 


Topic: Re: Calculating rows (9 of 23), Read 41 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Tuesday, April 01, 2003 02:40 PM

Aargl!

Then Num_Eval_Reg(r,SUPPRESS) must be changed also...

That is getting more complicated than planned. :-|

Perhaps it's better to stop here?


Christian

 


Topic: Re: Calculating rows (10 of 23), Read 44 times
Conf: VEDIT Macro Language Support
From: Fritz Heberlein
Date: Tuesday, April 01, 2003 04:41 PM

>What about
>Num_Eval_Text() like "Evaluate number
>from text"


>What about
> Num_Eval_Text() like "Evaluate number from text"

Well Christian,

you certainly know that I never would dare to contradict you as regards Vedit
macro matters, but here we are facing a linguistic question (caution: it's
getting a bit philosophic now :)).

Vedit's macro commands are either absolute names (e.g. "Break") or relational ones. The
latter are, as far as I can see, mostly (even if not with 100% consistency)
constructed according to the "operand / operator" or "argument / predicate" principle:

File_Close()
File_Attrib()
Reg_Print()
Reg_Copy

Case the operator / predicate has a second argument or a modifier it is placed to the
right:

reg_copy_block (second argument)
file_open_read (modifier)

To have command names structured according to a consistent pattern is an
important mnemotechnic support. Your suggestion does not conform to any of
the above mentioned structures :(

Therefore, what we need is a synonym for "evaluate". My Oxford Dictionary suggests
"assess". What about "num_assess"? Or is that too "british" for
american ears?

Cheers,

Fritz

 


Topic: Re: Calculating rows (11 of 23), Read 44 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Tuesday, April 01, 2003 04:10 PM

At 03:50 PM 4/1/2003, you wrote:
>>What about
>> Num_Eval_Text() like "Evaluate number from text"

I'm not keen about that; it is too long. I would prefer to "bury" Num_Eval().

Perhaps Num_Read() or Num_Get().

>you certainly know that I never would dare to contradict you as regards Vedit
>macro matters, but here we are facing a linguistic question (caution: it's
>getting a bit philosophic now :)).

Philosophy? This is getting scary. ;-)

>Therefore, what we is a synonym for "evaluate". My Oxford Dictionary suggests
>"assess". What about "num_assess"? Or is that too "british" for
>american ears?

"Assess" means "What is your opinion". So no. I also don't want any "ass" in the macro language. :-)

Ted.

 


Topic: Re: Calculating rows (13 of 23), Read 41 times
Conf: VEDIT Macro Language Support
From: Fritz Heberlein
Date: Tuesday, April 01, 2003 04:49 PM

>"Assess" means "What is your
>opinion". So no. I also don't
>want any "ass" in the macro
>language. :-)

Hihi,

shame on those Oxford people:

"assess: calculate or estimate the price or value of"

When will you finally agree on a common language :) ?

Fritz

 


Topic: Re: Calculating rows (12 of 23), Read 44 times
Conf: VEDIT Macro Language Support
From: Fritz Heberlein
Date: Tuesday, April 01, 2003 04:36 PM

>constructed according to the "operand /
> operator" or "predicate / argument" principle:

Sorry - it should read: argument / predicate principle !

Fritz


--
Dr. Friedrich Heberlein, Akad. Direktor
Seminar für Klassische Philologie, KU Eichstaett-Ingolstadt
Universitaetsallee 1
D-85071 Eichstaett / Bayern

 


Topic: Re: Calculating rows (14 of 23), Read 42 times
Conf: VEDIT Macro Language Support
From: Ian Binnie
Date: Tuesday, April 01, 2003 09:59 PM

Just to respond to some of the issues raised in this exchange:-

1. I am opposed to syntax changes which are not backwards compatible (unless absolutely necessary). Doesn't Mr Gates do this to us enough, without Vedit adding to the confusion.

2. There are a lot of macro writers - but I suspect that a lot are special purpose, not of general interest. Our macros still need to be maintained.

 


Topic: Re: Calculating rows (15 of 23), Read 41 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Tuesday, April 01, 2003 11:33 PM

At 09:59 PM 4/1/2003, you wrote:
>1. I am opposed to syntax changes which are not backwards compatible (unless absolutely necessary). Doesn't Mr Gates do this to us enough, without Vedit adding to the confusion.

That is why I am considering a "new" command instead of changing the old command. I would keep the old Num_Eval() command for a long time, but would no longer document it. There are other such commands in VEDIT, especially very old config parameters. This way old macros will continue to work without modifications.

Thank you all for your feedback.

Ted.

 


Topic: AW: Calculating rows (16 of 23), Read 41 times
Conf: VEDIT Macro Language Support
From: Michael Baas
Date: Wednesday, April 02, 2003 01:33 AM

I really liked Fritz's linguistic statements, although I do not share
the conclusion. Wouldn't it be more in the linguistic pattern to have a
command like "Text_Eval" because we have a text and want to evaluate it.
(Or "Expr_Eval", 'cause it evaluates an expression)

Cheers

Michael

 


Topic: AW: Calculating rows (17 of 23), Read 41 times
Conf: VEDIT Macro Language Support
From: Rich Hureau
Date: Wednesday, April 02, 2003 08:05 AM

Num_Get() sounds pretty good to me.

 


Topic: Re: Calculating rows (18 of 23), Read 41 times
Conf: VEDIT Macro Language Support
From: Deleted User
Date: Wednesday, April 02, 2003 10:16 AM

Fritz:

You wrote against Num_Eval_Text():

>Vedit's macro commands are either absolute names (e.g. "Break") or
relational ones. The
>latter are, as far as I can see, mostly (even if not with 100%
consistency)
>constructed according to the "operand / operator" or "predicate /
argument"
>principle:
>
>File_Close()
>File_Attrib()
>Reg_Print()
>Reg_Copy
>
>Case the operator / predicate as a second argument or a modifier it is
placed to the
>right:
>
>reg_copy_block (second argument)
>file_open_read (modifier)


I'm just a simple minded programmer, you know! Not a linguist(sp?).
;-)

Can you please explain how the existing Num_Eval_Reg() fits into that
scheme? Or is that one of the exceptions?

(No kidding. I really want to know if there is a linguistic difference
between Num_Eval_Reg() and Num_Eval_Text().)


BTW: I agree it's not a perfect command name. But that's another
story.


Christian

 


Topic: Re: Calculating rows (19 of 23), Read 42 times
Conf: VEDIT Macro Language Support
From: Fritz Heberlein
Date: Wednesday, April 02, 2003 11:23 AM

>(No kidding. I really want to
>know if there is a linguistic
>difference
>between Num_Eval_Reg() and
>Num_Eval_Text().)

Christian:

(this is getting *very* OT!)

From a linguistic viewpoint there is a clear difference.

Let me begin by mentioning that a programing language, even if being a quite
reduced language (it has only commands and lacks assertions and
questions), it shares with a natural language a crucial feature, viz.
the distinction between the uttered and the presupposed parts of a
sentence.

Every command has certain presuppositions, e.g. that the addressee is
able to perform the command (you cannot command a giant to `shrink'),
and that the uttered part is confined to salient information, since
we don't need / want to say what we and the addressee presuppose (you
wont say, e.g., "look at the plain with your eyes")


Now,

* Num_eval() tells Vedit "evaluate Number" and presupposes (besides
Vedit's being able to evaluate numbers :)) "that one at cursor
position": we get a simple argument - predicate structure

* Num_eval_register is a special case: the normal presupposition "at
cursor position" is cancelled. The cancellation has to be made
explicit by additional information, i.e. "_register" is a modifier
(or specifier) of "NUM", and we get a structure "complex argument
[i.e. Head + modifier] + predicate"

* It should be clear now, that "Num_Eval_Text" is somewhat
tautological, since "_Text" turns into a part of the utterance what we
presuppose anyway. In syntactical terms we have an apposition-like
structure of the type "i had lunch yesterday with the Pope, Mr.
Woityla".

OK, end of the excursus - I'm afraid Ted will exclude me from the
forum.

Fritz

 


Topic: Re: Calculating rows (20 of 23), Read 38 times
Conf: VEDIT Macro Language Support
From: Deleted User
Date: Wednesday, April 02, 2003 12:31 PM

Fritz:

thank you for the
>(this is getting *very* OT!)
linguistic excursus!

Although it's really interesting I think I have to read it twice, or
even more times, to understand.

And to be honest: I'll better remain a programmer. ;-)

>OK, end of the excursus - I'm afraid Ted will exclude me from the
>forum.

Why should he do that? It's VEDIT related - somehow... ;-)

Christian

 


Topic: Re: Calculating rows (21 of 23), Read 38 times
Conf: VEDIT Macro Language Support
From: Fritz Heberlein
Date: Wednesday, April 02, 2003 12:36 PM

> And to be honest: I'll better remain a programmer. ;-)
>
I hope so! Who else will answer my naive questions? ;)

Fritz

 


Topic: Re: Calculating rows (22 of 23), Read 39 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Wednesday, April 02, 2003 04:01 PM

At 12:32 PM 4/2/2003, you wrote:

>thank you for the
>>(this is getting *very* OT!) linguistic excursus!

Your (Fritz and Christian) discussion is very entertaining. Although Tom and I do spend time discussing the names for new commands and try to find logical, intuitive and consistent names, we don't get all philosophical over it.

I know you two are very enthusiastic about VEDIT, but now you are scaring me. :-)

Right now, I am inclined to use Num_Get().

Cheers,

Ted.



Chris
-----------------------------------------------------------------------------
Chris Stachnik (chris@...) Greenview Data, Inc.
Web: http://www.... PO Box 1586, Ann Arbor, MI 48106
Tel: (734) 996-1300 * Fax: (734) 996-1308 VEDIT - Text/Data/Binary Editor

 


Topic: Re: Calculating rows (4 of 23), Read 40 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Tuesday, April 01, 2003 09:21 AM

At 04:29 AM 4/1/2003, you wrote:
>Hmmm - I have to admit that not all examples on p.73 are accessible to my "Grundrechnungsarten" addicted mind: 14 % 4 = 2: ok; but 14 & 7 = 6 ? How blessed must have been the times when everything could be done on an abacus ...

VEDIT exactly follows the "C" language numeric expressions.

Ted.

 


Topic: Calculating rows (23 of 23), Read 6 times
Conf: VEDIT Macro Language Support
From: Peter Rejto
Date: Friday, June 25, 2010 06:17 PM

On 3/31/2003 3:37:39 PM, Fritz Heberlein wrote:

>I have written a simple macro
>to calculate integers in a
>table row by row:
>
>// linecalc.vdm
>// Fritz Heberlein Date:
>31.03.2003 Time: 22:36:50
>// Calcutates values in rows
>of tables
>// see also: addcol.vdm by
>Scott Labmert
>Fritz

Fritz,

I just came across this message of yours.

I wonder what is the connection between your stuff and Scott,s addcol.vdm macro.


Incidentally, what has happened to the & issue ?


-peter