Tweeted twitter.com/StackMma/status/712973893909217280
4 added 32 characters in body
source | link

(Edit: I mean 'differentiate' as in telling the difference between two things, not as in f'(x) )

I have n series of numbers, let's say two for example, with some "empty" spaces between the numbers, and I want to add them element-wise. The problem is, I need to differentiate between the numbers, which can include 0, and the empty spaces, so I cannot use 0 as a placeholder in the empty spaces.

For example, using 'E' as the empty space character (to clarifyedit: oops forgot E was a built-in symbol, it doesn't HAVE tocan be Esomething else), 'adding' the following two series (in reality, they'd be much longer and be more than two series being added):

{-2, E, E, 0, E, -1, E}
{-1, E, 0, E, E,  1, 5}

I want to get

{-3, E, 0, 0, E,  0, 5}

So basically, the rules are:

In the ith position of the series (1D Tables) being added:

  1. If all the members are 'E', then put 'E' in the ith position of the result series

  2. Otherwise, add the numbers like normal, ignoring the Es

So now that I've defined what I'm wanting to do, can anyone think of an elegant way to implement it? Only thing I can think of is by defining my own custom adding function, but it seems like there should be a more clever way to do it?

Thanks.

(Edit: I mean 'differentiate' as in telling the difference between two things, not as in f'(x) )

I have n series of numbers, let's say two for example, with some "empty" spaces between the numbers, and I want to add them element-wise. The problem is, I need to differentiate between the numbers, which can include 0, and the empty spaces, so I cannot use 0 as a placeholder in the empty spaces.

For example, using 'E' as the empty space character (to clarify, it doesn't HAVE to be E), 'adding' the following two series (in reality, they'd be much longer and be more than two series being added):

{-2, E, E, 0, E, -1, E}
{-1, E, 0, E, E,  1, 5}

I want to get

{-3, E, 0, 0, E,  0, 5}

So basically, the rules are:

In the ith position of the series (1D Tables) being added:

  1. If all the members are 'E', then put 'E' in the ith position of the result series

  2. Otherwise, add the numbers like normal, ignoring the Es

So now that I've defined what I'm wanting to do, can anyone think of an elegant way to implement it? Only thing I can think of is by defining my own custom adding function, but it seems like there should be a more clever way to do it?

Thanks.

(Edit: I mean 'differentiate' as in telling the difference between two things, not as in f'(x) )

I have n series of numbers, let's say two for example, with some "empty" spaces between the numbers, and I want to add them element-wise. The problem is, I need to differentiate between the numbers, which can include 0, and the empty spaces, so I cannot use 0 as a placeholder in the empty spaces.

For example, using 'E' as the empty space character (edit: oops forgot E was a built-in symbol, it can be something else), 'adding' the following two series (in reality, they'd be much longer and be more than two series being added):

{-2, E, E, 0, E, -1, E}
{-1, E, 0, E, E,  1, 5}

I want to get

{-3, E, 0, 0, E,  0, 5}

So basically, the rules are:

In the ith position of the series (1D Tables) being added:

  1. If all the members are 'E', then put 'E' in the ith position of the result series

  2. Otherwise, add the numbers like normal, ignoring the Es

So now that I've defined what I'm wanting to do, can anyone think of an elegant way to implement it? Only thing I can think of is by defining my own custom adding function, but it seems like there should be a more clever way to do it?

Thanks.

3 added 38 characters in body
source | link

(Edit: I mean 'differentiate' as in telling the difference between two things, not as in f'(x) )

I have n series of numbers, let's say two for example, with some "empty" spaces between the numbers, and I want to add them element-wise. The problem is, I need to differentiate between the numbers, which can include 0, and the empty spaces, so I cannot use 0 as a placeholder in the empty spaces.

For example, using 'E' as the empty space character (to clarify, it doesn't HAVE to be E), 'adding' the following two series (in reality, they'd be much longer and be more than two series being added):

{-2, E, E, 0, E, -1, E}
{-1, E, 0, E, E,  1, 5}

I want to get

{-3, E, 0, 0, E,  0, 5}

So basically, the rules are:

In the ith position of the series (1D Tables) being added:

  1. If all the members are 'E', then put 'E' in the ith position of the result series

  2. Otherwise, add the numbers like normal, ignoring the Es

So now that I've defined what I'm wanting to do, can anyone think of an elegant way to implement it? Only thing I can think of is by defining my own custom adding function, but it seems like there should be a more clever way to do it?

Thanks.

(Edit: I mean 'differentiate' as in telling the difference between two things, not as in f'(x) )

I have n series of numbers, let's say two for example, with some "empty" spaces between the numbers, and I want to add them element-wise. The problem is, I need to differentiate between the numbers, which can include 0, and the empty spaces, so I cannot use 0 as a placeholder in the empty spaces.

For example, using 'E' as the empty space character, 'adding' the following two series (in reality, they'd be much longer and be more than two series being added):

{-2, E, E, 0, E, -1, E}
{-1, E, 0, E, E,  1, 5}

I want to get

{-3, E, 0, 0, E,  0, 5}

So basically, the rules are:

In the ith position of the series (1D Tables) being added:

  1. If all the members are 'E', then put 'E' in the ith position of the result series

  2. Otherwise, add the numbers like normal, ignoring the Es

So now that I've defined what I'm wanting to do, can anyone think of an elegant way to implement it? Only thing I can think of is by defining my own custom adding function, but it seems like there should be a more clever way to do it?

Thanks.

(Edit: I mean 'differentiate' as in telling the difference between two things, not as in f'(x) )

I have n series of numbers, let's say two for example, with some "empty" spaces between the numbers, and I want to add them element-wise. The problem is, I need to differentiate between the numbers, which can include 0, and the empty spaces, so I cannot use 0 as a placeholder in the empty spaces.

For example, using 'E' as the empty space character (to clarify, it doesn't HAVE to be E), 'adding' the following two series (in reality, they'd be much longer and be more than two series being added):

{-2, E, E, 0, E, -1, E}
{-1, E, 0, E, E,  1, 5}

I want to get

{-3, E, 0, 0, E,  0, 5}

So basically, the rules are:

In the ith position of the series (1D Tables) being added:

  1. If all the members are 'E', then put 'E' in the ith position of the result series

  2. Otherwise, add the numbers like normal, ignoring the Es

So now that I've defined what I'm wanting to do, can anyone think of an elegant way to implement it? Only thing I can think of is by defining my own custom adding function, but it seems like there should be a more clever way to do it?

Thanks.

2 added 100 characters in body
source | link

(Edit: I mean 'differentiate' as in telling the difference between two things, not as in f'(x) )

I have n series of numbers, let's say two for example, with some "empty" spaces between the numbers, and I want to add them element-wise. The problem is, I need to differentiate between the numbers, which can include 0, and the empty spaces, so I cannot use 0 as a placeholder in the empty spaces.

For example, using 'E' as the empty space character, 'adding' the following two series (in reality, they'd be much longer and be more than two series being added):

{-2, E, E, 0, E, -1, E}
{-1, E, 0, E, E,  1, 5}

I want to get

{-3, E, 0, 0, E,  0, 5}

So basically, the rules are:

In the ith position of the series (1D Tables) being added:

  1. If all the members are 'E', then put 'E' in the ith position of the result series

  2. Otherwise, add the numbers like normal, ignoring the Es

So now that I've defined what I'm wanting to do, can anyone think of an elegant way to implement it? Only thing I can think of is by defining my own custom adding function, but it seems like there should be a more clever way to do it?

Thanks.

I have n series of numbers, let's say two for example, with some "empty" spaces between the numbers, and I want to add them element-wise. The problem is, I need to differentiate between the numbers, which can include 0, and the empty spaces, so I cannot use 0 as a placeholder in the empty spaces.

For example, using 'E' as the empty space character, 'adding' the following two series (in reality, they'd be much longer and be more than two series being added):

{-2, E, E, 0, E, -1, E}
{-1, E, 0, E, E,  1, 5}

I want to get

{-3, E, 0, 0, E,  0, 5}

So basically, the rules are:

In the ith position of the series (1D Tables) being added:

  1. If all the members are 'E', then put 'E' in the ith position of the result series

  2. Otherwise, add the numbers like normal, ignoring the Es

So now that I've defined what I'm wanting to do, can anyone think of an elegant way to implement it? Only thing I can think of is by defining my own custom adding function, but it seems like there should be a more clever way to do it?

Thanks.

(Edit: I mean 'differentiate' as in telling the difference between two things, not as in f'(x) )

I have n series of numbers, let's say two for example, with some "empty" spaces between the numbers, and I want to add them element-wise. The problem is, I need to differentiate between the numbers, which can include 0, and the empty spaces, so I cannot use 0 as a placeholder in the empty spaces.

For example, using 'E' as the empty space character, 'adding' the following two series (in reality, they'd be much longer and be more than two series being added):

{-2, E, E, 0, E, -1, E}
{-1, E, 0, E, E,  1, 5}

I want to get

{-3, E, 0, 0, E,  0, 5}

So basically, the rules are:

In the ith position of the series (1D Tables) being added:

  1. If all the members are 'E', then put 'E' in the ith position of the result series

  2. Otherwise, add the numbers like normal, ignoring the Es

So now that I've defined what I'm wanting to do, can anyone think of an elegant way to implement it? Only thing I can think of is by defining my own custom adding function, but it seems like there should be a more clever way to do it?

Thanks.

1
source | link