I like the boolean variant of replace:

replace1by1=: 3 : 0
   'toreplace replacement target'=. y
   (toreplace=target)}target,:replacement
)

   replace1by1 'e';'X';'Replace one element by another'
RXplacX onX XlXmXnt by anothXr

   $mat=. ><;._1 ' Replace one element by another'
5 7

   replace1by1 'e';'X';mat
RXplacX
onX
XlXmXnt
by
anothXr

On Wed, May 25, 2011 at 6:50 AM, bill lam <[email protected]> wrote:

> What you see in jconsole or ide is _not_ the same as that inside J engine.
> For
> example, the character å is one character in ide but it is two bytes in J
> engine, furthermore, J engine has no idea that these two bytes should be
> regarded as a single character, or know that you want them to be
> interpreted in utf8 encoding, or anything special.  So nearly all string
> operations on these non-ascii characters will fail.
>
> There are some articles on unicodes in jwiki, please enter 'unicode' in the
> search box to locate them.  They should provide some background materials.
>
> Срд, 25 Май 2011, Pablo Landherr писал(а):
> > And I get
> >
> >    'qweårtaäasösdf'/:'abcdefghijklmnopqrstuvwxyzåäö' i. 'qweårtaäasösdf'
> > aadefqrsstwå
> >    9!:14 ''
> > j602/2008-03-03/16:45
> >
> > On Wed, May 25, 2011 at 10:00 AM, Gian Medri <[email protected]>
> wrote:
> >
> > > Hi!
> > > 1)  I have a problem with sorting with the Swedish alphabet that
> contains 3
> > > extra letters after z.
> > > Example:
> > >  /:~'qweårtaäasösdf'
> > > aadefqrsstw������
> > >
> > > Perhaps  it depends   on the limitation of "a. "?
> > >
> > > 2) Often I encounter the necessity to replace element x by element y in
> an
> > > array.
> > > I solved the problem in an APL fashion such as:
> > > repl=: 4 : '($y)$ (1{x) (((0{x)=,y)#i.*/$y)},y'  NB. replace x1 in
> array y
> > > by x2
> > >
> > >  This verb works OK for any array, but I wonder if there is a better
> J-way
> > > to do it.
> > >
> > > Thanks
> > > Gian Medri
> > > ----------------------------------------------------------------------
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
> --
> regards,
> ====================================================
> GPG key 1024D/4434BAB3 2008-08-24
> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to