Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4587

Re: Replace

From Peter Breitfeld <phbrf@t-online.de>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Replace
Date 2011-08-26 09:31 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j37p5b$4k8$1@smc.vnet.net> (permalink)
References <j35am1$og8$1@smc.vnet.net>

Show all headers | View raw


One possibility might be:

barF[{x_,y_}]:=Row[{"(", x, "|", y, ")"}]

{5,6}//barF    gives (5|6)

In:= barF/@{{5, 6}, {5, 8}, {-3, x}, {y, 1/2}}
Out= {(5|6),(5|8),(-3|x),(y|1/2)}

But you know, that you can use this for display only.

Sam Korn wrote:

> Hi, another stupid question. I have a list, and each element in the list is
> a sublist with a pair of integers. How do I replace each element along the
> lines of "{5,6}" with "(5|6)"?
>
> I know it's a stupid question, and there's probably something really obvious
> I'm missing, but I'm really new to Mathematica.
>
> Thanks!
> -Sam

-- 
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Replace Sam Korn <sam@kornfamily.com> - 2011-08-25 11:12 +0000
  Re: Replace Ray Koopman <koopman@sfu.ca> - 2011-08-26 09:27 +0000
  Re: Replace "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-08-26 09:30 +0000
  Re: Replace Peter Breitfeld <phbrf@t-online.de> - 2011-08-26 09:31 +0000
  Re: Replace Armand Tamzarian <mike.honeychurch@gmail.com> - 2011-08-26 09:33 +0000
    Re: Replace Armand Tamzarian <mike.honeychurch@gmail.com> - 2011-08-27 12:22 +0000
      Re: Replace Peter Pein <petsie@dordos.net> - 2011-08-28 08:09 +0000
    Re: Replace Armand Tamzarian <mike.honeychurch@gmail.com> - 2011-08-29 07:49 +0000
  Re: Replace Peter Pein <petsie@dordos.net> - 2011-08-26 09:35 +0000
  Re: Replace Murray Eisenberg <murray@math.umass.edu> - 2011-08-27 12:25 +0000
    Re: Replace Ray Koopman <koopman@sfu.ca> - 2011-08-28 08:06 +0000
  Re: Replace Murray Eisenberg <murray@math.umass.edu> - 2011-08-28 08:13 +0000

csiph-web