Higher-Order Programming in C

Discussion in 'C Programming' started by Jonathan Bartlett, Mar 31, 2005.

  1. 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
    ----
    Learn to program using Linux assembly language
    http://www.cafeshops.com/bartlettpublish.8640017
     
    Jonathan Bartlett, Mar 31, 2005
    #1
    1. Advertising

  2. Jonathan Bartlett

    Eric Sosman Guest

    Jonathan Bartlett wrote:
    > 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.

    --
     
    Eric Sosman, Mar 31, 2005
    #2
    1. Advertising

  3. Jonathan Bartlett

    jacob navia Guest

    Jonathan Bartlett wrote:
    > 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
    > ----
    > Learn to program using Linux assembly language
    > http://www.cafeshops.com/bartlettpublish.8640017


    Very interesting message.
    Thanks for the tip.

    jacob
     
    jacob navia, Apr 1, 2005
    #3
  4. Jonathan Bartlett

    Rob Thorpe Guest

    Jonathan Bartlett <> wrote in message news:<424c62b4$>...
    > 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.
     
    Rob Thorpe, Apr 2, 2005
    #4

  5. > 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
     
    Jonathan Bartlett, Apr 4, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Fink
    Replies:
    3
    Views:
    282
    Arnaud Delobelle
    Dec 22, 2010
  2. Nickolay Kolev

    Higher Order Functions

    Nickolay Kolev, Jul 31, 2005, in forum: Ruby
    Replies:
    5
    Views:
    141
    Nickolay Kolev
    Aug 8, 2005
  3. Victor \Zverok\ Shepelev

    Higher-order messaging in Ruby

    Victor \Zverok\ Shepelev, Oct 11, 2006, in forum: Ruby
    Replies:
    0
    Views:
    119
    Victor \Zverok\ Shepelev
    Oct 11, 2006
  4. Nate Murray
    Replies:
    13
    Views:
    191
    Gregory Brown
    Jan 5, 2007
  5. Christoffer Lernö
    Replies:
    17
    Views:
    256
    Robert Dober
    Mar 16, 2007
Loading...

Share This Page