Skip to main content
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

Powershell, 487 453

0..11 | % {
   'On the {0} day of christmas my true love gave to me {1}`n'-f
   (
        'first^second^third^fourth^fifth^sixth^seventh^eighth^ninth^tenth^eleventh^twelfth'.Split('^')[$_],
        (
            'a partridge in a pear tree^two turtle doves and^three french hens^four calling birds^five golden rings^six geese-a-laying^Seven swans-a-swimming^Eight maids-a-milking^Nine ladies dancing^Ten lords-a-leaping^Eleven pipers piping^Twelve drummers drumming'.Split('^')[$_..0]-join' '
        )
    )
 }

Thank you to DaanDaan for the idea of splitting a concatenated string.

I had originally included a switching statement to get the "and" on the partridge for all but the first verse. But, because the question absolves us of punctuation, we can just append the "and" to the doves.

This results in line feeds as follows:

On the first day of christmas my true love gave to me a partridge in a pear tree

On the second day of christmas my true love gave to me two turtle doves and a partridge in a pear tree

On the third day of christmas my true love gave to me three french hens two turtle doves and a partridge in a pear tree

Powershell, 487 453

0..11 | % {
   'On the {0} day of christmas my true love gave to me {1}`n'-f
   (
        'first^second^third^fourth^fifth^sixth^seventh^eighth^ninth^tenth^eleventh^twelfth'.Split('^')[$_],
        (
            'a partridge in a pear tree^two turtle doves and^three french hens^four calling birds^five golden rings^six geese-a-laying^Seven swans-a-swimming^Eight maids-a-milking^Nine ladies dancing^Ten lords-a-leaping^Eleven pipers piping^Twelve drummers drumming'.Split('^')[$_..0]-join' '
        )
    )
 }

Thank you to Daan for the idea of splitting a concatenated string.

I had originally included a switching statement to get the "and" on the partridge for all but the first verse. But, because the question absolves us of punctuation, we can just append the "and" to the doves.

This results in line feeds as follows:

On the first day of christmas my true love gave to me a partridge in a pear tree

On the second day of christmas my true love gave to me two turtle doves and a partridge in a pear tree

On the third day of christmas my true love gave to me three french hens two turtle doves and a partridge in a pear tree

Powershell, 487 453

0..11 | % {
   'On the {0} day of christmas my true love gave to me {1}`n'-f
   (
        'first^second^third^fourth^fifth^sixth^seventh^eighth^ninth^tenth^eleventh^twelfth'.Split('^')[$_],
        (
            'a partridge in a pear tree^two turtle doves and^three french hens^four calling birds^five golden rings^six geese-a-laying^Seven swans-a-swimming^Eight maids-a-milking^Nine ladies dancing^Ten lords-a-leaping^Eleven pipers piping^Twelve drummers drumming'.Split('^')[$_..0]-join' '
        )
    )
 }

Thank you to Daan for the idea of splitting a concatenated string.

I had originally included a switching statement to get the "and" on the partridge for all but the first verse. But, because the question absolves us of punctuation, we can just append the "and" to the doves.

This results in line feeds as follows:

On the first day of christmas my true love gave to me a partridge in a pear tree

On the second day of christmas my true love gave to me two turtle doves and a partridge in a pear tree

On the third day of christmas my true love gave to me three french hens two turtle doves and a partridge in a pear tree
added 18 characters in body
Source Link

Powershell, 487 451453

0..11 | % {
   'On the {0} day of christmas my true love gave to me {1}'`n'-f
   (
        'first^second^third^fourth^fifth^sixth^seventh^eighth^ninth^tenth^eleventh^twelfth'.Split('^')[$_],
        (
            'a partridge in a pear tree^two turtle doves and^three french hens^four calling birds^five golden rings^six geese-a-laying^Seven swans-a-swimming^Eight maids-a-milking^Nine ladies dancing^Ten lords-a-leaping^Eleven pipers piping^Twelve drummers drumming'.Split('^')[$_..0]-join' '
        )
    )
 }

Thank you to Daan for the idea of splitting a concatenated string.

I had originally included a switching statement to get the "and" on the partridge for all but the first verse. But, because the question absolves us of punctuation, we can just append the "and" to the doves.

This results in line feeds as follows:

On the first day of christmas my true love gave to me a partridge in a pear tree 

On the second day of christmas my true love gave to me two turtle doves and a partridge in a pear tree 

On the third day of christmas my true love gave to me three french hens two turtle doves and a partridge in a pear tree

Powershell, 487 451

0..11 | % {
   'On the {0} day of christmas my true love gave to me {1}'-f
   (
        'first^second^third^fourth^fifth^sixth^seventh^eighth^ninth^tenth^eleventh^twelfth'.Split('^')[$_],
        (
            'a partridge in a pear tree^two turtle doves and^three french hens^four calling birds^five golden rings^six geese-a-laying^Seven swans-a-swimming^Eight maids-a-milking^Nine ladies dancing^Ten lords-a-leaping^Eleven pipers piping^Twelve drummers drumming'.Split('^')[$_..0]-join' '
        )
    )
 }

Thank you to Daan for the idea of splitting a concatenated string.

I had originally included a switching statement to get the "and" on the partridge for all but the first verse. But, because the question absolves us of punctuation, we can just append the "and" to the doves.

This results in line feeds as follows:

On the first day of christmas my true love gave to me a partridge in a pear tree
On the second day of christmas my true love gave to me two turtle doves and a partridge in a pear tree
On the third day of christmas my true love gave to me three french hens two turtle doves and a partridge in a pear tree

Powershell, 487 453

0..11 | % {
   'On the {0} day of christmas my true love gave to me {1}`n'-f
   (
        'first^second^third^fourth^fifth^sixth^seventh^eighth^ninth^tenth^eleventh^twelfth'.Split('^')[$_],
        (
            'a partridge in a pear tree^two turtle doves and^three french hens^four calling birds^five golden rings^six geese-a-laying^Seven swans-a-swimming^Eight maids-a-milking^Nine ladies dancing^Ten lords-a-leaping^Eleven pipers piping^Twelve drummers drumming'.Split('^')[$_..0]-join' '
        )
    )
 }

Thank you to Daan for the idea of splitting a concatenated string.

I had originally included a switching statement to get the "and" on the partridge for all but the first verse. But, because the question absolves us of punctuation, we can just append the "and" to the doves.

This results in line feeds as follows:

On the first day of christmas my true love gave to me a partridge in a pear tree 

On the second day of christmas my true love gave to me two turtle doves and a partridge in a pear tree 

On the third day of christmas my true love gave to me three french hens two turtle doves and a partridge in a pear tree
deleted 29 characters in body
Source Link

Powershell, 487 451

0..11 | % {
   'On the {0} day of christmas my true love gave to me {1}'-f
   (
        'first^second^third^fourth^fifth^sixth^seventh^eighth^ninth^tenth^eleventh^twelfth'.Split('^')[$_],
        (
            'a partridge in a pear tree^two turtle doves and^three french hens^four calling birds^five golden rings^six geese-a-laying^Seven swans-a-swimming^Eight maids-a-milking^Nine ladies dancing^Ten lords-a-leaping^Eleven pipers piping^Twelve drummers drumming'.Split('^')[$_..0]-join' '
        )
    )
 }

Thank you to Daan for the idea of splitting a concatenated string.

I had originally included a switching statement to get the "and" on the partridge for all but the first verse. But, because the question absolves us of punctuation, we can just append the "and" to the doves.

This results in line feeds as follows:

On the first day of christmas my true love gave to me a partridge in a pear tree
 
On the second day of christmas my true love gave to me two turtle doves and
  a partridge in a pear tree
 
On the third day of christmas my true love gave to me three french hens
  two turtle doves and
  a partridge in a pear tree

Powershell, 487 451

0..11 | % {
   'On the {0} day of christmas my true love gave to me {1}'-f
   (
        'first^second^third^fourth^fifth^sixth^seventh^eighth^ninth^tenth^eleventh^twelfth'.Split('^')[$_],
        (
            'a partridge in a pear tree^two turtle doves and^three french hens^four calling birds^five golden rings^six geese-a-laying^Seven swans-a-swimming^Eight maids-a-milking^Nine ladies dancing^Ten lords-a-leaping^Eleven pipers piping^Twelve drummers drumming'.Split('^')[$_..0]-join' '
        )
    )
 }

Thank you to Daan for the idea of splitting a concatenated string.

I had originally included a switching statement to get the "and" on the partridge for all but the first verse. But, because the question absolves us of punctuation, we can just append the "and" to the doves.

This results in line feeds as follows:

On the first day of christmas my true love gave to me a partridge in a pear tree
 
On the second day of christmas my true love gave to me two turtle doves and
 a partridge in a pear tree
 
On the third day of christmas my true love gave to me three french hens
 two turtle doves and
 a partridge in a pear tree

Powershell, 487 451

0..11 | % {
   'On the {0} day of christmas my true love gave to me {1}'-f
   (
        'first^second^third^fourth^fifth^sixth^seventh^eighth^ninth^tenth^eleventh^twelfth'.Split('^')[$_],
        (
            'a partridge in a pear tree^two turtle doves and^three french hens^four calling birds^five golden rings^six geese-a-laying^Seven swans-a-swimming^Eight maids-a-milking^Nine ladies dancing^Ten lords-a-leaping^Eleven pipers piping^Twelve drummers drumming'.Split('^')[$_..0]-join' '
        )
    )
 }

Thank you to Daan for the idea of splitting a concatenated string.

I had originally included a switching statement to get the "and" on the partridge for all but the first verse. But, because the question absolves us of punctuation, we can just append the "and" to the doves.

This results in line feeds as follows:

On the first day of christmas my true love gave to me a partridge in a pear tree
On the second day of christmas my true love gave to me two turtle doves and a partridge in a pear tree
On the third day of christmas my true love gave to me three french hens two turtle doves and a partridge in a pear tree
added 23 characters in body
Source Link
Loading
deleted 614 characters in body
Source Link
Loading
Replaced the spelling of Twelveth with Twelfth
Source Link
Loading
added 73 characters in body
Source Link
Loading
added 101 characters in body
Source Link
Loading
added 101 characters in body
Source Link
Loading
Source Link
Loading