06-18-2014, 02:42 AM

In another thread a bit of discussion on code which indirectly involves list processing got me to thinking about how I had implemented my own custom System RPL operations for some specific tasks. NOTE: Used within a library so no type checking included.

1. Instead of ΣLIST, for a list of reals I have a very simple substitution:

2. Multiply corresponding elements of reals in two lists, instead of x*, for example

{ 1. 2. 3. } { 4. 5. 6. } x* = { 4. 10. 18. }

Wondering if anyone had done similar implementations, and if so I'd be curious to compare.

Jacob

1. Instead of ΣLIST, for a list of reals I have a very simple substitution:

Code:

`::`

INNERCOMP

ZERO

#=casedrop

%0

DUP#1=

caseDROP

ONE_DO (DO)

%+

LOOP

;

2. Multiply corresponding elements of reals in two lists, instead of x*, for example

{ 1. 2. 3. } { 4. 5. 6. } x* = { 4. 10. 18. }

Code:

`::`

INNERCOMP

get1

INNERCOMP

get1

2DUP#=

NOT

OVER#0=

ORcase

::

OVER#2+UNROL

{}N

OVER#2+UNROL

{}N

;

#1+_ONE_DO (DO)

get1

INDEX@

#2+ROLL

%*

INDEX@

#1+UNROLL

LOOP

{}N

;

Wondering if anyone had done similar implementations, and if so I'd be curious to compare.

Jacob