Here are some things to ponder:
]a=:'an easy phrase to check'
an easy phrase to check
]b=:'I''m cheering for connecticut women''s team tonight'
I'm cheering for connecticut women's team tonight
;:a
---T----T------T--T-----┐
│an│easy│phrase│to│check│
L--+----+------+--+------
;:b
--T----------------------------------T-T----T-------┐
│I│'m cheering for connecticut women'│s│team│tonight│
L-+----------------------------------+-+----+--------
All three solutions below depend upon ;: so none will work if the sentence
with quote's in it.
frm=: ({~ ?~@#)&.>&.;:
frm
({~ ?~@#)&.>&.;:
frm a
an syea ahespr to kchec
frm a
an esya rpsaeh to ekhcc
fdwl=: /: ?~@:#
fdwl
/: ?~@:#
fdwl&.>&.;:a
an eyas sahrep ot eckhc
fdwl&.>&.;:a
na esya asprhe ot ceckh
f=: 13 :'>"0 ;:y'
f
[: >"0 ;:
f a
an
easy
phrase
to
check
m=: 13 :'-.'' ''=>"0 ;: y'
m
[: -. ' ' = [: >"0 ;:
m a
1 1 0 0 0 0
1 1 1 1 0 0
1 1 1 1 1 1
1 1 0 0 0 0
1 1 1 1 1 0
v=: 13 :'+/"1 m y'
v
[: +/"1 m
v a
2 4 6 2 5
(m+v?v)a
1 2 0 0 0 0
4 2 1 3 0 0
5 2 4 6 3 1
2 1 0 0 0 0
3 2 4 5 1 0
fla=: 13 :',(((m+v?v)y){"1 '' '',"1 f y),"1 '' '''
fla a
na yase srphea to chcek
fla
[: , ' ' ,"1~ (m + v ? v) {"1 ' ' ,"1 f
fla a
na eays hrpeas ot kcceh
deb
#~ (+. (1: |. (> </\)))@(' '&~:)
deb fla a
na ysea esparh to cckhe
deb fla a
an esya ahersp ot ekhcc
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Linda Alvord
Sent: Sunday, April 01, 2012 3:28 AM
To: 'Programming forum'
Subject: Re: [Jprogramming] Challenge 9 Maddening Madness
Another early approach to the problem.
Linda
-----Original Message-----
From: David Ward Lambert [mailto:[email protected]]
Sent: Monday, March 26, 2012 5:46 PM
To: lindaalvord
Subject: march madness
I found this challenge particularly easy.
scramble=: /: ?.~@:#
scramble&.>&.;:SENTENCE
I kpic eycarsSu ot wni teh mda craMh taomt.eunrn
What is SENTENCE? Also easy.
Dave.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm