Home Random Page


CATEGORIES:

BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism






Imperative versus functional languages

 

COBOL, FORTRAN, and their descendants, such as Pascal and C, are known as imperative languages, since they specify as a sequence of explicit commands how the machine is to go about solving the problem at hand; this is not very different from what takes place at the machine level. Other languages are functional, in the sense that programming is done by calling (i.e., invoking) functions or procedures, which are sections of code executed within a program. The best-known language of this type is LISP (List Processing), in which all computation is expressed as an application of a function to one or more “objects.” Since LISP objects may be other functions as well as individual data items (variables, in mathematical terminology) or data structures, a programmer can create functions at the appropriate level of abstraction to solve the problem at hand. This feature has made LISP a popular language for artificial intelligence applications, although it has been somewhat superseded by logic programming languages such as Prolog (Programming in Logic). These are termed nonprocedural, or declarative, languages in the sense that the programmer specifies what goals are to be accomplished but not how specific methods are to be applied to attain those goals. Prolog is based on the concepts of resolution (akin to logical deduction) and unification (similar to pattern matching). Programs in such languages are written as a sequence of goals. A recent extension of logic programming is constraint logic programming, in which pattern matching is replaced by the more general operation of constraint satisfaction. Again, programs are a sequence of goals to be attained, in this case the satisfaction of the specified constraints.

 

 


Date: 2015-01-12; view: 1037


<== previous page | next page ==>
Software engineering | COMPUTERS AND AVIATION
doclecture.net - lectures - 2014-2024 year. Copyright infringement or personal data (0.007 sec.)