In Functional Programming, what is a functor?

The word “functor” comes from category theory, which is a very general, very abstract branch of mathematics. It has been borrowed by designers of functional languages in at least two different ways. In the ML family of languages, a functor is a module that takes one or more other modules as a parameter. It’s considered … Read more

What is the difference between procedural programming and functional programming? [closed]

A functional language (ideally) allows you to write a mathematical function, i.e. a function that takes n arguments and returns a value. If the program is executed, this function is logically evaluated as needed.1 A procedural language, on the other hand, performs a series of sequential steps. (There’s a way of transforming sequential logic into … Read more

How can you do anything useful without mutable state?

Or if you play a video game, there are tons of state variables, beginning with the positions of all the characters, who tend to move around constantly. How can you possibly do anything useful without keeping track of changing values? If you’re interested, here’s a series of articles which describe game programming with Erlang. You … Read more

What is referential transparency?

The term “referential transparency” comes from analytical philosophy, the branch of philosophy that analyzes natural language constructs, statements and arguments based on the methods of logic and mathematics. In other words, it is the closest subject outside computer science to what we call programming language semantics. The philosopher Willard Quine was responsible for initiating the … Read more

What is a Y-combinator? [closed]

A Y-combinator is a “functional” (a function that operates on other functions) that enables recursion, when you can’t refer to the function from within itself. In computer-science theory, it generalizes recursion, abstracting its implementation, and thereby separating it from the actual work of the function in question. The benefit of not needing a compile-time name … Read more

What is a ‘Closure’?

Variable scope When you declare a local variable, that variable has a scope. Generally, local variables exist only within the block or function in which you declare them. function() { var a = 1; console.log(a); // works } console.log(a); // fails If I try to access a local variable, most languages will look for it … Read more

How can a time function exist in functional programming?

Yes and no. Different functional programming languages solve them differently. In Haskell (a very pure one) all this stuff has to happen in something called the I/O Monad – see here. You can think of it as getting another input (and output) into your function (the world-state) or easier as a place where “impureness” like … Read more

What is (functional) reactive programming?

If you want to get a feel for FRP, you could start with the old Fran tutorial from 1998, which has animated illustrations. For papers, start with Functional Reactive Animation and then follow up on links on the publications link on my home page and the FRP link on the Haskell wiki. Personally, I like … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)