But in this case:
20 (6!:2) ',@((,.>:)@*&3)^:(]`(1"_)) 18'
0.0604128
20 (6!:2) ',@((,.>:)@*&3)^:(]`1:) 18'
0.057749
???
Op 02-12-17 om 04:23 schreef Henry Rich:
I see what's happening. 1"_ produces a Boolean, while 1: produces an
integer. In this case the Boolean is better. I'm not s
>> SC =: 3 : '(3 3$4>i.5) ,./^:2@(*/)^:y ,.1'
>
> SC confuses me. I would have thought that
>
> (3 3$4>i.5) (*/)^:y ,.1
The left operand of the power operator ^: is ,./^:2@(*/) .
> I claim the examples in my message unambiguously specify the extended H
> problem. More details (and solutions) ca
> On Dec 1, 2017, at 10:13 PM, Dabrowski, Andrew John
> wrote:
>
> I don't want to sound like a shill for Mathematica, but it's a great
> package with a great ecosystem; it's just obscenely expensive.
It's really beautiful. I have seen videos about it, I love the notebook idea
(Jupyter is
> On Dec 1, 2017, at 10:44 PM, Linda Alvord wrote:
>
> How do you know what form the data must be entered in?
The nice thing about this contest is you can kind of worry about this as much
as you want; they put data in files for you, but you just paste the answer into
the web form. They have
Thanks to everyone for sharing solutions yesterday and especially to those with
advice for me, I really appreciate it!
Today's problem has to do with computing checksums. Like yesterday, the first
part and the second part bear some kind of family resemblance that you can
probably leverage; my f
How do you know what form the data must be entered in?
I guess h would be better than g, but it looked like the data was boxed.
g=: 13 :'+/10#.inv ".(y=1|.y)#y'
g ''
4
h=: 13 :'+/((10#.inv y)=1|.10#.inv y)#10#.inv y'
h
4
g
[: +/ 10 #.^:_1 [: ". ] #~ ] = 1 |. ]
h
[: +/ ((1
On 12/01/2017 01:20 AM, Roger Hui wrote:
> Cantor =: 3 : ', 1 0 1 */^:y ,1'
> SC =: 3 : '(3 3$4>i.5) ,./^:2@(*/)^:y ,.1'
Nice! The first algorithm can easily be implemented in Mathematica with
cantor2[n_] := Nest[Flatten@Outer[Times, #, {1, 0, 1}] &, {1}, n]
Mathematica also allows many solu
Qt ide dropped support for jtag. Use find in file should be more intuitive
in ide.
If you use jconsole, then jtag may be useful.
On Dec 2, 2017 11:30 AM, "Scott Locklin" wrote:
> I'm certain that we had a jtags script once upon a time in addons/general.
>
> I generally don't need such things, b
for 2,
a better option (IMO) than returning empty for a side effect function is to
return y. This lets you insert side-effects into any "composition".
From: "Dabrowski, Andrew John"
To: "programm...@jsoftware.com"
Sent: Friday, December 1, 2017 8:04 PM
Subj
It looks like j701 and j801 had jtags. These were system specific:
http://www.jsoftware.com/jal/j701/addons/
http://www.jsoftware.com/jal/j801/addons/
The wiki suggests that no one bothered to implement a j native
implementation, though I think it wouldn't be difficult:
http://code.jsoftware.com
I don't think we should be shooting for always. If you need a complex
1, for example, it can sometimes make sense to pre-generate a complex
1 to avoid conversion costs.
But using the most compact form does seem to be consistent with the
rest of the system.
Thanks,
--
Raul
On Fri, Dec 1, 2017
I'm certain that we had a jtags script once upon a time in addons/general.
I generally don't need such things, but I've been using ctags for
another project; is there a pointer to the old code?
-Scott
--
For information abou
I see what's happening. 1"_ produces a Boolean, while 1: produces an
integer. In this case the Boolean is better. I'm not sure whether it
always would be; what do you think?
Henry Rich
On 12/1/2017 9:12 AM, Raul Miller wrote:
Huh...
I can reproduce that 10x speed difference:
timespac
Oh, I missed that, thanks.
On 12/01/2017 09:33 PM, bill lam wrote:
> 3. Should already open during indirect assignments, no need to unbox again.
>
> On Dec 2, 2017 9:04 AM, "Dabrowski, Andrew John"
> wrote:
>
>> 1. How does one test whether an object is string?
>>
>> 2. I now know that J doesn't
A little late, but mine appears to be similar
day1a =: [: +/ "."0 @ (] #~ 1&|. = ])
day1b =: [: +/ "."0 @ (] #~ (|.~ (2%~#)) = ])
assert 3 -: day1a '1122'
assert 4 -: day1a ''
assert 6 -: day1b '1212'
assert 4 -: day1b '123425'
assert 12 -: day1b '123123'
assert 4 -: day1b '12131415'
1.
datatype 'abc'
literal
3!:0 'abc'
2
Strings can also include 2- and 4-byte types, for which 3!:0 returns
131072 and 262144; so a complete test for string would be
(2 131072 262144 e.~ 3!:0)
2. Correct. You can return an empty value.
3. You don't need
num =. > num
etc.
Multiple
1. What do you mean by "an object is string"?
This might do it:
isString=: ' '= 1{.0{.,
But note that this approach ignores the number of dimensions of the
value (and don't get me started on "objects").
2. You can perform side effects to your heart's content, and you can
return a value like E
3. Should already open during indirect assignments, no need to unbox again.
On Dec 2, 2017 9:04 AM, "Dabrowski, Andrew John"
wrote:
> 1. How does one test whether an object is string?
>
> 2. I now know that J doesn't support nullary functions. It also seems
> that J doesn't allow functions that
1. How does one test whether an object is string?
2. I now know that J doesn't support nullary functions. It also seems
that J doesn't allow functions that don't return any value (i.e. for the
side effects), correct?
3. Suppose I want to define a dyadic function in which the y variable
contai
Perhaps also worth noting:
10.inv 1234
1 2 3 4
10.inv 123456789
1 2 3 4 5 6 7 8 9
10.inv 123456789012345678x
1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8
Thanks,
--
Raul
On Fri, Dec 1, 2017 at 12:49 AM, Daniel Lyons wrote:
> The problem statement has to do with summing up digits in a l
Andrew Dabrowski: Since you are a self-confessed "newbie", in my original
code I tried to be as straightforward as I can make it. The follow-up
posts by others is typical of what happens in this community/forum. I
guess it's one of the features of J/APL -- people study different ways of
solving
For those interested. The relation with A005836 is:
e.g.
A005836=:,@((,.>:)@*&3)^:(]`(0"_))
ts 'Q=.1 (2* ,@((,.>:)@*&3)^:(]`(0"_)) 18)} (3^18)$0'
0.138805 5.45267e8
Q-:c1 18
1
Op 01-12-17 om 13:23 schreef Arie Groeneveld:
Another iterator:
(slower and fatter)
,@(,0,:])^:(]`(1"_))
.
Sure does. Put it on the bug list & I'll fix it when I have some time.
Henry Rich
On 12/1/2017 9:12 AM, Raul Miller wrote:
Huh...
I can reproduce that 10x speed difference:
timespacex 'c0 17'
0.078233 2.01328e8
timespacex 'c01 17'
0.761976 1.61061e9
c0
,@((1 0 1 */ ])^:(]`(1"_)))
indeed!
On 01/12/2017 14:12, Raul Miller wrote:
Huh...
I can reproduce that 10x speed difference:
timespacex 'c0 17'
0.078233 2.01328e8
timespacex 'c01 17'
0.761976 1.61061e9
c0
,@((1 0 1 */ ])^:(]`(1"_)))
c01
,@((1 0 1 */ ])^:(]`1:))
This seems bizarre.
Thanks,
---
Thi
Huh...
I can reproduce that 10x speed difference:
timespacex 'c0 17'
0.078233 2.01328e8
timespacex 'c01 17'
0.761976 1.61061e9
c0
,@((1 0 1 */ ])^:(]`(1"_)))
c01
,@((1 0 1 */ ])^:(]`1:))
This seems bizarre.
Thanks,
--
Raul
On Fri, Dec 1, 2017 at 8:53 AM, 'Mike Day' via Programmi
In case Arie doesn't get round to it, I note that your (Raul's) msg below
is timed here, in my GMT time-zone, as
"Fri, 1 Dec 2017 08:10:13 -0500"
while Arie's comparison between verbs c0 and c1 is timed as
"Fri, 1 Dec 2017 12:53:58 +0100" - NL presumably.
In case it's disappeared from your inb
I can find a message where you used 1: in the expression, but I
haven't found any message from you where you talk about 1: vs. 1"_ -
is it possible I have not received it yet?
Thanks,
--
Raul
On Fri, Dec 1, 2017 at 7:59 AM, Arie Groeneveld
wrote:
>
>
> Op 01-12-17 om 13:55 schreef Raul Miller:
Op 01-12-17 om 13:55 schreef Raul Miller:
That gerund form of ^: is cute. I need to remember and use it.
That said, note that you can shorten it slightly:
,@(,0,:])^:(]`1:)
See my previous message about the use of 1: and 1"_
--
That gerund form of ^: is cute. I need to remember and use it.
That said, note that you can shorten it slightly:
,@(,0,:])^:(]`1:)
You can also rearrange it, if you want:
(,@,0,:])^:(]`1:)
Or,
(,0&*,])^:(]`1:)
Or you could use 0"0 instead of 0&* (but why would you do that?).
I still p
Actually, J gives you an easy way of making those particular expressions tacit.
For example, +/ a #~ a = (-: $ a) |. a can be made tacit by replacing
a with y and using 13 : on it. If you are particularly lazy, you can
make the replacement the =. mechanism:
13 :'+/ a #~ a = (-: $ a) |. a=.y'
[
Another iterator:
(slower and fatter)
,@(,0,:])^:(]`(1"_))
... and there's an interesting(?) relation with OEIS sequence A005836.
Op 01-12-17 om 12:53 schreef Arie Groeneveld:
How about
c0=:,@((1 0 1 */])^:(]`(1"_)))
5 ts ' c0 18'
0.123306 6.71091e8
compared to:
c01=:,@((1 0 1 */]
Nice, my cantor was longer and more complicated:
Cantor=: (*,0&*,*)^:]`1:@.(0-:])
SC=: 3 :'(,~,.~)^:y,1'
Thanks,
--
Raul
On Fri, Dec 1, 2017 at 1:20 AM, Roger Hui wrote:
> Cantor =: 3 : ', 1 0 1 */^:y ,1'
> SC =: 3 : '(3 3$4>i.5) ,./^:2@(*/)^:y ,.1'
>
> Recursive solutions using the Mathe
How about
c0=:,@((1 0 1 */])^:(]`(1"_)))
5 ts ' c0 18'
0.123306 6.71091e8
compared to:
c01=:,@((1 0 1 */])^:(]`(1:)))
5 ts ' c01 18'
1.23536 5.36871e9
and
5 ts ' c1 18'
0.0948998 6.03985e8
(c0-:c1)18
1
Op 01-12-17 om 10:32 schreef Marshall Lochbaum:
And for computing lar
fwiw, I cribbed some Python code a while ago to achieve a pretty fast
J function.
Unfortunately, I haven't kept a reference to its source, although I do
have notes explaining the algorithm. Virtually the same code may be used
to derive the sum of primes less than some limit. Perhaps surprisi
And for computing large Cantor sets really fast, you can use a recursive
method:
c0 =. 3 :', */&1 0 1^:y 1'
c1 =. 3 :', (*/~(3^y-2^l)&{.) , */~^:(l=.<.2^.y) 1 0 1'
(c0 -: c1) 18
1
10 (6!:2) 'c0 18'
1.22999
10 (6!:2) 'c1 18'
0.0728543
The J solution makes it easy to figure this out,
35 matches
Mail list logo