[REBOL] Re: Object Sea - Work in Progress
From: al:bri:xtra at: 22-Feb-2002 22:30
Here's my latest implementation of 'Freeze:
Freeze-Value: function [Sea [block!] Value] [Index] [
any [
if any [
function? :Value
object? Value
] [
make lit-path! reduce [
'.
either found? Index: find/last Sea :Value [
index? Index
] [
append Sea :Value
length? Sea
]
]
]
if series? Value [
make lit-path! reduce [
'.
either found? Index: find/last Sea head Value [
index? Index
] [
append Sea head Value
length? Sea
]
index? Value
]
]
Value
]
]
Freeze: function ["Freezes Object Sea" Sea [block!]] [Block Object Value] [
foreach Fish Sea [
any [
if block? :Fish [
Block: Fish
forall Block [
Value: Block/1
Block/1: Freeze-Value Sea :Value
]
]
if object? :Fish [
Object: Fish
foreach Word next first Object [
Value: get in Object Word
set in Object Word Freeze-Value Sea :Value
]
]
]
]
Sea ; At this point, the 'Sea has become ice. :)
]
It correctly handles series that aren't at their head, by appending the
offset onto the path. I haven't yet got 'Melt working properly. I'm fairly
sure that the above two functions can be reduced in size.
Andrew Martin
Antartic Rebol...
ICQ: 26227169 http://valley.150m.com/