Hi ebierly

you wrote:
>a:"ed"
>b:"a"
>c:"b"
>>> do do c
>== ed
>Is there a way to determine the depth of indirection such as f of c = 2?

depth?: func [word [word!] /local depth] [
  depth: 0
  while [ value? to-word :word ] [ 
    word: get to-word :word 
    depth: depth + 1 
  ]
  depth
]

>> depth? 'a
== 1
>> depth? 'b
== 2
>> depth? 'c
== 3

Note that depth? of 'a is 1, which I believe makes sense, and therefore
detph? 'c becomes 3.

Elan

Reply via email to