Draft

A function within a function

9,263 of 13,610amrdraz

Description:

Given an input n, write a function always that returns a function which returns n. Ruby should return a lambda or a proc.

var three = always(3);
three(); // returns 3
three = always(3)
three() # returns 3
three = always(3)
three.call # returns 3
three = always(3)
three() /* returns 3 */
let three = always 3
three () -- returns 3
(def three (always 3))
(three) ;; returns 3
three = always(3)
three.() #=> 3
function<int (void)> three = always(3);
three(); // returns 3
Func<int> three = Kata.Always(3);
three(); // returns 3
Fundamentals

More By Author:

Check out these other kata created by amrdraz

Stats:

CreatedMay 27, 2014
Warriors Trained22304
Total Skips1657
Total Code Submissions57191
Total Times Completed13610
JavaScript Completions9263
CoffeeScript Completions165
Ruby Completions716
Python Completions2503
Haskell Completions392
Clojure Completions327
Elixir Completions243
C++ Completions436
Swift Completions234
C# Completions136
Total Stars167
% of votes with a positive feedback rating81% of 1636
Total "Very Satisfied" Votes1130
Total "Somewhat Satisfied" Votes400
Total "Not Satisfied" Votes106
Total Rank Assessments966
Average Assessed Rank
7 kyu
Highest Assessed Rank
1 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • amrdraz Avatar
  • jhoffner Avatar
  • xcthulhu Avatar
  • dnolan Avatar
  • user578387 Avatar
  • cris Avatar
  • yantonov Avatar
  • JDeBolt Avatar
  • aweleshetu Avatar
  • kazk Avatar
  • Souzooka Avatar
  • albertogcmr Avatar
  • solitude Avatar
Ad