|
Pages: [1]
|
 |
|
Author
|
Topic: which is better? (Read 322 times)
|
|
fhein
|
which one of the following is the better solution, and do they even produce the same result?  either any-block? data [ append content rejoin data ][ append content data ] or: append content to-string reduce data
|
|
|
|
|
Logged
|
|
|
|
|
CarlRead
|
I'm pretty sure they'd return the same results. As to which is better, well it depends on how you define better. :-) The first version could be refactored though, giving you this... append content either any-block? data [rejoin data][data]
Which is still longer than your other version, so it's just a case of which is faster, (probably little difference), or which you think is the more readable. I'd go for your second version, as I suspect to-string does much the same thing as your any-block? check, just at native speed.
|
|
|
|
|
Logged
|
- Carl Read
|
|
|
|
Sunanda
|
The first works with recursive blocks while the to-string option does not.
Try it with this data:
data: copy [] append/only data data
|
|
|
|
|
Logged
|
|
|
|
|
|
Pages: [1]
|
|
|
 |