Recommended Posts

Recently I had a dream in which I asked Hemingway and four other literary luminaries to write some JavaScript for me; specifically a function that returned a fibonacci series of a given length. Interestingly each author chose to solve the problem in a different way. They did pretty well actually - as far as I can tell every solution works as advertised (yes, even Andre Breton?s). Here?s what I got:

Ernest Hemingway

function fibonacci(size) {

  var first = 0, second = 1, next, count = 2, result = [first, second];

  if(size < 2)
	return "the request was made but it was not good"

  while(count++ < size) {
	next = first + second;
	first = second;
	second = next;
	result.push(next);
  }
  return result;
}

William Shakespeare

function theSeriesOfFIBONACCI(theSize) {

  //a CALCKULATION in two acts.
  //employ'ng the humourous logick of JAVA-SCRIPTE

  //Dramatis Personae
  var theResult; //an ARRAY to contain THE NUMBERS
  var theCounter; //a NUMBER, serv'nt to the FOR LOOP

  //ACT I: in which a ZERO is added for INITIATION

  //[ENTER: theResult]

  //Upon the noble list bestow a zero
  var theResult = [0];

  //ACT II: a LOOP in which the final TWO NUMBERS are QUEREED and SUMM'D

  //[ENTER: theCounter]

  //Commence at one and venture o'er the numbers
  for (theCounter = 1; theCounter < theSize; theCounter++) {
	//By divination set adjoining members
	theResult[theCounter] = (theResult[theCounter-1]||1) + theResult[Math.max(0, theCounter-2)];
  }

  //'Tis done, and here's the answer.
  return theResult;

  //[Exuent]
}

Andre Breton

function Colette(umbrella) {
  var staircase = 0, galleons = 0, brigantines = 1, armada = [galleons, brigantines], bassoon;
  Array.prototype.embrace = [].push;

  while(2 + staircase++ < umbrella) {
	bassoon = galleons + brigantines;
	armada.embrace(brigantines = (galleons = brigantines, bassoon));
  }

  return armada;
}

Roberto Bolano

function LeonardoPisanoBigollo(l) {

  if(l < 0) {
	return "I'd prefer not to respond. (Although several replies occur to me)"
  }

  /**/

  //Everything is getting complicated.
  for (var i=2,r=[0,1].slice(0,l);i<l;r.push(r[i-1]+r[i-2]),i++)

  /**/

  //Here are some other mathematicians. Mostly it's just nonsense.

  rationalTheorists = ["Archimedes of Syracuse", "Pierre de Fermat (such margins, boys!)",
"Srinivasa Ramanujan", "Rene Descartes", "Leonhard Euler", "Carl Gauss",
"Johann Bernoulli", "Jacob Bernoulli", "Aryabhata", "Brahmagupta", "Bhaskara II",
"Nilakantha Somayaji", "Omar Khayy?m", "Muhammad ibn M?s? al-Khw?rizm?",
"Bernhard Riemann", "Gottfried Leibniz", "Andrey Kolmogorov", "Euclid of Alexandria",
"Jules Henri Poincar?", "Srinivasa Ramanujan", "Alexander Grothendieck (who could forget?)",
"David Hilbert", "Alan Turing", "von Neumann", "Kurt G?del", "Joseph-Louis Lagrange",
"Georg Cantor", "William Rowan Hamilton", "Carl Jacobi", "?variste Galois", "Nikolay Lobachevsky",
"Rene Descartes", "Joseph Fourier", "Pierre-Simon Laplace", "Alonzo Church", "Nikolay Bogolyubov"]

  /**/

  //I didn't understand any of this, but here it is anyway.
  return r

  /**/

  //Nothing happens here and if it does I'd rather not talk about it.
}

Charles Dickens

function mrFibbowicksNumbers(enormity) {
  var assortment = [0,1,1], tally = 3, artfulRatio = 1.61803;

  while(tally++ < enormity) {
	//here is an exceedingly clever device
	assortment.push(Math.round(assortment[tally-2] * artfulRatio));
  }

  //should there be an overabundance of elements, a remedy need be applied
  return assortment.slice(0, enormity);
}

Source, explanation of all this nonsense, comments on each of the authors and why Hemingway rocks and Dickens socks: link

:rofl:

Link to comment
https://www.neowin.net/forum/topic/1125192-if-hemingway-wrote-javascript/
Share on other sites

This topic is now closed to further replies.
  • Posts

    • eh I'll wait for the June 2026 MVS ISO downloads which should be coming out next Tuesday June 16 and possibly contain build 8655 instead of 8653
    • read this recent topic in another forum: https://www.askwoody.com/forums/topic/still-on-win-10-and-happy-to-be-there/ some people are happy sticking with Win10
    • Cooler Master MasterFrame 600 PC case is now 33% off on Amazon by Ivan Jenic The Cooler Master MasterFrame 600 is currently $109.99 on Amazon, down from its original $164.99 list price. That's 33% off and $55 saved on this premium aluminum mid-tower case with a modular design. If you're upgrading your PC case and want something that doesn't force you into a rigid layout, the MasterFrame 600 is worth a look. The case is built around the Cooler Master's FreeForm 2.0 platform, which lets you reconfigure the internal structure according to your hardware. Magnetic side panels allow for straightforward adjustments, and the case supports everything from Mini-ITX to E-ATX motherboards without compromise. There's also generous cooling headroom. Four pre-installed PWM fans handle airflow out of the box. GPU clearance goes up to 410mm, and the case supports radiators up to 420mm with room for three simultaneously. Truth be told, this might not be the prettiest case on the market, but it’s highly functional. The aluminum construction keeps the whole thing lightweight despite its size, and the finish looks noticeably better than the plastic mid-towers competing at this price point. If you want a serious, flexible case that prioritizes function over flashy aesthetics like RGB lighting, the MasterFrame 600 delivers at a reasonable price. Cooler Master MasterFrame 600 - $109.99 | 33% off on Amazon This Amazon deal is US-specific and not available in other regions unless specified. This is a first-party seller link (at the time of article publishing); ensure that you also purchase from a first-party seller link only. If you don't like it or want to look at more options, check out the previous deals that we have covered, OR you can also visit Amazon US deals page. Get Prime (SNAP), Prime Video, Audible Plus or Kindle / Music Unlimited. Free for 30 days. As an Amazon Associate, we earn from qualifying purchases.
    • DK, I don't use the extended channel, I'm always on the latest release.
  • Recent Achievements

    • Rookie
      restore went up a rank
      Rookie
    • Very Popular
      AndrewSteel earned a badge
      Very Popular
    • Veteran
      Taliseian went up a rank
      Veteran
    • One Month Later
      Clizby earned a badge
      One Month Later
    • One Month Later
      Timaximus earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      509
    2. 2
      +Edouard
      162
    3. 3
      PsYcHoKiLLa
      155
    4. 4
      ATLien_0
      82
    5. 5
      Steven P.
      79
  • Tell a friend

    Love Neowin? Tell a friend!