[REBOL] Re: Quick print question
From: joel:neely:fedex at: 7-Apr-2002 7:23
Hi, Charles,
Charles wrote:
> Without having to reference docs (it's not actually that
> important - I'm simply curious) is there a quick and easy way
> to print separate lines? For instance, in the cases of:
> text: [ "line 1"
> "line 2"
> "line 3"
> ]
>
> Or
> text: {
> line 1
> line 2
>
> line 4 }
>
I'll comment in passing that this abstraction seems a bit
strange to me, since a block of strings is a container of
containers of characters and a string is a container of
characters. IOW, this abstracts over depth of nesting
rather than over data type. That said...
print-as-lines: func [c [string! block!]] [
foreach line either block? c [c] [parse/all c "^/"] [
print line
]
]
shoud do what you asked.
-jn-
--
; Joel Neely joeldotneelyatfedexdotcom
REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip
do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] {
| e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]