This document summarizes logical programming languages and functional programming languages. For logical programming languages, it notes they are declarative languages that implement computation's logic rather than mechanics. While well-suited for representing data structures and complex ideas, they have disadvantages like poor support for state variables and arithmetic. Functional programming languages are based on functions as building blocks. They can lead to fewer bugs due to immutable variables and pure functions, but can also require more time and memory and not be suitable for all types of problems. The document contrasts the two by comparing their bases, aims, applications, and testing difficulties.
2. LOGICAL PROGRAMMING LANGUAGES
All logical programming languages can be generalized into a category of programming languages called
declarative languages.
Has a few advantages :-
Classified as high-level languages as they implement computation’s logic rather than mechanics.
They allow data to be represented both extensionally and intentionally.
Well suited for rapid interpretation of the data structure and the code to implement very complicated ideas.
3. LOGICAL PROGRAMMING LANGUAGES
Disadvantages include:-
There is no suitable method of representing computational concepts that originate in a built-in mechanism of state
variables like it is found in conventional languages.
Initially, due to insufficient investment in complimentary technologies, users were poorly served.
Poor facilities for supporting arithmetic ,etc.
Limited to which types of problems it can solves.
Slow program execution.
4. FUNCTIONAL PROGRAMMING LANGUAGES
Type of programming paradigm in which everything is done with the help of functions and using functions as
its building block.
Has a few advantages :-
Leads to fewer bugs.
Easier to test. Reasons: (i)Outputs same for any given inputs (ii) Pure functions don’t depend on any state apart from the
inputs
Function signatures are more trusted .
Concurrency is more easily kept safe , pure functions are definitionally thread-safe. No chances of race condition
occurrence.
Immutable variables lead to fewer side-effects
5. FUNCTIONAL PROGRAMMING LANGUAGES
Disadvantages include:-
Can be less efficient than others.
They tend to require a large amount of time and memory.
Purely functional languages are not really used in commercial software developments.
At most times, there are problems involving many variables or a lot of sequential activities where it should be best
handled with OOP rather than functional programming languages.
6. DIFFERENCES
Logical Programming languages Functional programming languages
Based on formal logic Based on functions
Programs are constructed by applying and
composing functions
Usually express or represent facts and rules related
to problems within a system of formal logic
These are specially designed for fault diagnosis,
natural language processing, planning, and
machine learning.
These are specially designed to manage and
handle symbolic computation and list processing
applications.
Its main aim is to allow machines to reason
because it is very useful for representing
knowledge
Its main aim is to reduce side effects that are
accomplished by isolating them from the rest of
the software code
It is data-driven, array-oriented, used to express
knowledge, etc.
It reduces code redundancy, improves modularity,
solves complex problems, increases
maintainability, etc.
Testing is comparatively more difficult as
compared to functional programming
Testing is much easier as compared to logical
programming