[Jprogramming] Quora Challenge
Jimmy Gauvin
jimmy.gauvin at gmail.com
Tue Sep 19 02:58:25 UTC 2017
To answer "There's got to be an easier way to list the interim values of
insert"
g/\.19 29 59 79 89 109 119 139 149 179 199
4 5 6 12 12 7 4 2 6 1 199
To see what \. does we can use <
<\.i.5
┌─────────┬───────┬─────┬───┬─┐
│0 1 2 3 4│1 2 3 4│2 3 4│3 4│4│
└─────────┴───────┴─────┴───┴─┘
\ is usefull too:
+/\i.5
0 1 3 6 10
<\i.5
┌─┬───┬─────┬───────┬─────────┐
│0│0 1│0 1 2│0 1 2 3│0 1 2 3 4│
└─┴───┴─────┴───────┴─────────┘
On Mon, Sep 18, 2017 at 4:48 PM, Skip Cave <skip at caveconsulting.com> wrote:
>
> Roger does g/ which puts g between each integer. Let's see what is going on
> In the short case:
>
> 19 g 29 g 59 g 79 g 89 g 109 g 119 g 139 g 149 g 179 g 199
>
> 4
>
> Step-by-step...
>
> 179 g 199
> 1
> 149 g 1
> 6
>
o
o
o
> 19 g 5
> 4
>
> So the secret is that Roger's scheme keeps the interim calculation values
> small enough to avoid precision errors.
>
> (There's got to be an easier way to
> list the interim values of insert). My scheme generated large interim
> values which exceeded the precision limit.
>
> Skip>
>
>
More information about the Programming
mailing list