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.139 tracks/lua/exercises/house/example.lua
trackler-2.2.1.138 tracks/lua/exercises/house/example.lua
trackler-2.2.1.137 tracks/lua/exercises/house/example.lua
trackler-2.2.1.136 tracks/lua/exercises/house/example.lua
trackler-2.2.1.135 tracks/lua/exercises/house/example.lua
trackler-2.2.1.134 tracks/lua/exercises/house/example.lua
trackler-2.2.1.133 tracks/lua/exercises/house/example.lua
trackler-2.2.1.132 tracks/lua/exercises/house/example.lua
trackler-2.2.1.131 tracks/lua/exercises/house/example.lua
trackler-2.2.1.130 tracks/lua/exercises/house/example.lua
trackler-2.2.1.129 tracks/lua/exercises/house/example.lua
trackler-2.2.1.128 tracks/lua/exercises/house/example.lua
trackler-2.2.1.127 tracks/lua/exercises/house/example.lua
trackler-2.2.1.126 tracks/lua/exercises/house/example.lua
trackler-2.2.1.125 tracks/lua/exercises/house/example.lua
trackler-2.2.1.124 tracks/lua/exercises/house/example.lua
trackler-2.2.1.123 tracks/lua/exercises/house/example.lua
trackler-2.2.1.122 tracks/lua/exercises/house/example.lua
trackler-2.2.1.121 tracks/lua/exercises/house/example.lua
trackler-2.2.1.120 tracks/lua/exercises/house/example.lua