[ot][crazy][personal] Micro-moronism Challenge: Iterate & Transform

Undescribed Horrific Abuse, One Victim & Survivor of Many gmkarl at gmail.com
Wed Dec 7 00:45:45 PST 2022


# this was pretty hard. i'm kind of confused looking at this.
# i mostly just did a blind paste rather than intending the content.

def sum(a, b):
  return a + b

def add(a, b):
  import operator
  return operator.add(a, b) # added a bugfix here, missing return

print(sum(1,2))
print(add(1,2))

=> MUTATE, REFACTOR, CONSOLIDATE, IMPROVE =>

def add(a, b):
  # some implementations previously called out to operator.add to do this
  # I saw no use of this behavior and have elided it in 2022-12-07
  return a + b

print(add(1,2))
print(add(1,2))

=> MUTATE, TRANSLATE, DOCUMENT, RESOLVE =>

template <typename T>
T add(T a, T b)
{
  // added missing comment found in python source:
  // some implementations previously called out to operator.add to do this
  // I saw no use of this behavior and have elided it in 2022-12-07
  return a + b;
}

#include <iostream>

void main()
{
  std::cout << add(1, 2) << std::endl;
  std::cout << add(1, 2) << std::endl; // added missing parallel output here
}


More information about the cypherpunks mailing list