recursion is fun! It feels more like magic.
Here's a nice functional programming exercise I did today: Given a function that increments an integer and a function that decrements it, create a function that returns the sum of two numbers, where either of the two numbers may be positive or negative.
Here's a nice functional programming exercise I did today: Given a function that increments an integer and a function that decrements it, create a function that returns the sum of two numbers, where either of the two numbers may be positive or negative.
no subject
Date: 2014-01-23 04:57 pm (UTC)no subject
Date: 2014-01-23 07:47 pm (UTC)(I don't think that definition of integers would support negative ones, though. Am I right?)
no subject
Date: 2014-01-24 01:56 am (UTC)