# HP Forums

Full Version: List processing problem HP 50g
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Hello RPL geeks,

I want to program a something which is feed by a list of two dim. vectors (the control points) and has bezier points (as vectors, too) as an output.

The problem for is the input or more precise to get the right three points.

```
The points are po, p1, p2, p3, p4, ...and so on.
Input: {po p1 p2 p3 p4 p5 p6}
I want a to get these lists:
{{po p1 p2} {p2 p3 p4} {p4 p5 p6}} or
{po p1 p2 p2 p3 p4 p4 p5 p6}
```

This can be of course be programmed with direct accessing to the list, but maybe somebody know a method which uses the "parallel" list processing features of the HP 50g.

The three functions "DOLIST", "STREAM" and "SUBSET" don't solve my problem as far I know.

Sincerely
peacecalc

Edited: 28 Jan 2013, 3:52 p.m.

The second list is easy

```\<<
1
\<< NSUB 3 MOD NOT DUPN \>>
DOSUBS
\>>
```
Will duplicate every third element
and from that list
```\<<
3
\<< 3 \->LIST \>>
DOSUBS
\>>
```
Will produce the first list

Cheers, Werner

Hi peacecalc !

Quote:
Input: {po p1 p2 p3 p4 p5 p6}

I want a to get these lists:

{{po p1 p2} {p2 p3 p4} {p4 p5 p6}}

```«
3 « 3 ->LIST NSUB 2 MOD NOT { DROP} IFT » DOSUBS
»
```

```\<<
1
\<< NSUB 3 MOD NOT DUPN \>>
DOSUBS
\>>
```

Excellent ;)

EDIT : oups.... in fact this don't work
Gives : { po p1 p2 p2 p3 p4 p5 p5 p6 }

Edited: 28 Jan 2013, 4:41 p.m.

This produces { { p0 p1 p2 } { p2 p3 p4 } { p5 p5 p6 } } which isn't quite what was requested.

Edited: Note that p5 is duplicated instead of p4.

Edited: 28 Jan 2013, 4:36 p.m.

Hello Gilles Carpentier,

thank you for your fast solution.
I've checked it and it works fine.
For me it was a good lesson in RPL: your little piece of programming gem works in an unusual way. It produce every triple and deletes which are not wanted on the fly. Chapeau!

Normally someone who makes programs (that the way I'm think, too) is avoiding every needless calculation, but here it is the way, which overcomes the obstacle.

Again thank you very much!

Sincerely
peacecalc

P.S.: Also to you Werner, thank you very much for your suggestions, even they aren't working, but they showed the possible way
for a solution!

Edited: 28 Jan 2013, 6:28 p.m.

A similar trick can be used here:

```\<<
3
\<< 3 \->LIST NSUB 2 MOD NOT DROPN \>>
DOSUBS
\>>
```

Cheers, Werner