I do not see any attempt in the question at generalizing—so technically the
answer would be a number.
But I expect that easy to describe (but accurate) general approaches would
fit right in...
Thanks,
—
Raul
On Tuesday, August 14, 2018, Jose Mario Quintana <
jose.mario.quint...@gmail.com> wrote
After I saw your message I searched for the particular Quora problem and
this is what I found,
https://www.quora.com/What-number-must-be-subtracted-from-21-38-55-and-106-each-so-that-the-remainders-technically-differences-are-proportional
It seems to me that the shape of the array is restricted t
It should work on arrays of the form
a + b * i, where a and b are integer scalars, and i is an integer vector.
So, if
q=: 6 + 7*1 2 5 11 23,
applying this function yields
(-/ .* % -/ .+)@:(2 2&$) q
7.4
I think you need instead something like
Difference’s greatest common divisor,
That post did not travel well; trying again,
(-/ .* % -/ .+)@:(2 2&$)21 38 55 106
4
On Tue, Aug 14, 2018 at 5:30 PM, Jose Mario Quintana <
jose.mario.quint...@gmail.com> wrote:
>
> A direct solution without the assumption that the solution is a whole
> number
>
> .
>
> .
>
> .
>
> (-/ .* %
A direct solution without the assumption that the solution is a whole number
.
.
.
(-/ .* % -/ .+)@:(2 2&$) 21 38 55 106 4
On Tue, Aug 14, 2018 at 1:37 PM, Jose Mario Quintana <
jose.mario.quint...@gmail.com> wrote:
> A brute-force approach assuming that the solution is a whole number, and
I have had success creating shim / interface DLLs that use a simpler, more
portable interface strings or binary data (e.g. xml, json, msgpack[1])
instead of trying to lay things out in memory perfectly between J and C.
Your shim DLL can take the json / xml or whatever and then parse it into
the C s
You need to understand something about C to approach this problem.
A big issue is that C structs have implementation specific rules about
how they are laid out in memory.
So that means either (a) studying how the C implementation lays out
that struct in memory so you can write to memory directly,
Dear J community,
I am a novice. This is my first time posting here.
I have a C function of the following type
int parser(const char *str, Block *blck);
where Block is a struct that has a nested array of structs. I would like to
call this parsing function in J via a DLL. I have asked a question
A brute-force approach assuming that the solution is a whole number, and I
am understanding the problem correctly, follows after a few blank lines...
((0 = -/ .*@:(2 2$21 38 55 106 - ])"0) # ]) i.111
4
Checking,
-/ .* (2 2$21 38 55 106 - 4)
0
Indeed, 17 is a commo
Spot the non-deliberate editing error!
M
On 14/08/2018 16:16, Mike Day wrote:
How about these snapshots?
q =: 21, 38, 55, 106
}.+/\inv q NB. 1st differences
21 17 17 51
+./}.+/\inv q NB. gcd of 1st diffs
17
NB. or
2 -/\ q
_17 _17 _51
+./2 -/\ q
17
17|q NB. So, wha
How about these snapshots?
q =: 21, 38, 55, 106
}.+/\inv q NB. 1st differences
21 17 17 51
+./}.+/\inv q NB. gcd of 1st diffs
17
NB. or
2 -/\ q
_17 _17 _51
+./2 -/\ q
17
17|q NB. So, what is the required offset?
4 4 4 4
17%~ q-4 NB. what are the required factors
Try set TabWidth=4 in the config, restart J so it picks up the setting,
then in the terminal:
(TAB,'123') fwrite '~temp/t1.ijs'
In the editor, open the script and it should show 4 spaces before the '123'.
On Tue, Aug 14, 2018 at 5:46 AM Don Guinn wrote:
> Under Edit/Configure/QT ide I foun
Brute force.
>:I.1=(#@~.)"1(>:i.21)|/21 38 55 106
1 17
17|21 38 55 106
4 4 4 4
On Tue, Aug 14, 2018 at 12:08 AM Skip Cave wrote:
> Attempting to solve the following Quora problem:
>
> What number must be subtracted from 21, 38, 55, and 106 each so that the
> remainders (technically differenc
Under Edit/Configure/QT ide I found TabWidth. It was blank. I assigned it a
value of 2. Then edited a file and put a tab at the beginning. It showed up
as one space in the editor but when I loaded the script and viewed it the
tab took 2 spaces. It was still a tab. It was not converted to spaces.
O
14 matches
Mail list logo