Hi all!
I was a bit curious, so I ran some tests.
ts=: 6!:2 , 7!:2@]
NB. Raul
RaulResult=. (#~ 1- +./@e.&'7890'@":"0) 1000+i.8999
NB. Jimmy
JimmyResult=.(3 : '(0=+/"(1)7 8 9 0 e.~10 10 10 10 #: y)#y') 1000+i.8999
NB. Marshall1
Marshall1Result =. ,(+/~10&*)/ 4#,:>:i.6
NB. Marshall2
Marshall2Result =. ,+// (10<.@^i._4)*/>:i.6
NB. DonQuinn
DonQuinnResult=. 10#.>:6 6 6 6#:i.6^4
NB. Cliff Reiter
CliffReiterResult=. ,".>{4#<'123456'
NB. Jimmy2
Jimmy2Result=.,10#.>{4#<>:i.6
6^4
1296
$RaulResult
1296
10{./:~ RaulResult
1111 1112 1113 1114 1115 1116 1121 1122 1123 1124
_10{./:~ RaulResult
6653 6654 6655 6656 6661 6662 6663 6664 6665 6666
(/:~ RaulResult) -: /:~ JimmyResult
1
(/:~ RaulResult) -: /:~ Marshall1Result
1
(/:~ RaulResult) -: /:~ Marshall2Result
1
(/:~ RaulResult) -: /:~ DonQuinnResult
1
(/:~ RaulResult) -: /:~ CliffReiterResult
1
(/:~ RaulResult) -: /:~ Jimmy2Result
1
NB. Raul
100 ts'(#~ 1- +./@e.&''7890''@":"0) 1000+i.8999'
0.00293102 300416
NB. Jimmy
100 ts'(3 : ''(0=+/"(1)7 8 9 0 e.~10 10 10 10 #: y)#y'') 1000+i.8999'
0.000982846 896896
NB. Marshall1
100 ts',(+/~10&*)/ 4#,:>:i.6'
6.39742e_6 23168
NB. Marshall2
100 ts',+// (10<.@^i._4)*/>:i.6'
3.92141e_6 23296
NB. DonQuinn
100 ts'10#.>:6 6 6 6#:i.6^4'
0.000136758 101760
NB. Cliff Reiter
100 ts',".>{4#<''123456'''
0.000582533 210176
NB. Jimmy2
100 ts',10#.>{4#<>:i.6'
0.000128068 267648
Cheers,
Erling Hellenäs
Den 2017-10-04 kl. 07:15, skrev 'Skip Cave' via Programming:
Wow! brilliant solutions! It will take me a couple of days to parse through
these diverse approaches to solving the Digits problem. One of the aspects
of J that I appreciate the most is the wide range of creative approaches
that seem to materialize when multiple people use J to solve the same
problem. This has been apparent on several of the challenges I have posted
on this forum.
I learn as much by studying how experts approach these simple problems as I
do by reading the J doc. In some ways this problem-solving approach is
even better for learning, as it shows how experts build (mostly tacit) J
code to craft solutions.
I still have problems decoding complex tacit expressions, let alone
building them myself, so decoding these problem solutions has helped a
great deal in improving my J skills. Henry Rich's marvelous Dissect tool
has also been a great help in this endeavor.
Skip
On Tue, Oct 3, 2017 at 11:05 PM, Jimmy Gauvin <[email protected]>
wrote:
Variant on the cheat:
zz=.,10#.>{4#<>:i.6
4{.zz
1111 1112 1113 1114
On Tue, Oct 3, 2017 at 11:24 PM, Roger Hui <[email protected]>
wrote:
V. nice.
As they say, if you're not cheating you are not trying hard enough. :-)
On Tue, Oct 3, 2017 at 8:21 PM, Cliff Reiter <[email protected]>
wrote:
A cheat (?) that builds instead of "removing"
z=.,".>{4#<'123456'
$z
1296
10{.z
1111 1112 1113 1114 1115 1116 1121 1122 1123 1124
On 10/3/2017 4:16 PM, Skip Cave wrote:
Another interesting Quora problem:
Given the integers from 1000 to 9999, remove all integers that
contain a
7,
8, 9, or zero, and list the remaining integers.
Skip
------------------------------------------------------------
----------
For information about J forums see http://www.jsoftware.com/
forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm