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

[REBOL] Re: is a block a block?

From: lmecir:mbox:vol:cz at: 29-Nov-2000 18:14

Hi Sascha, instead of: probe first b/name , which tries to find the first element of the B/name path (incorrect) you could do: 1) c: first b probe c/name 2) probe do-path [first b /name] , where Do-path is as follows: do-path: function [ { A referentially transparent way to invoke a path. Usage: do-path [something /r1 /r2 ... /end-path a1 a2 ...] /end-path can be omitted, if no args are supplied. Values between Something and /end-path are ignored, if they don't evaluate to refinements or integers. } [throw] blk [block!] ] [something path ref] [ set/any [something blk] do/next blk path: make path! reduce [ either word? get/any 'something [something] ['something] ] until [ any [ empty? blk ( set/any [ref blk] do/next blk if any [ refinement? get/any 'ref integer? get/any 'ref ] [ not if /end-path <> ref [ insert tail :path either refinement? ref [ to word! ref ] [ ref ] ] ] ) ] ] do head insert/only copy blk :path ] Ladislav