MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Got a tip ?

  • To: mathgroup at
  • Subject: [mg97900] Re: Got a tip ?
  • From: Alexei Boulbitch <Alexei.Boulbitch at>
  • Date: Wed, 25 Mar 2009 05:43:10 -0500 (EST)


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

Try this:

myCrypt[x_] := Module[{lst},
   lst = CharacterRange["a", "z"] // ToExpression;
       (Position[lst, x] // Flatten)[[1]] ];

Alexei Boulbitch, Dr., habil.
Senior Scientist

ZAE Weiergewan
11, rue Edmond Reuter
L-5326 Contern

Phone: +352 2454 2566
Fax:   +352 2454 3566


This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.

  • Prev by Date: Re: solving nonlinear simultaneous equations
  • Next by Date: Re: SetDelayed::write ... [x_] is protected
  • Previous by thread: Re: Got a tip ?
  • Next by thread: Re: Got a tip ?