Higher-Order Programming in C

Higher-Order Programming in C

Post by Jonathan B » Sat, 02 Apr 2005 04:46:03


Just thought you all might be interested in an article I just finished
about higher-order functions, and their use in Scheme and C:

http://www.yqcomputer.com/

This is part of a series of articles I'm writing about functional
programming and how it can be used to even in procedural languages.
This even includes a section on object-oriented programming in C (not
C++) and Scheme.

Jon
----
Learn to program using Linux assembly language
http://www.yqcomputer.com/
 
 
 

Higher-Order Programming in C

Post by Eric Sosma » Sat, 02 Apr 2005 06:54:28


Mostly, it reads like a Scheme adverti *** t -- "If
you want Lisp, you know where to find it." The C code
could do with some cleaning up; in particular, the manual
imitation of a closure invokes undefined behavior. It is
flat-out incorrect to invoke a function like

int nextval(void *environment);

via a function pointer described as

typedef void * (*generic_function)(void *, ...);

without first converting the pointer to agree with the
type of the called function. And no, this isn't some kind
of "academic" concern, pertinent only to the DeathStation
line: there are real computers on which this will fail.

--
XXXX@XXXXX.COM

 
 
 

Higher-Order Programming in C

Post by jacob navi » Sat, 02 Apr 2005 20:28:16


Very interesting message.
Thanks for the tip.

jacob
 
 
 

Higher-Order Programming in C

Post by robert.tho » Mon, 04 Apr 2005 00:12:13


Very interesting. I would write many programs in Scheme if I could
easily link them to outside libraries like I can with C.

I think that there are slightly more safe/pleasant ways to do many of
the things done in this article, but I can't remember them right now.
I'll post them if I remember them.
 
 
 

Higher-Order Programming in C

Post by Jonathan B » Tue, 05 Apr 2005 22:40:24


Many Scheme implementations allow this with little difficulty. Chicken
can actually parse some C prototypes directly. Implementing glue code
is pretty simple in most of them.

Jon