Ask HN: What can you do in one language that can't be done as well in others?
1–10 of 30 posts
Re: Ask HN: What can you do in one language that can't be done as well in others?
#2Re: Ask HN: What can you do in one language that can't be done as well in others?
#3Bash shell script: using pipes → « cat MonFichier | while read LaLigne ; do echo $LaLigne ; done »
http://elixir-lang.org/getting-started/enumerables-and-strea...
Re: Ask HN: What can you do in one language that can't be done as well in others?
#4Re: Ask HN: What can you do in one language that can't be done as well in others?
#5One-line that reads the file, splits multiple lines into an array:
Want to sort them alphabetically? Add sort($l);
Trim them? $trimmed = array_map(trim, $l);
Remove duplicates? $unique = array_unique($trimmed);Re: Ask HN: What can you do in one language that can't be done as well in others?
#6Bash shell script: using pipes → « cat MonFichier | while read LaLigne ; do echo $LaLigne ; done »
Re: Ask HN: What can you do in one language that can't be done as well in others?
#7Re: Ask HN: What can you do in one language that can't be done as well in others?
#8I know PHP isn't very popular here, but it's awesome for string manipulation, parsing files. One-line that reads the file, splits multiple lines into an array: Want to sort them alphabetically? Add sort($l); Trim them? $trimmed = array_map(trim, $l); Remove duplicates? $unique = array_unique($trimmed);
List lines = File.ReadAllLines("/file.txt").Distinct().ToList().Select(l => l.Trim()).Sort();
Re: Ask HN: What can you do in one language that can't be done as well in others?
#9I know PHP isn't very popular here, but it's awesome for string manipulation, parsing files. One-line that reads the file, splits multiple lines into an array: Want to sort them alphabetically? Add sort($l); Trim them? $trimmed = array_map(trim, $l); Remove duplicates? $unique = array_unique($trimmed);
$l = file('in.txt', FILE_IGNORE_NEW_LINES);