digitalmars.D.learn - S-Expressions
- qznc (5/5) Jan 22 2013 After "Atomic Updates" from rosettacode.org, here is
- bearophile (4/5) Jan 23 2013 See RosettaCode, only a little reformatting, cleaning, etc.
- bearophile (4/4) Jan 23 2013 We are getting to the Mathematica again:
- qznc (3/7) Jan 24 2013 We're even now ;)
- bearophile (17/19) Jan 24 2013 I have cut some lines, and I have used a more functional style,
- qznc (4/22) Jan 24 2013 I completely agree. The functional style is better and I miss
After "Atomic Updates" from rosettacode.org, here is "S-Expressions". Problem: http://rosettacode.org/wiki/S-Expressions Code: http://dpaste.dzfl.pl/fd485808 Comments, improvements?
Jan 22 2013
qznc:Comments, improvements?See RosettaCode, only a little reformatting, cleaning, etc. Bye, bearophile
Jan 23 2013
We are getting to the Mathematica again: http://rosettacode.org/wiki/Rosetta_Code/Rank_languages_by_popularity Bye, bearophile
Jan 23 2013
On Wednesday, 23 January 2013 at 17:49:23 UTC, bearophile wrote:We are getting to the Mathematica again: http://rosettacode.org/wiki/Rosetta_Code/Rank_languages_by_popularity Bye, bearophileWe're even now ;) http://rosettacode.org/wiki/Rosetta_Code/Rank_languages_by_popularity#D
Jan 24 2013
qznc:We're even now ;) http://rosettacode.org/wiki/Rosetta_Code/Rank_languages_by_popularity#DI have cut some lines, and I have used a more functional style, that fits well for this entry. Compared to the C++ entry this D entry is nicer. I greatly prefer the "verbose" option of the Python regex. And "g" for regexes should be the default. This D code: auto pairs = categories.match(r2) .filter!(m => languages.canFind(m[1]))() .map!(m => tuple(m[2].to!uint(), m[1].dup))() .array(); With a Python-like syntax becomes nicer: auto pairs = [(r.to!uint, l.dup) for l,r in categories.match(r2) if l in languages]; Bye, bearophile
Jan 24 2013
On Friday, 25 January 2013 at 01:52:27 UTC, bearophile wrote:qznc:I completely agree. The functional style is better and I miss list comprehensions as well. It does not require new keywords, so maybe it can be added to D at some point.We're even now ;) http://rosettacode.org/wiki/Rosetta_Code/Rank_languages_by_popularity#DI have cut some lines, and I have used a more functional style, that fits well for this entry. Compared to the C++ entry this D entry is nicer. I greatly prefer the "verbose" option of the Python regex. And "g" for regexes should be the default. This D code: auto pairs = categories.match(r2) .filter!(m => languages.canFind(m[1]))() .map!(m => tuple(m[2].to!uint(), m[1].dup))() .array(); With a Python-like syntax becomes nicer: auto pairs = [(r.to!uint, l.dup) for l,r in categories.match(r2) if l in languages];
Jan 24 2013