View Problem

Join the elements of a list, separated by commas

Given the list [Apple, Banana, Carrot] produce "Apple, Banana, Carrot"
ExpandDiskEdit
cpp C++/CLI .NET 2.0
String^ result = String::Join(L", ", fruit->ToArray());
ExpandDiskEdit
cpp boost
string fruits[] = {"Apple", "Banana", "Carrot"};
string result = boost::algorithm::join(fruits, ", ");
DiskEdit
csharp .NET 3.5
using System.Collections.Generic;
public class JoinEach {
public static void Main() {
var list = new List<string>() {"Apple", "Banana", "Carrot"};
System.Console.WriteLine( string.Join(", ", list.ToArray()) );
}
}
ExpandDiskEdit
fantom
["Apple", "Banana", "Carrot"].join(", ")
DiskEdit
clojure
(apply str (interpose ", " '("Apple" "Banana" "Carrot")))

Submit a new solution for cpp, csharp, fantom, or clojure
There are 24 other solutions in additional languages (erlang, fsharp, go, groovy ...)