next, count = 2; var 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; }
humourous logick of JAVA-SCRIPTE //Dramatis Personae... var theResult; //an ARRAY to contain THE NUMBERS var theCounter;//a NUMBER serv'nt to the FORLOOP
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)]; }
not to respond."\ "(Although several replies occur to me)" } /**/ //Everything is getting complicated. for (vari=2,r=[0,1].slice(0,l); i<l;r.push(r[i-1]+r[i-2]),i++)
var 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); }
forty-three like a steam engine with a talky caboose at the end*/ n = 43, /*and that lanky fellow in a cocked fedora*/ r = 1 /*then back to our number, our mad number, mad to become one*/ while (n > 1) /*mad to descend*/ n--, /*mad to multiply*/ r = r * n /*and at the end, you see the blue center-light pop, and everybody goes 1.4050061177528801e+51...*/ r
//grand thing is to be able to reason backwards //some things are easier known than explained! var caseHistory = new Object({2:2, 6:3}); function unfactorial(evidence){ //first, humility! if (evidence === 1) { return "Watson, I am at a loss!" } //second, logical precedence! if(caseHistory[evidence]){ //elementary! return caseHistory[evidence]; }
another can discover! caseHistory[evidence] = theDeduction; //What remains, however improbable, is truth! return theDeduction; } unfactorial(2); //2 unfactorial(120); //5 unfactorial(25); //‘charlatans!’ unfactorial(1); //‘Watson, I am at a loss!’
of ELECTRONICK CONJURY factorial = (n) -> # All argument is against it; # yet all belief is for it return 1 unless n # Ingenious sophistry to prove # the palp'bly OBVIOUS return 1 if n is 1 # Recursion (n.) # a program that calls 'pon itself in the # manner of a dog returning unto its VOMIT n * factorial n - 1
return function reckoning(quantity) { if (isNaN(quantity)) { console.log("I have not the pleasure of"\ "understanding you"); return; } //It is a truth universally acknowledged that //two values can only be adjudged truly //agreeable by means of the === operator if (quantity === 0) { return 1; }
dreary, while I struggled with JQuery, Sighing softly, weak and weary, troubled by my daunting chore, While I grappled with weak mapping, suddenly a function wrapping formed a closure, gently trapping objects that had gone before. Ah, distinctly I remember, it was while debugging Ember, As each separate dying member left its host for ever more. Eagerly I wished the morrow–vainly I had sought to borrow (From my bookmarked trail of sorrow), APIs from Underscore. There I sat engaged in guessing the meaning of each cursed expression, Endless callbacks in procession; nameless functions, nothing more, This and more I sat divining, strength and spirit fast declining, Disclose the value we're assigning! Tell me - tell me, I implore!