functional

Predicates vs Functions

People from other languages often get a little confused with these predicate things, especially as their syntax looks similar to functions in other languages. In this post we contrast predicates and functions and demonstrate the advantage of using predicates over functions.

Prolog Partial Predicates

Did you know you can call partial predicates with arguments added later on? This is how many of the higher order predicates like `maplist` work. But you can take advantage of this too! Let's take a look at `call`.

Functional Prolog: Map, Filter and Reduce

Prolog programs have both logical and procedural meanings. In this post we'll take a look at procedural ideas more commonly associated with functional programming than Prolog, namely: map, filter and reduce (foldl and foldr). We'll code them and then query them.

Guido was right, there should be no lambda in Python.

Python has support for lambda functions, Haskell is built upon lambda calculus. The two are not the same and this is the reason why lambda should have been removed in Python3. This post examines the differences, reviews the use in Python, and offers a more pythonic, honest syntax.

Python Partial: Code Your Intention

Of all the functional programming inspired features in Python, partial application must be the best kept secret that you really need to know. Partial application lets you create highly abstract functions and make them more specific for use, pass a function arguments without calling it yet, and so much more.

Functional Iteration: Better than Pythonic

Make use of functional programming techniques to improve your iteration in Python. By abstracting the function from the iteration you’ll have greater code reuse, easier parallelisation, and lower memory usage.