[REBOL] Re: Rebocalc - World's smallest spreadsheet.
From: agem:crosswinds at: 20-Jun-2001 1:03
RE: [REBOL] Rebocalc - World's smallest spreadsheet.
[carl--rebol--com] wrote:
> Guess what folks... We've only scratched the surface...
>
> Here is a one page spreadsheet program. Don't let its tiny size fool you.
> It is *very* powerful... because any cell can be any REBOL expression.
>
> Numbers, dates, times, money, pairs, etc. are all valid.
> You can refer to cells by name, such as: A1 B1 C2 D8
> And, you can use formulas such as: =A1 * B2 - length? C4
>
> The possibilities boggle the mind. This is REBOL, so any
> of the cells can include network protocols. For instance,
> grab a number from your email and multiply it by currency on a
> web page. ;) You get the idea.
>
> do http://www.reboltech.com/library/scripts/rebocalc.r
>
> Now imagine... what if Rebocalc and RIM were combined...
>
> REBOL with a cause,
>
GREAT CARL!
but smallest ????
let me remember.. oh!
this little script below tells me yes with blanks, but no with tabs.
and i had to put some 100 byte extra in.
but ok, you included docs to :)
Could use real masters hand of course.
and using list-supply to avoid calculate-loop is more a joke ;-)
but i like the function-field and the dual sheet/editor-mode
(edit 'formulas in editor and run :)
and for rim the self-saving? iam not shure if its a good feature.
Well, after being proud to compete, i have to withdraw.
when reading your source,
its like seeing a tower grow very precise and quick.
after that i know where the parts belong.
while i wasn't able to build something more useful from my.
adding functions yes, but design, clearness..
and of course i use your great language.
but, you do too, so thats equal? ;-)
iam not sure about using A0, Z5..words, there are not so many..
last thinking was about some sort of dialect, maybe
replacing pairs with access-functions?
how would you design the dialect?
OK, RebSheet2 below. store and do mail, as usual ;-)
oh, and load ReboCalc before. or answer security-questions..
RebSheet want's to check its size..
size.. size? oh, store rebsheet with itself and restart
%rebsheet2-2.r .. otherwise it adds the mail size..
or copy/paste only code. or.. late night here, sending..
-Volker
[REBOL [title: file: %rebsheet2-2.r date: 19-Jun-2001/23:55:31+2:00 autor: 'volker content:
true
history: 28-Oct-2000 "file-date in archive"]
formulas: [
[
{/do[save-me] {remove "/" => autosave (lots of!)}}
"$123" "1.5 * sheet/1/2"
{(pick pick sheet y + 0 x - 2) + (pick pick sheet y + 0 x - 1)}
"reduce[y x]"]
[
{rs: system/script/header/content "RebSheet2"}
"length? rs"
"length? entab rs" "" ""]
[
{rc: read-thru http://www.reboltech.com/library/scripts/rebocalc.r "ReboCalc"}
"length? rc "
"length? entab rc" "" ""]
["" "" "" "" ""] ["" "" "" "" ""] ["" "" "" "" ""]
["" "" "" "" ""] ["" "" "" "" ""] ["" "" "" "" ""] ["" "" "" "" ""] ["" "" "" "" ""]
["" "" "" "" ""] ["" "" "" "" ""] ["" "" "" "" ""] ["" "" "" "" ""] ["" "" "" "" ""]
["" "" "" "" ""] ["" "" "" "" ""] ["" "" "" "" ""] ["" "" "" "" ""] ["" "" "" "" ""]
["" "" "" "" ""] ["" "" "" "" ""] ["" "" "" "" ""] ["" "" "" "" ""] ["" "" "" "" ""]
]
do rebsheet: [
file: %rebsheet2-2.r
as-always: 640x480
list-size: 600x380
label-size: min 640x15 list-size / 5
if not formulas [formulas: array/initial [25 5] ""]
sheet: copy/deep formulas
clear-sheet: does [foreach y sheet [forall y [change y 0]]]
save-me: does [
save/header file compose [formulas: (reduce [formulas])
do rebsheet: (reduce [rebsheet])]
compose [title: file: (file) date: (now) autor: 'volker content: true
history: 28-Oct-2000 "file-date in archive"]
]
set-text: func [face string] [face/text: string face/line-list: none show face]
ed-x: ed-y: 1
myst: stylize [
sheet-label: text label-size with [y: x: none action: [
font/color: font/colors/1
poke formulas/:ed-y ed-x copy edit/text
set-text edit copy formulas/:y/:x
ed-y: y ed-x: x show sheet-list
]]
]
view layout [size as-always
styles myst
edit: area min list-size 640x1 * 1x4 * 1x15 formulas/1/1
sheet-list: list list-size 30.30.30 [
across sheet-label sheet-label sheet-label sheet-label sheet-label
]
supply [
y: face/y: count x: face/x: index
either all [ed-x = x ed-y = y] [face/color: 0.0.255] [face/color: gray]
if all [1 = count 1 = index] [clear-sheet]
face/text: either count > length? formulas ["-"] [
if error? try [res: do formulas/:y/:x] [res: "???"]
poke sheet/:y x :res
mold :res
]
]
]
]
]