DOI: 10.17587/prin.14.232-244
Enumerator-Arguments as a Language tool for Defining Loops
V. N. Markov, D. Sc. (Engineering), Professor, vinitar@yandex.ru,
Kuban State Technological University, Krasnodar, 350000, Krasnodar region, Russian Federation
Corresponding author: Vitaly N. Markov, D. Sc. (Engineering), Professor, Kuban State Technological University, Krasnodar, 350000, Krasnodar Region, Russian Federation, E-mail: vinitar@yandex.ru
Received on February 13, 2023
Accepted on February 27, 2023
The new syntactic construction for defining processing loops of collections and series of values in the form of expressions is proposed as part of the development of new programming languages and the improvement of existing languages. Its essence is to use index enumerators as arguments to operators and collection processing functions. Such enumerator-arguments allow you to express operators and functions for processing a slice/entire collection.
Translational semantics of enumerator-arguments for indexed and referenced collections is given. A number of examples of using enumerator-arguments for comparison with higher-order functions and list comprehension operators are shown. It is concluded that enumerator-arguments surpass second-order functions in conciseness and readability of the source code, and are not inferior to list comprehensions operators.
Further research is aimed at constructing enumerator-arguments of binary trees nodes using a parameter that is expressed as a number. Its binary digits are link ranks and uniquely position a node in the tree.
Keywords: enumerator, iterator, indexator, readability of source code, conciseness of source code, slice of collection, higher-order function, list comprehension
pp. 232–244
For citation:
Markov V. N. Enumerator-Arguments as a Language tool for Defining Loops, Programmnaya ingeneria, 2023, vol. 14, no. 5 pp. 232—244. DOI: 10.17587/prin.14.232-244. (in Russian).
References:
- Knuth D. E. The Art of Computer Programmjng, vol. 1: Fundamental Algorithms, 3rd ed. Addison-Wesley, 1997, 650 p.
- Sebesta R. W. Concepts of Programmjng Languages, 5th ed., Addison-Wesley, 2001, 720 p.
- Pratt T. W., Zelkowitz M. V. Programmjng Languages: Desjgn and Implementation, 4th ed., Pearson, 2000, 672 p.
- Pierce B. C. Types and Programmjng Languages, MIT, 2002, 648 p.
- Field A. J., Harrison P. G. Functional Programmjng, Addison-Wesley, 1988, 616 p.
- Python 3.11.2. Documentation. The Python Language Reference, available at: https://docs.python.org/3/reference/expressions.html (date of access 06.02.2023).
- Ben-Ari M. Understandjng programmjng Languages,Wiley, 1996, 376 p.
- Martin R. C. Clean Code: A Handbook of Agjle Software Craftsmanshjp, Pearson, 2008, 464 p.
- Solter N. A., Kleper S. J. Professjonal C++, Wrox, 2005, 864 p.
- Watt S. M. A Technique for Generic Iteration and Its Optimization. Computer Scjence, 2006, available at: https://www.csd.uwo.ca/~watt/pub/reprints/2006-wgp-jflow.pdf. (date of access 06.02.2023).
- A Gentle Introduction to Haskell, available at: https://www. haskell.org/tutorial/goodies.html (date of access 06.02.2023).
- Sterling L., Shapiro E. The Art of Prolog: Advanced Programmjng Technjques, MIT, 1986, 437 p.
- Visual Prolog. Fundamental Prolog Part 2, available at: https://wiki.visual-prolog.com/index.php?title=Fundamental_Pro-log_Part_2#Functors_and_Predicates (date of access 06.02.2023).
- Dyalog. The tool of thought for software solutions, available at: https://www.dyalog.com/aplx.htm (date of access 06.02.2023).
- Python 3.11.2. Documentation. The Python Standard Library, available at: https://docs.python.org/3/library/stdtypes.html date of access 06.02.2023).
- Markov V. N. Modern logjc programmjng jn Vjsual Prolog 7.5: textbook, SPb, BHV-Peterburg, 2016, 544 p. (in Russian).
- Microsoft.NET. C# documentation. Iterators, available at: https://learn.microsoft.com/ru-ru/dotnet/csharp/iterators (date of access 06.02.2023).
- Microsoft.NET. C# documentation. Using Properties, available at: https://learn.microsoft.com/en-us/dotnet/csharp/program-ming-guide/classes-and-structs/using-properties (date of access 06.02.2023).