Functional C

Total Page:16

File Type:pdf, Size:1020Kb

Functional C Functional C Pieter Hartel Henk Muller January 3, 1999 i Functional C Pieter Hartel Henk Muller University of Southampton University of Bristol Revision: 6.7 ii To Marijke Pieter To my family and other sources of inspiration Henk Revision: 6.7 c 1995,1996 Pieter Hartel & Henk Muller, all rights reserved. Preface The Computer Science Departments of many universities teach a functional lan- guage as the first programming language. Using a functional language with its high level of abstraction helps to emphasize the principles of programming. Func- tional programming is only one of the paradigms with which a student should be acquainted. Imperative, Concurrent, Object-Oriented, and Logic programming are also important. Depending on the problem to be solved, one of the paradigms will be chosen as the most natural paradigm for that problem. This book is the course material to teach a second paradigm: imperative pro- gramming, using C as the programming language. The book has been written so that it builds on the knowledge that the students have acquired during their first course on functional programming, using SML. The prerequisite of this book is that the principles of programming are already understood; this book does not specifically aim to teach `problem solving' or `programming'. This book aims to: ¡ Familiarise the reader with imperative programming as another way of imple- menting programs. The aim is to preserve the programming style, that is, the programmer thinks functionally while implementing an imperative pro- gram. ¡ Provide understanding of the differences between functional and imperative pro- gramming. Functional programming is a high level activity. The ordering of computations and the allocation of storage are automatic. Imperative pro- gramming, particularly in C, is a low level activity where the programmer controls both the ordering of computations and the allocation of storage. This makes imperative programming more difficult, but it offers the imperative programmer opportunities for optimisations that are not available to the func- tional programmer. ¡ Familiarise the reader with the syntax and semantics of ISO-C, especially the power of the language (at the same time stressing that power can kill). We visit all dark alleys of C, from void * to pointer arithmetic and assignments in expressions. On occasions, we use other languages (like C++ and Pascal) to illustrate concepts of imperative languages that are not present in C. C has been chosen because it is a de facto standard for imperative programming, and because its low level nature nicely contrasts with SML. Those who want to learn, for example, Modula-2 or Ada-95 afterwards should not find many difficulties. iii iv Preface ¡ Reinforce the principles of programming and problem solving. This is facilitated by the use of three different languages (mathematics, a functional language, and an imperative language). The fact that these widely differing languages have common aspects makes the idea that programming principles exist and that they are useful quite natural. ¡ Reinforce the principle of abstraction. Throughout the book we encourage the student to look for more abstract solutions, for example, by viewing the sig- nature of a function as an abstraction of its purpose, by using procedural ab- stractions (in particular higher order functions) early on, and by using data abstraction. ¡ Guide the student from specification and mathematics to implementation and software engineering. In the first chapters the emphasis is on writing correct functions and as we make progress the emphasis gradually shifts to trans- forming correct functions into efficient and reusable functions. Clean inter- faces are of paramount importance, and are sacrificed for better efficiency only as a last resort. Each problem in this book is solved in three steps: ¡ A specification of the problem is made. ¡ An appropriate algorithm is found to deliver solutions that satisfy the speci- fication. ¡ The algorithm is implemented as efficiently as possible. Throughout the book, the emphasis is on this third step. The language of mathematics is used to specify the problems. This includes the basics of set theory and logic. The student should have some familiarity with the calculi of sets, predicate logic, and propositional logic. This material is taught at most universities during a first course on discrete mathematics or formal logic. The appropriate algorithm is given in SML. SML is freely available for a range of platforms (PC's, UNIX work stations, Apple), and is therefore popular as a teach- ing language. As many functional languages are not too different from SML, an appendix gives a brief review of SML for those familiar with any of the other main stream functional languages, such as Miranda, Haskell, Clean, or Scheme. As the target language to implement solutions in an imperative style we have chosen C. The choice to use C and not C++ was a difficult one. Both languages are mainstream languages, and would therefore be suitable as the target language. We have chosen C because it more clearly exposes the low level programming. To illustrate this consider the mechanisms that the languages provide for call by refer- ence. In C, arguments must be explicitly passed as a pointer. The caller must pass the address, the callee must dereference the pointer. This in contrast with the call by reference mechanism of C++ (and Pascal and Modula-2). This explicit call by ref- erence is a didactical asset as it clearly exposes the model behind call by reference, and its dangers (in the form of unwanted aliases). Revision: 6.8 Preface v As this book is intended to be used in a first year course, only few assumptions were made about prior knowledge of the students. Reasoning about the correct- ness of programs requires proof skills, which students might not have acquired at this stage. Therefore we have confined all proofs to specially marked exercises. To distinguish the programming exercises from the exercises requiring a proof, we have marked the latter with an asterisk. We are confident that the book can be used without making a single proof. However we would recommend the students to go through the proofs on a second reading. The answers to one third of the ex- ercises are provided in Appendix A. The student should have an understanding of the basic principles of comput- ing. This would include base 2 arithmetic and the principles of operation of the von Neumann machine. A computer appreciation course would be most appro- priate to cover this material. The book contains examples from other areas of com- puter science, including data bases, computer graphics, the theory of program- ming languages, and computer architecture. These examples can be understood without prior knowledge of these areas. Acknowledgements The help and comments of Hugh Glaser, Andy Gravell, Laura Lafave, Denis Nicole, Peter Sestoft, and the anonymous referees have been important to us. The mate- rial of the book has undergone its first test in Southampton in 1995/1996. The first year Computer Science students of 1995, and in particular Jason Datt and Alex Walker have given us a lot of useful feedback. We have used a number of public domain software tools in the development of the book. The noweb literate programming tools of Norman Ramsey, the rail road diagramming tools from L. Rooijakkers, gpic by Brian Kernighan, TEX, LATEX, New Jersey SML, and the Gnu C compiler were particularly useful. Revision: 6.8 vi Preface Revision: 6.8 c 1995,1996 Pieter Hartel & Henk Muller, all rights reserved. Contents Preface iii 1 Introduction 1 1.1 The functional and the imperative paradigms . 1 1.1.1 The advantage of state . 3 1.1.2 The advantage of pure functions . 3 1.1.3 Idiomatic building blocks in C . 3 1.2 Guide to the book . 4 2 Functions and numbers 7 2.1 A model of computation . 7 2.1.1 A computational model for SML programs . 8 2.1.2 A computational model for C programs . 9 2.1.3 Compiling and executing a C program . 10 2.2 Elementary functions . 10 2.2.1 The header of a C function, types and identifiers . 14 2.2.2 The body of a C function and its behaviour . 15 2.2.3 The execution of a C program . 17 2.2.4 Integers . 18 2.2.5 Logical operators . 19 2.2.6 Defining a type for Booleans, typedef and enum . 20 2.3 Characters, pattern matching, partial functions . 21 2.3.1 Implementing pattern matching in C . 22 2.3.2 Partial functions . 26 2.3.3 Differences and similarities between characters and integers . 27 2.4 Real numbers . 29 2.4.1 Coercions of integers and floating point numbers . 32 2.5 Functions as arguments . 34 2.5.1 Sums . 34 2.5.2 Products . 37 2.5.3 An extended example of higher order functions: bisection . 39 2.6 Summary . 44 2.7 Further exercises . 47 vii viii CONTENTS 3 Loops 51 3.1 A model of the store . 51 3.2 Local variable declarations and assignments . 53 3.3 While loops . 57 3.3.1 Single argument tail recursion . 61 3.3.2 Multiple argument tail recursion . 64 3.3.3 Non-tail recursion: factorial . 68 3.3.4 More on assignments . 73 3.3.5 Breaking out of while-loops . 75 3.4 For loops . 79 3.4.1 Factorial using a for-loop . 83 3.4.2 Folding from the right . 86 3.5 Generalizing loops and control structures . 88 3.5.1 Combining foldl with map: sum of squares . 89 3.5.2 Combining foldl with filter: perfect numbers . 91 3.5.3 Nested for statements . 95 3.6 Summary . 96 3.7 Further exercises . 98 4 Structs and Unions 101 4.1 Structs .
Recommended publications
  • ML Module Mania: a Type-Safe, Separately Compiled, Extensible Interpreter
    ML Module Mania: A Type-Safe, Separately Compiled, Extensible Interpreter The Harvard community has made this article openly available. Please share how this access benefits you. Your story matters Citation Ramsey, Norman. 2005. ML Module Mania: A Type-Safe, Separately Compiled, Extensible Interpreter. Harvard Computer Science Group Technical Report TR-11-05. Citable link http://nrs.harvard.edu/urn-3:HUL.InstRepos:25104737 Terms of Use This article was downloaded from Harvard University’s DASH repository, and is made available under the terms and conditions applicable to Other Posted Material, as set forth at http:// nrs.harvard.edu/urn-3:HUL.InstRepos:dash.current.terms-of- use#LAA ¡¢ £¥¤§¦©¨ © ¥ ! " $# %& !'( *)+ %¨,.-/£102©¨ 3¤4#576¥)+ %&8+9©¨ :1)+ 3';&'( )< %' =?>A@CBEDAFHG7DABJILKM GPORQQSOUT3V N W >BYXZ*[CK\@7]_^\`aKbF!^\K/c@C>ZdX eDf@hgiDf@kjmlnF!`ogpKb@CIh`q[UM W DABsr!@k`ajdtKAu!vwDAIhIkDi^Rx_Z!ILK[h[SI ML Module Mania: A Type-Safe, Separately Compiled, Extensible Interpreter Norman Ramsey Division of Engineering and Applied Sciences Harvard University Abstract An application that uses an embedded interpreter is writ- ten in two languages: Most code is written in the original, The new embedded interpreter Lua-ML combines extensi- host language (e.g., C, C++, or ML), but key parts can be bility and separate compilation without compromising type written in the embedded language. This organization has safety. The interpreter’s types are extended by applying a several benefits: sum constructor to built-in types and to extensions, then • Complex command-line arguments aren’t needed; the tying a recursive knot using a two-level type; the sum con- embedded language can be used on the command line.
    [Show full text]
  • Managing Projects with GNU Make, Third Edition by Robert Mecklenburg
    ManagingProjects with GNU Make Other resources from O’Reilly Related titles Unix in a Nutshell sed and awk Unix Power Tools lex and yacc Essential CVS Learning the bash Shell Version Control with Subversion oreilly.com oreilly.com is more than a complete catalog of O’Reilly books. You’ll also find links to news, events, articles, weblogs, sample chapters, and code examples. oreillynet.com is the essential portal for developers interested in open and emerging technologies, including new platforms, pro- gramming languages, and operating systems. Conferences O’Reilly brings diverse innovators together to nurture the ideas that spark revolutionary industries. We specialize in document- ing the latest tools and systems, translating the innovator’s knowledge into useful skills for those in the trenches. Visit con- ferences.oreilly.com for our upcoming events. Safari Bookshelf (safari.oreilly.com) is the premier online refer- ence library for programmers and IT professionals. Conduct searches across more than 1,000 books. Subscribers can zero in on answers to time-critical questions in a matter of seconds. Read the books on your Bookshelf from cover to cover or sim- ply flip to the page you need. Try it today with a free trial. THIRD EDITION ManagingProjects with GNU Make Robert Mecklenburg Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo Managing Projects with GNU Make, Third Edition by Robert Mecklenburg Copyright © 2005, 1991, 1986 O’Reilly Media, Inc. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use.
    [Show full text]
  • Tierless Web Programming in ML Gabriel Radanne
    Tierless Web programming in ML Gabriel Radanne To cite this version: Gabriel Radanne. Tierless Web programming in ML. Programming Languages [cs.PL]. Université Paris Diderot (Paris 7), 2017. English. tel-01788885 HAL Id: tel-01788885 https://hal.archives-ouvertes.fr/tel-01788885 Submitted on 9 May 2018 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. Distributed under a Creative Commons Attribution - NonCommercial - ShareAlike| 4.0 International License Thèse de doctorat de l’Université Sorbonne Paris Cité Préparée à l’Université Paris Diderot au Laboratoire IRIF Ecole Doctorale 386 — Science Mathématiques De Paris Centre Tierless Web programming in ML par Gabriel Radanne Thèse de Doctorat d’informatique Dirigée par Roberto Di Cosmo et Jérôme Vouillon Thèse soutenue publiquement le 14 Novembre 2017 devant le jury constitué de Manuel Serrano Président du Jury Roberto Di Cosmo Directeur de thèse Jérôme Vouillon Co-Directeur de thèse Koen Claessen Rapporteur Jacques Garrigue Rapporteur Coen De Roover Examinateur Xavier Leroy Examinateur Jeremy Yallop Examinateur This work is licensed under a Creative Commons “Attribution- NonCommercial-ShareAlike 4.0 International” license. Abstract Eliom is a dialect of OCaml for Web programming in which server and client pieces of code can be mixed in the same file using syntactic annotations.
    [Show full text]
  • Transmit Processing in MIMO Wireless Systems
    IEEE 6th CAS Symp. on Emerging Technologies: Mobile and Wireless Comm Shanghai, China, May 31-June 2,2004 Transmit Processing in MIMO Wireless Systems Josef A. Nossek, Michael Joham, and Wolfgang Utschick Institute for Circuit Theory and Signal Processing, Munich University of Technology, 80333 Munich, Germany Phone: +49 (89) 289-28501, Email: [email protected] Abstract-By restricting the receive filter to he scalar, we weighted by a scalar in Section IV. In Section V, we compare derive the optimizations for linear transmit processing from the linear transmit and receive processing. respective joint optimizations of transmit and receive filters. We A popular nonlinear transmit processing scheme is Tom- can identify three filter types similar to receive processing: the nmamit matched filter (TxMF), the transmit zero-forcing filter linson Harashima precoding (THP) originally proposed for (TxZE), and the transmil Menerfilter (TxWF). The TxW has dispersive single inpur single output (SISO) systems in [IO], similar convergence properties as the receive Wiener filter, i.e. [Ill, but can also be applied to MlMO systems [12], [13]. it converges to the matched filter and the zero-forcing Pter for THP is similar to decision feedback equalization (DFE), hut low and high signal to noise ratio, respectively. Additionally, the contrary to DFE, THP feeds back the already transmitted mean square error (MSE) of the TxWF is a lower hound for the MSEs of the TxMF and the TxZF. symbols to reduce the interference caused by these symbols The optimizations for the linear transmit filters are extended at the receivers. Although THP is based on the application of to obtain the respective Tomlinson-Harashimp precoding (THP) nonlinear modulo operators at the receivers and the transmitter, solutions.
    [Show full text]
  • Seaflow Language Reference Manual Rohan Arora, Junyang Jin, Ho Sanlok Lee, Sarah Seidman Ra3091, Jj3132, Hl3436, Ss5311
    Seaflow Language Reference Manual Rohan Arora, Junyang Jin, Ho Sanlok Lee, Sarah Seidman ra3091, jj3132, hl3436, ss5311 1 Introduction 3 2 Lexical Conventions 3 2.1 Comments 3 2.2 Identifiers 3 2.3 Keywords 3 2.4 Literals 3 3 Expressions and Statements 3 3.1 Expressions 4 3.1.1 Primary Expressions 4 3.1.1 Operators 4 3.1.2 Conditional expression 4 3.4 Statements 5 3.4.1 Declaration 5 3.4.2 Immutability 5 3.4.3 Observable re-assignment 5 4 Functions Junyang 6 4.1 Declaration 6 4.2 Scope rules 6 4.3 Higher Order Functions 6 5 Observables 7 5.1 Declaration 7 5.2 Subscription 7 5.3 Methods 7 6 Conversions 9 1 Introduction Seaflow is an imperative language designed to address the asynchronous event conundrum by supporting some of the core principles of ReactiveX and reactive programming natively. Modern applications handle many asynchronous events, but it is difficult to model such applications using programming languages such as Java and JavaScript. One popular solution among the developers is to use ReactiveX implementations in their respective languages to architect event-driven reactive models. However, since Java and JavaScript are not designed for reactive programming, it leads to complex implementations where multiple programming styles are mixed-used. Our goals include: 1. All data types are immutable, with the exception being observables, no pointers 2. The creation of an observable should be simple 3. Natively support core principles in the ReactiveX specification 2 Lexical Conventions 2.1 Comments We use the characters /* to introduce a comment, which terminates with the characters */.
    [Show full text]
  • Think Python
    Think Python How to Think Like a Computer Scientist 2nd Edition, Version 2.2.18 Think Python How to Think Like a Computer Scientist 2nd Edition, Version 2.2.18 Allen Downey Green Tea Press Needham, Massachusetts Copyright © 2015 Allen Downey. Green Tea Press 9 Washburn Ave Needham MA 02492 Permission is granted to copy, distribute, and/or modify this document under the terms of the Creative Commons Attribution-NonCommercial 3.0 Unported License, which is available at http: //creativecommons.org/licenses/by-nc/3.0/. The original form of this book is LATEX source code. Compiling this LATEX source has the effect of gen- erating a device-independent representation of a textbook, which can be converted to other formats and printed. http://www.thinkpython2.com The LATEX source for this book is available from Preface The strange history of this book In January 1999 I was preparing to teach an introductory programming class in Java. I had taught it three times and I was getting frustrated. The failure rate in the class was too high and, even for students who succeeded, the overall level of achievement was too low. One of the problems I saw was the books. They were too big, with too much unnecessary detail about Java, and not enough high-level guidance about how to program. And they all suffered from the trap door effect: they would start out easy, proceed gradually, and then somewhere around Chapter 5 the bottom would fall out. The students would get too much new material, too fast, and I would spend the rest of the semester picking up the pieces.
    [Show full text]
  • Download the Basketballplayer.Ngql Fle Here
    Nebula Graph Database Manual v1.2.1 Min Wu, Amber Zhang, XiaoDan Huang 2021 Vesoft Inc. Table of contents Table of contents 1. Overview 4 1.1 About This Manual 4 1.2 Welcome to Nebula Graph 1.2.1 Documentation 5 1.3 Concepts 10 1.4 Quick Start 18 1.5 Design and Architecture 32 2. Query Language 43 2.1 Reader 43 2.2 Data Types 44 2.3 Functions and Operators 47 2.4 Language Structure 62 2.5 Statement Syntax 76 3. Build Develop and Administration 128 3.1 Build 128 3.2 Installation 134 3.3 Configuration 141 3.4 Account Management Statement 161 3.5 Batch Data Management 173 3.6 Monitoring and Statistics 192 3.7 Development and API 199 4. Data Migration 200 4.1 Nebula Exchange 200 5. Nebula Graph Studio 224 5.1 Change Log 224 5.2 About Nebula Graph Studio 228 5.3 Deploy and connect 232 5.4 Quick start 237 5.5 Operation guide 248 6. Contributions 272 6.1 Contribute to Documentation 272 6.2 Cpp Coding Style 273 6.3 How to Contribute 274 6.4 Pull Request and Commit Message Guidelines 277 7. Appendix 278 7.1 Comparison Between Cypher and nGQL 278 - 2/304 - 2021 Vesoft Inc. Table of contents 7.2 Comparison Between Gremlin and nGQL 283 7.3 Comparison Between SQL and nGQL 298 7.4 Vertex Identifier and Partition 303 - 3/304 - 2021 Vesoft Inc. 1. Overview 1. Overview 1.1 About This Manual This is the Nebula Graph User Manual.
    [Show full text]
  • Natural Domain of a Function • Range Calculations Table of Contents (Continued)
    ~ THE UNIVERSITY OF AKRON w Mathematics and Computer Science calculus Article: Functions menu Directory • Table of Contents • Begin tutorial on Functions • Index Copyright c 1995{1998 D. P. Story Last Revision Date: 11/6/1998 Functions Table of Contents 1. Introduction 2. The Concept of a Function 2.1. Constructing Functions • The Use of Algebraic Expressions • Piecewise Definitions • Descriptive or Conceptual Methods 2.2. Evaluation Issues • Numerical Evaluation • Symbolic Evalulation 2.3. What's in a Name • The \Standard" Way • Functions Named by the Depen- dent Variable • Descriptive Naming • Famous Functions 2.4. Models for Functions • A Function as a Mapping • Venn Diagram of a Function • A Function as a Black Box 2.5. Calculating the Domain and Range • The Natural Domain of a Function • Range Calculations Table of Contents (continued) 2.6. Recognizing Functions • Interpreting the Terminology • The Vertical Line Test 3. Graphing: First Principles 4. Methods of Combining Functions 4.1. The Algebra of Functions 4.2. The Composition of Functions 4.3. Shifting and Rescaling • Horizontal Shifting • Vertical Shifting • Rescaling 5. Classification of Functions • Polynomial Functions • Rational Functions • Algebraic Functions 1. Introduction In the world of Mathematics one of the most common creatures en- countered is the function. It is important to understand the idea of a function if you want to gain a thorough understanding of Calculus. Science concerns itself with the discovery of physical or scientific truth. In a portion of these investigations, researchers (or engineers) attempt to discern relationships between physical quantities of interest. There are many ways of interpreting the meaning of the word \relation- ships," but in Calculus we are most often concerned with functional relationships.
    [Show full text]
  • JNI – C++ Integration Made Easy
    JNI – C++ integration made easy Evgeniy Gabrilovich Lev Finkelstein [email protected] [email protected] Abstract The Java Native Interface (JNI) [1] provides interoperation between Java code running on a Java Virtual Machine and code written in other programming languages (e.g., C++ or assembly). The JNI is useful when existing libraries need to be integrated into Java code, or when portions of the code are implemented in other languages for improved performance. The Java Native Interface is extremely flexible, allowing Java methods to invoke native methods and vice versa, as well as allowing native functions to manipulate Java objects. However, this flexibility comes at the expense of extra effort for the native language programmer, who has to explicitly specify how to connect to various Java objects (and later to disconnect from them, to avoid resource leak). We suggest a template-based framework that relieves the C++ programmer from most of this burden. In particular, the proposed technique provides automatic selection of the right functions to access Java objects based on their types, automatic release of previously acquired resources when they are no longer necessary, and overall simpler interface through grouping of auxiliary functions. Introduction The Java Native Interface1 is a powerful framework for seamless integration between Java and other programming languages (called “native languages” in the JNI terminology). A common case of using the JNI is when a system architect wants to benefit from both worlds, implementing communication protocols in Java and computationally expensive algorithmic parts in C++ (the latter are usually compiled into a dynamic library, which is then invoked from the Java code).
    [Show full text]
  • Difference Between Method Declaration and Signature
    Difference Between Method Declaration And Signature Asiatic and relaxed Dillon still terms his tacheometry namely. Is Tom dirt or hierarchal after Zyrian Nelson hasting so variously? Heterozygous Henrique instals terribly. Chapter 15 Functions. How junior you identify a function? There play an important difference between schedule two forms of code block seeing the. Subroutines in C and Java are always expressed as functions methods which may. Only one params keyword is permitted in a method declaration. Complex constant and so, where you declare checked exception parameters which case, it prompts the method declaration group the habit of control passes the positional. Overview of methods method parameters and method return values. A whole object has the cash public attributes and methods. Defining Methods. A constant only be unanimous a type explicitly by doing constant declaration or. As a stop rule using prototypes is the preferred method as it. C endif Class HelloJNI Method sayHello Signature V JNIEXPORT. Method signature It consists of the method name just a parameter list window of. As I breathe in the difference between static and dynamic binding static methods are. Most electronic signature solutions in the United States fall from this broad. DEPRECATED Method declarations with type constraints and per source filter. Methods and Method Declaration in Java dummies. Class Methods Apex Developer Guide Salesforce Developers. Using function signatures to remove a library method Function signatures are known important snapshot of searching for library functions The F libraries. Many different kinds of parameters with rather subtle semantic differences. For addition as real numbers the distinction is somewhat moot because is.
    [Show full text]
  • False Dilemma Wikipedia Contents
    False dilemma Wikipedia Contents 1 False dilemma 1 1.1 Examples ............................................... 1 1.1.1 Morton's fork ......................................... 1 1.1.2 False choice .......................................... 2 1.1.3 Black-and-white thinking ................................... 2 1.2 See also ................................................ 2 1.3 References ............................................... 3 1.4 External links ............................................. 3 2 Affirmative action 4 2.1 Origins ................................................. 4 2.2 Women ................................................ 4 2.3 Quotas ................................................. 5 2.4 National approaches .......................................... 5 2.4.1 Africa ............................................ 5 2.4.2 Asia .............................................. 7 2.4.3 Europe ............................................ 8 2.4.4 North America ........................................ 10 2.4.5 Oceania ............................................ 11 2.4.6 South America ........................................ 11 2.5 International organizations ...................................... 11 2.5.1 United Nations ........................................ 12 2.6 Support ................................................ 12 2.6.1 Polls .............................................. 12 2.7 Criticism ............................................... 12 2.7.1 Mismatching ......................................... 13 2.8 See also
    [Show full text]
  • Three Methods of Finding Remainder on the Operation of Modular
    Zin Mar Win, Khin Mar Cho; International Journal of Advance Research and Development (Volume 5, Issue 5) Available online at: www.ijarnd.com Three methods of finding remainder on the operation of modular exponentiation by using calculator 1Zin Mar Win, 2Khin Mar Cho 1University of Computer Studies, Myitkyina, Myanmar 2University of Computer Studies, Pyay, Myanmar ABSTRACT The primary purpose of this paper is that the contents of the paper were to become a learning aid for the learners. Learning aids enhance one's learning abilities and help to increase one's learning potential. They may include books, diagram, computer, recordings, notes, strategies, or any other appropriate items. In this paper we would review the types of modulo operations and represent the knowledge which we have been known with the easiest ways. The modulo operation is finding of the remainder when dividing. The modulus operator abbreviated “mod” or “%” in many programming languages is useful in a variety of circumstances. It is commonly used to take a randomly generated number and reduce that number to a random number on a smaller range, and it can also quickly tell us if one number is a factor of another. If we wanted to know if a number was odd or even, we could use modulus to quickly tell us by asking for the remainder of the number when divided by 2. Modular exponentiation is a type of exponentiation performed over a modulus. The operation of modular exponentiation calculates the remainder c when an integer b rose to the eth power, bᵉ, is divided by a positive integer m such as c = be mod m [1].
    [Show full text]