Rebol Talk Forum  |  REBOL Discussions  |  REBOL View  |  Topic: Blocks within a block? (An array)
Pages: [1] Print
Author Topic: Blocks within a block? (An array)  (Read 491 times)
Gord
Newbie
*
Offline Offline

Posts: 18


View Profile
Blocks within a block? (An array)
« on: May 02, 2006, 11:39:54 PM »

I think I've figured this out before but having trouble figuring it out again.

What I have:
Rec1: ["a" "aa" "b" "bb"]
Rec2: ["c" "cc" "d" "dd"]

What I want: (Two blocks within a block)
[["a" "aa" "b" "bb"]["c" "cc" "d" "dd"]]

What I get: (one long block)
["a" "aa" "b" "bb" "c" "cc" "d" "dd"]

I've tried various combinations of append, join, insert, mold, load & mold, to-block, make block!, etc..

Help would be appreciated.  Thanks


Logged
CarlRead
Full Member
***
Offline Offline

Posts: 105


View Profile
Re: Blocks within a block? (An array)
« Reply #1 on: May 03, 2006, 02:36:03 AM »

Use the ONLY refinement to insert or append a block as a block.  ie...
Code:
>> recs: []
== []
>> append/only recs rec1
== [["a" "aa" "b" "bb"]]
>> append/only recs rec2
== [["a" "aa" "b" "bb"] ["c" "cc" "d" "dd"]]
Alternatively, you could use REDUCE...
Code:
>> recs: []
== []
>> append recs reduce [rec1 rec2]
== [["a" "aa" "b" "bb"] ["c" "cc" "d" "dd"]]
Hope that helps.
Logged

- Carl Read
Gord
Newbie
*
Offline Offline

Posts: 18


View Profile
Re: Blocks within a block? (An array)
« Reply #2 on: May 03, 2006, 10:05:41 AM »

Thanks Carl - that is exactly what I needed.
Logged
Pages: [1] Print 
Rebol Talk Forum  |  REBOL Discussions  |  REBOL View  |  Topic: Blocks within a block? (An array)
Jump to:  

  
Quick Search...

Advanced search
  
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 21, 2008, 04:57:31 PM
Username: Password: Session Length:
  

News: 01-09-08

Alpha version of REBOL 3 has been released!


  
2295 Posts in 593 Topics by 3756 Members
Latest Member: selexav

  Rebol Talk Forum | Powered by SMF 1.0.9.
© 2001-2005, Lewis Media. All Rights Reserved.

RT design by Defiant Pc