{
  localUrl: '../page/associativity_vs_commutativity.html',
  arbitalUrl: 'https://arbital.com/p/associativity_vs_commutativity',
  rawJsonUrl: '../raw/3mw.json',
  likeableId: '2510',
  likeableType: 'page',
  myLikeValue: '0',
  likeCount: '3',
  dislikeCount: '0',
  likeScore: '3',
  individualLikes: [
    'EricBruylant',
    'NateSoares',
    'ZackMDavis'
  ],
  pageId: 'associativity_vs_commutativity',
  edit: '1',
  editSummary: '',
  prevEdit: '0',
  currentEdit: '1',
  wasPublished: 'true',
  type: 'wiki',
  title: 'Associativity vs commutativity',
  clickbait: '',
  textLength: '4534',
  alias: 'associativity_vs_commutativity',
  externalUrl: '',
  sortChildrenBy: 'likes',
  hasVote: 'false',
  voteType: '',
  votesAnonymous: 'false',
  editCreatorId: 'NateSoares',
  editCreatedAt: '2016-05-15 13:13:51',
  pageCreatorId: 'NateSoares',
  pageCreatedAt: '2016-05-15 13:13:51',
  seeDomainId: '0',
  editDomainId: 'AlexeiAndreev',
  submitToDomainId: '0',
  isAutosave: 'false',
  isSnapshot: 'false',
  isLiveEdit: 'true',
  isMinorEdit: 'false',
  indirectTeacher: 'false',
  todoCount: '1',
  isEditorComment: 'false',
  isApprovedComment: 'true',
  isResolved: 'false',
  snapshotText: '',
  anchorContext: '',
  anchorText: '',
  anchorOffset: '0',
  mergedInto: '',
  isDeleted: 'false',
  viewCount: '47',
  text: '[3h4 Associativity] and [3jb commutativity] are often confused, because they are both constraints on how a [3jy function] treats its inputs, and they are both constraints saying "these two paths for calculating the output must yield the same answer." The difference is that commutativity says "this function shouldn't care what order its own arguments come in," while associativity says "different ways of using this function multiple times should yield the same results."\n\nCommutativity is about an invariance in _one_ call to the function: If you run the function once with inputs $x$ and $y,$ you'll get the same result as if you run it once with inputs $y$ and $x.$\n\nAssociativity is about an invariance in _multiple_ calls to the function: If you combine four elements using three function calls in the order $a \\cdot (b \\cdot (c \\cdot d)),$ you'll get the same answer as if you use the three function calls in the order $((a \\cdot b) \\cdot c) \\cdot d.$\n\nCommutativity means you can swap the order of the elements. Associativity means you can drop parenthesis when combining multiple elements in a row.\n\nIf an operator $\\cdot$ is both commutative and associative, then when you're combining multiple elements in a row, you're welcome to combine them in _any_ order: For example, when adding $3 + 2 + (-7) + 5 + (-2) + (-3) + 7,$ we can re-arrange the list to get $3 - 3 + 2 - 2 + 7 - 7 + 5 = 5,$ which makes calculation easy. To see that this is the case, note that the result won't change if we swap any two adjacent elements, because associativity means that we can pick any two adjacent elements to start with and commutativity says that the order of those elements doesn't matter. Then, we can re-arrange the list however we like using a series of two-element swaps.\n[fixme: Perhaps conditionalize this parenthetical on something like "cares about abstract algebra" or "wants tidbits they don't understand to point them towards cool things" or something.]\n(This is why [3h2 commutative groups] are especially easy to work with.)\n\n## Examples\n\nAddition is both commutative and associative (same with multiplication). Subtraction is neither commutative nor associative (same with division).\n\n[3jv String concatenation] is associative but not commutative: If you're sticking a bunch of [3jr strings] together end on end, then it doesn't matter which adjacent pairs you combine first, but `"onetwo"` is a very different string than `"twoone"`.\n\nRock-paper-scissors is commutative but not associative. The winner of "rock v scissors" is rock, and the winner of "scissors v rock" is rock, and so on; but if you have a bunch of people in a line make rock, paper, or scissors signs, then who is the winer depends on which end of the line you start from: If the line has three people, and they throw [rock, paper, scissors], then the winner will be whoever threw scissors if you start from the left (by finding the winner between rock and paper,  and then playing that against scissors) or rock if you start on the right (by finding the winner between paper and scissors, and then playing that against rock).\n\nThe function `pair` which puts its inputs into a pair (such that `pair(x, y) = (x, y)`) is neither commutative nor associative: `(x, y)` does not equal `(y, x)`, and `(x, (y, z))` does not equal `((x, y), z)`. The output of `pair` preserves the ordering and structure of all its inputs, and leaves a trace that allows one to distinguish which inputs it was called on when. Both commutativity and associativity require the function to be "forgetful" about some aspect of how it was called: Commutative functions need to be insensitive to the ordering of their arguments; associative functions need to leave no trace that can be used to figure out which inputs were combined in what order. Thus, any function that bakes a lot of history about what it was called with into the output is unlikely to be commutative or associative.\n\n## Mnemonics\n\nIf it helps you to remember which is which, consider these two mnemonics:\n\nFor "commutativity," imagine that the two parameters to the function each live on one side of town and work on the other side. Each morning, they pass each other on their morning _commute,_ as they swap places.\n\nFor "associativity," imagine a bunch of _associates_ all standing in a line, ranked according to their hierarchy in a law firm. Any two adjacent people are willing to converse with each other, although people on one end of the line might not be willing to associate with people on the other end.',
  metaText: '',
  isTextLoaded: 'true',
  isSubscribedToDiscussion: 'false',
  isSubscribedToUser: 'false',
  isSubscribedAsMaintainer: 'false',
  discussionSubscriberCount: '1',
  maintainerCount: '1',
  userSubscriberCount: '0',
  lastVisit: '',
  hasDraft: 'false',
  votes: [],
  voteSummary: 'null',
  muVoteSummary: '0',
  voteScaling: '0',
  currentUserVote: '-2',
  voteCount: '0',
  lockedVoteType: '',
  maxEditEver: '0',
  redLinkCount: '0',
  lockedBy: '',
  lockedUntil: '',
  nextPageId: '',
  prevPageId: '',
  usedAsMastery: 'false',
  proposalEditNum: '0',
  permissions: {
    edit: {
      has: 'false',
      reason: 'You don't have domain permission to edit this page'
    },
    proposeEdit: {
      has: 'true',
      reason: ''
    },
    delete: {
      has: 'false',
      reason: 'You don't have domain permission to delete this page'
    },
    comment: {
      has: 'false',
      reason: 'You can't comment in this domain because you are not a member'
    },
    proposeComment: {
      has: 'true',
      reason: ''
    }
  },
  summaries: {},
  creatorIds: [
    'NateSoares'
  ],
  childIds: [],
  parentIds: [
    'associative_operation',
    'commutative_operation'
  ],
  commentIds: [],
  questionIds: [],
  tagIds: [
    'needs_clickbait_meta_tag'
  ],
  relatedIds: [],
  markIds: [],
  explanations: [],
  learnMore: [],
  requirements: [],
  subjects: [],
  lenses: [],
  lensParentId: '',
  pathPages: [],
  learnMoreTaughtMap: {},
  learnMoreCoveredMap: {},
  learnMoreRequiredMap: {},
  editHistory: {},
  domainSubmissions: {},
  answers: [],
  answerCount: '0',
  commentCount: '0',
  newCommentCount: '0',
  linkedMarkCount: '0',
  changeLogs: [
    {
      likeableId: '0',
      likeableType: 'changeLog',
      myLikeValue: '0',
      likeCount: '0',
      dislikeCount: '0',
      likeScore: '0',
      individualLikes: [],
      id: '17142',
      pageId: 'associativity_vs_commutativity',
      userId: 'EricBruylant',
      edit: '0',
      type: 'newTag',
      createdAt: '2016-07-19 02:15:58',
      auxPageId: 'needs_clickbait_meta_tag',
      oldSettingsValue: '',
      newSettingsValue: ''
    },
    {
      likeableId: '0',
      likeableType: 'changeLog',
      myLikeValue: '0',
      likeCount: '0',
      dislikeCount: '0',
      likeScore: '0',
      individualLikes: [],
      id: '10419',
      pageId: 'associativity_vs_commutativity',
      userId: 'NateSoares',
      edit: '1',
      type: 'newEdit',
      createdAt: '2016-05-15 13:13:51',
      auxPageId: '',
      oldSettingsValue: '',
      newSettingsValue: ''
    },
    {
      likeableId: '0',
      likeableType: 'changeLog',
      myLikeValue: '0',
      likeCount: '0',
      dislikeCount: '0',
      likeScore: '0',
      individualLikes: [],
      id: '10416',
      pageId: 'associativity_vs_commutativity',
      userId: 'NateSoares',
      edit: '1',
      type: 'newParent',
      createdAt: '2016-05-15 12:38:20',
      auxPageId: 'associative_operation',
      oldSettingsValue: '',
      newSettingsValue: ''
    },
    {
      likeableId: '0',
      likeableType: 'changeLog',
      myLikeValue: '0',
      likeCount: '0',
      dislikeCount: '0',
      likeScore: '0',
      individualLikes: [],
      id: '10415',
      pageId: 'associativity_vs_commutativity',
      userId: 'NateSoares',
      edit: '1',
      type: 'newParent',
      createdAt: '2016-05-15 12:37:58',
      auxPageId: 'commutative_operation',
      oldSettingsValue: '',
      newSettingsValue: ''
    }
  ],
  feedSubmissions: [],
  searchStrings: {},
  hasChildren: 'false',
  hasParents: 'true',
  redAliases: {},
  improvementTagIds: [],
  nonMetaTagIds: [],
  todos: [],
  slowDownMap: 'null',
  speedUpMap: 'null',
  arcPageIds: 'null',
  contentRequests: {}
}