Higher order programming

Higher order programming

Post by ib.mossi » Sun, 06 Aug 2006 05:50:51


Hi,

Is lisp the only programming language with higher order functions?
Higher order functions are truely great for abstraction and code reuse
and should be applied more in modern programming. Wouldn't you agree?

Best regards,
John
 
 
 

Higher order programming

Post by Pascal Cos » Sun, 06 Aug 2006 05:54:33


No, see for example http://www.yqcomputer.com/


Yes.


Pascal

--
My website: http://www.yqcomputer.com/
Closer to MOP & ContextL:
http://www.yqcomputer.com/

 
 
 

Higher order programming

Post by Frank Bus » Sun, 06 Aug 2006 06:11:24


You can use higher order functions in C++, too:

stl::vector<int> v;
v.push_back(1);
v.push_back(11);
cout << count(v.begin(), v.end(), bind2nd(less(), 10));

But don't ask how the "bind2nd" and "less" constructs looks like :-)

In Common Lisp it looks like this:

(count-if (lambda (x) (< x 10)) '(1 11))

But the bind2nd function is useful, too, in Lisp (is there such a function
already defined in the CLHS? )

(defun bind2nd (fun arg2)
(lambda (arg1)
(funcall fun arg1 arg2)))

Then you can write it like in C++:

(count-if (bind2nd #'< 10) '(1 11))


Yes.

--
Frank Buss, XXXX@XXXXX.COM
http://www.yqcomputer.com/ , http://www.yqcomputer.com/
 
 
 

Higher order programming

Post by Duncan Ros » Sun, 06 Aug 2006 06:57:18


This is I think generally called a 'right-curry'. See for example

http://www.yqcomputer.com/