[REBOL] Thanks for the warm welcome!
From: schaeper:hyperverse at: 29-Apr-2001 17:45
Thank you all for your welcome and support.
I took Carl's advice and studied series for the last few days. It looked
like it might be fun to recreate some APL, a math language, just to get
something going.
So here is my contribution. If you know of a way to tighten up the code,
please don't hesitate to let me know.
Also the function in APL for summing a vector or array is '+/' but I had
trouble defining that as a function, would sure appreciate some suggestions.
Thanks,
Tom
REBOL [
Title: "Math Functions"
Author: "Tom Schaeper"
Date: 26-Apr-2001
Version: .5
]
v+: func [
"Sum a block of values"
block1 [block!] "Block of numbers passed"
][
block1: head block1
total: 0
forall block1 [ total: total + block1/1]
return total
]
v*: func [
"Sum a block of values"
block1 [block!] "Block of numbers passed"
][
block1: head block1
total: 1
forall block1 [ total: total * block1/1]
return total
]
viota: func [
"Generate a block of integers from 1 to num"
num [integer!] "Number of entries from 1 to num"
][
i: 0
block1: copy []
while [ i < num] [
i: i + 1
block1: insert block1 i
]
block1: head block1
]