[chuck-users] Passing functions as arguments

John Crane john.crane at gmail.com
Tue Aug 25 16:51:07 EDT 2020


Hi all,

Chuck newbie here. Is it possible to pass a function as an argument? I'd
like to be able to  transform things in a functional programming manner.
As a trivial example, if I had an array of midi notes and wanted to raise
them all one interval.

    fun int increment(int note) {
        note + 1;
    }

    // use map to apply a function to all elements of an array
    map ( array_of_notes, increment);

thanks in advance,

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20200825/bfcf81e8/attachment.html>


More information about the chuck-users mailing list