functional

Resources on implementation of functional languages

Which are the resources on implementation of interpreters/compilers for functional languages? I would like practical examples, and I already have a copy of The Implementation of Functional Programming Languages. ...

What is wrong with this Lisp Function?

This function is a CLisp function, this is part of a homework problem, but which is supposed to be written in this different format (the second function). (defun range (m M) (cond ((> m M) '() ) ((= m M) '() ) ((< m M) (cons m (range (+ m 1) M ) ) ) ) ) (define (range m M) (cond ((> m M) '() ) ((= m M) '() ) ((< m M) (co...

How to use for_each here correctly?

Hi, I am new to all the functional stuff in STL. I tried to do smething but it fails horribly no matter how I try it. Please comment: #include <iostream> #include <algorithm> using namespace std; class X { public: void Print(int x) { cout << x << endl; } void Do() { ...

Is there any way to make for_each take references?

Hi, This cites for_each as follows: template<class InputIterator, class Function> Function for_each(InputIterator first, InputIterator last, Function f); I have a collection std::list<std::string>, and a function void Do(std::string) works fine when given to for_each along with the iterators. But if I supply a function like void ...

functional assembly language

Hey guys, Lets say there was an architecture XYZ which was optimised for functional languages (like haskell). Can any tell me the advantages of such an architecture and also a "functional" assembly language? Thanks in advance ...

How to handle checked exceptions inside a functor object in Java

Hi all, We use the http://jedi.codehaus.org libraries for working with collections and manipulating them in a functional way. We recently came across a problem when doing something similar to the following: public class Address { //constructors and stuff public KiloWatts electricityConsumed(Duration timePeriod) throw NoElectri...

Are the "Iron" languages ready for prime time?

Is it okay to start using Iron Ruby and Iron Python in production systems? Also, are there any additional requirements for hosting them? And, for the bonus points, given that F# is a functional programming language in the same way that Python is, is there any advantage to using one over the other within the .NET framework? ...

Combining std::function objects

Say I have double xSquared( const double ) { return x*x; } ... std::function<double (double)> func = &xSquared; ... which works fine for the (more complicated) purposes I use this structure, up till now. Now I have a function that accepts a std::function of the above form and I need to create a new std::function that extends the ...

<functional> (nested bind) problems with MSVC 2010

I have the following code (I'm sorry for the lengthiness): double primeValue( const func1D &func, const double lowerBound, const double upperBound, const double pole ) { // check bounds if( lowerBound >= upperBound ) throw runtime_error( "lowerBound must be smaller than upperBound!" ...

Are there any provable real-world languages? (scala?)

I was taught about formal systems at university, but I was disappointed how they didn't seem to be used in the real word. I like the idea of being able to know that some code (object, function, whatever) works, not by testing, but by proof. I'm sure we're all familiar with the parallels that don't exist between physical engineering and...