Are there problems that cannot be written using tail recursion?

Yes, actually you can take some code and convert every function call—and every return—into a tail call. What you end up with is called continuation-passing style, or CPS. For example, here’s a function containing two recursive calls: (define (count-tree t) (if (pair? t) (+ (count-tree (car t)) (count-tree (cdr t))) 1)) And here’s how it … Read more

Specification for a Functional Reactive Programming language

I’m glad you’re starting by asking about a specification rather than implementation first. There are a lot of ideas floating around about what FRP is. From the very start in the early 90’s (when I was working in interactive graphics at Sun Microsystems and then Microsoft Research), it has been about two properties (a) denotative … Read more

How to compose functions in Rust?

As @ljedrz points out, to make it work you only need to reference the composed functions again: let finally = compose(&*multiply_and_add, &*divide_and_subtract); (Note that in Rust, convention dictates that variable names should be in snake_case) However, we can make this better! Since Rust 1.26, we can use abstract return types (previously featured gated as #![feature(conservative_impl_trait)]). … Read more

What is “point free” style (in Functional Programming)?

Just look at the Wikipedia article to get your definition: Tacit programming (point-free programming) is a programming paradigm in which a function definition does not include information regarding its arguments, using combinators and function composition […] instead of variables. Haskell example: Conventional (you specify the arguments explicitly): sum (x:xs) = x + (sum xs) sum … Read more