Rebol Talk Forum  |  Getting Started  |  Newbie Help  |  Topic: How to make append works like set ?
Pages: [1] Print
Author Topic: How to make append works like set ?  (Read 227 times)
Hello
Guest


Email
How to make append works like set ?
« on: October 26, 2005, 03:22:53 PM »

>> a: 'b
== b
>> set a ""
== ""
>> b
== ""
>> append a "Hello"
** Script Error: append expected series argument of type: series port
** Near: append a "Hello"
>>
Logged
Sunanda
Full Member
***
Offline Offline

Posts: 113


View Profile
How to make append works like set ?
« Reply #1 on: October 28, 2005, 08:54:51 AM »

The problem is that you want to append to the string that is assigned to the word 'b, using the word 'a

'a is not a string -- it's a word assigned the value of 'b.

See:

a: 'b
set a ""

print [type? a mold a]
== word b
print [type? b mold b]
==string ""


So you need to add code to overcome that level of indirection. One way:

set a append get a "hello"

print [type? a mold a]
== word b
print [type? b mold b]
== string "hello"


Or just make a and b the same string:

b: copy "123"
a: :b
 
Logged
Pages: [1] Print 
Rebol Talk Forum  |  Getting Started  |  Newbie Help  |  Topic: How to make append works like set ?
Jump to:  

  
Quick Search...

Advanced search
  
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 03, 2008, 10:40:50 PM
Username: Password: Session Length:
  

News: 01-09-08

Alpha version of REBOL 3 has been released!


  
2315 Posts in 597 Topics by 4205 Members
Latest Member: TimTearton

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

RT design by Defiant Pc