Higher-Order Programming in C

J

Jonathan Bartlett

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-128.ibm.com/developerworks/library/l-highfunc.html

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
 
E

Eric Sosman

Jonathan said:
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-128.ibm.com/developerworks/library/l-highfunc.html

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.

Mostly, it reads like a Scheme advertisement -- "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.
 
J

jacob navia

Jonathan said:
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-128.ibm.com/developerworks/library/l-highfunc.html

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

Very interesting message.
Thanks for the tip.

jacob
 
R

Rob Thorpe

Jonathan Bartlett said:
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-128.ibm.com/developerworks/library/l-highfunc.html

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.

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.
 
J

Jonathan Bartlett

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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top