zip is already there, and it's called List.combine. I hadn't noticed this.Also, Robert Pickering, author of the upcoming APress book Foundations of F#, responded on his blog with a short version of the ROT13 algorithm, using only functions already present in the current library:
http://strangelights.com/blog/archive/2006/12/27/1580.aspx
It basically uses
List.mapi instead of my combo of zip, drop and take. List.mapi maps a function over a list, but this function gets as arguments the list element and its index. And mapping over a string is implemented by converting the string to a char array, using Array.map over it and then creating a new string based on the result.

No comments:
Post a Comment