Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #15122
| From | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Define function using lists or tables |
| Date | 2013-07-03 22:04 +0000 |
| Message-ID | <kr274g$8u6$1@smc.vnet.net> (permalink) |
| References | <20130703085846.4E7676A7B@smc.vnet.net> |
| Organization | Time-Warner Telecom |
data = Partition[CharacterRange["a", "z"], 2];
Clear[f]
Set[f[#[[1]]], #[[2]]] & /@ data;
?f
Bob Hanlon
On Wed, Jul 3, 2013 at 4:58 AM, Joaquim Nogueira <jen@fct.unl.pt> wrote:
> Hello. Possibly this is a very simple question.
>
> Is there a way to define a function over a (BIG) list of ordered pairs? I
> mean, suppose that I have a list, created using a Table command or
> something like that, of the form [{a,b},{c,d},etc.] such that, after naming
> it f, say, f = [{a,b},{c,d},etc.], then, afterwards, whenever there is a
> command such that one needs to compute f[a] (or f[c]), the program
> immediately replaces f[a] by b,and f[c] by d?
>
> Thank you.
>
>
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: Define function using lists or tables Bob Hanlon <hanlonr357@gmail.com> - 2013-07-03 22:04 +0000
csiph-web