The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Define function using lists or tables
Replies: 1   Last Post: Jul 3, 2013 6:04 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Bob Hanlon

Posts: 906
Registered: 10/29/11
Re: Define function using lists or tables
Posted: Jul 3, 2013 6:04 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

data = Partition[CharacterRange["a", "z"], 2];


Set[f[#[[1]]], #[[2]]] & /@ data;


Bob Hanlon

On Wed, Jul 3, 2013 at 4:58 AM, Joaquim Nogueira <> 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.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.