Also,

Jan. 23rd, 2014 05:27 pm
davv: The bluegreen quadruped. (Default)
[personal profile] davv
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.

Date: 2014-01-23 04:57 pm (UTC)
lhexa: (literate)
From: [personal profile] lhexa
Weirldy enough, that's also how it's done in a fair chunk of mathematical logic, such as Peano arithmetic. I guess it's because you need fewer axioms, if your only operation is "add one".

Date: 2014-01-24 01:56 am (UTC)
lhexa: (literate)
From: [personal profile] lhexa
Yeah, it's just the natural numbers.

March 2018

S M T W T F S
    123
45678910
1112131415 1617
18192021222324
25262728293031

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 1st, 2026 04:34 pm
Powered by Dreamwidth Studios