Re: Got a tip ?
- To: mathgroup at smc.vnet.net
- Subject: [mg97886] Re: [mg97843] Got a tip ?
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Tue, 24 Mar 2009 05:34:59 -0500 (EST)
- Reply-to: hanlonr at cox.net
f[x_String] := ToCharacterCode[x][[1]] - 96 f["a"] 1 f["A"] -31 f /@ CharacterRange["a", "h"] {1,2,3,4,5,6,7,8} f /@ CharacterRange["A", "H"] {-31,-30,-29,-28,-27,-26,-25,-24} Bob Hanlon On Mon, Mar 23, 2009 at 7:42 AM , Fabrizio wrote: > Hello, > > I want to write a function that translates its argument (which is a > letter of the alphabet) into a numerical value. > > f[a] = 1 > f[b] = 2