Thursday, 15 April 2010

post - Postal Code verification in Scheme (Dr. Racket) -



post - Postal Code verification in Scheme (Dr. Racket) -

i writing programme in scheme (dr. racket) verify canadian postal-codes. user inputs postal code , gets response whether valid or not. got boolean logic downwards stumped how tell right format is.

ex. (valid-postal-code? n2l 3g1) => true

how do this?

thanks

if want know if string has format of valid postal code, can utilize regular expression. canadian postal codes consist of 6 characters, alternating letters , digits origin letter, space embedded between 3rd , 4th characters. suitable regular look ^[a-z][0-9][a-z] [0-9][a-z][0-9]$.

if want know if string valid format on list of postal codes, easiest solution bloom filter. provide bloom filter, written in scheme, @ my blog.

post scheme racket postal-code

No comments:

Post a Comment