Sha256: f7d41129e8b96a498ab18808752abf072acbf1cb1e13ed21fc07ea0729216402

Contents?: true

Size: 837 Bytes

Versions: 396

Compression:

Stored size: 837 Bytes

Contents

local house = {}

local stuff = {
  'the house that Jack built.',
  'the malt\nthat lay in ',
  'the rat\nthat ate ',
  'the cat\nthat killed ',
  'the dog\nthat worried ',
  'the cow with the crumpled horn\nthat tossed ',
  'the maiden all forlorn\nthat milked ',
  'the man all tattered and torn\nthat kissed ',
  'the priest all shaven and shorn\nthat married ',
  'the rooster that crowed in the morn\nthat woke ',
  'the farmer sowing his corn\nthat kept ',
  'the horse and the hound and the horn\nthat belonged to '
}

house.verse = function(which)
  local verse = ''
  for i = 1, which do
    verse = stuff[i] .. verse
  end
  return 'This is ' .. verse
end

house.recite = function()
  local verses = {}
  for i = 1, #stuff do
    table.insert(verses, house.verse(i))
  end
  return table.concat(verses, '\n')
end

return house

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/lua/exercises/house/example.lua
trackler-2.2.1.179 tracks/lua/exercises/house/example.lua
trackler-2.2.1.178 tracks/lua/exercises/house/example.lua
trackler-2.2.1.177 tracks/lua/exercises/house/example.lua
trackler-2.2.1.176 tracks/lua/exercises/house/example.lua
trackler-2.2.1.175 tracks/lua/exercises/house/example.lua
trackler-2.2.1.174 tracks/lua/exercises/house/example.lua
trackler-2.2.1.173 tracks/lua/exercises/house/example.lua
trackler-2.2.1.172 tracks/lua/exercises/house/example.lua
trackler-2.2.1.171 tracks/lua/exercises/house/example.lua
trackler-2.2.1.170 tracks/lua/exercises/house/example.lua
trackler-2.2.1.169 tracks/lua/exercises/house/example.lua
trackler-2.2.1.167 tracks/lua/exercises/house/example.lua
trackler-2.2.1.166 tracks/lua/exercises/house/example.lua
trackler-2.2.1.165 tracks/lua/exercises/house/example.lua
trackler-2.2.1.164 tracks/lua/exercises/house/example.lua
trackler-2.2.1.163 tracks/lua/exercises/house/example.lua
trackler-2.2.1.162 tracks/lua/exercises/house/example.lua
trackler-2.2.1.161 tracks/lua/exercises/house/example.lua
trackler-2.2.1.160 tracks/lua/exercises/house/example.lua