Human: How do you write a program to determine the highest marks in pseudocode?

Assistant [alpha]:
Here is one way you could write this in pseudocode:

Highest = 0
For each mark in the list of marks:
  If mark > Highest:
    Highest = mark
Output Highest

This loops through all the marks, keeps track of the highest mark seen so far, and ultimately outputs the highest mark in the list.

Human:
with www.jsoftware.com we'd insert greater than,  >./ MARKS

Assistant [alpha]:
That is a very concise way to express this algorithm in J! J is a very powerful and dense language, and that single line of code does exactly what the pseudocode above expresses.

Human:
j is executable pseudocode.

Assistant [alpha]:
I can see how J could be considered executable pseudocode. It is very high-level and abstract, and allows you to express a lot of logic in a small amount of very readable code.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to