Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Little questions, big answers...

From: jelinem1:nationwide at: 4-Sep-2001 16:27

Back from "out of the office". Sorry about the spam. I've given Lotus Notes a good spanking over it. Following is a function I've found useful for viewing blocks and objects. Even though 'mold will usually work good enough, the following 'display function is most useful for viewing those self-referential objects. This should provide a clearer view of the VID objects that you define. I hope it doesn't line-wrap too badly. ;--------------------------------------------------------------------------------- display: function [ "View the contents of a word" some-thing "Thing to print" /mold "Mold the values to display" /assoc "Print the elements of an associative list" num-elem [integer!] "Number of elements to associate" /verbose ][sep idx][ sep: "" if verbose [print ["- This is of type:" type? :some-thing]] switch/default type?/word :some-thing [ object! [ if verbose [print "--- Thing is an object"] foreach some-word next first some-thing [ system/words/print either mold [ [some-word ":^(tab)" system/words/mold get (in some-thing some-word)] ][ [some-word ":^(tab)" get (in some-thing some-word)] ] ] ] block! [ if verbose [print "--- Thing is a block"] either assoc [ idx: make counter [value: 0] forall some-thing [ idx/inc prin [idx/value ")^(tab)"] loop num-elem [ system/words/prin sep sep: " - " system/words/prin either mold [ system/words/mold first some-thing ][ first some-thing ] some-thing: next some-thing ] system/words/print "" some-thing: back some-thing ] ][ repeat idx length? some-thing [ system/words/print either mold [ reduce [idx ")^(tab)" system/words/mold pick some-thing idx] ][ reduce [idx ")^(tab)" pick some-thing idx] ] ] ] ] ][ if verbose [print "--- Thing is a default"] system/words/print either mold [system/words/mold some-thing][some-thing] ] exit ]