AltME: Rebol School

Messages

amacleod
Simplest way to remove a block from a block of blocks?
a: [[A] [B] [C]]
== [[A] [B] [C]]
>> remove third a
== []
>> a
== [[A] [B] []]
...but I want the block removed too!
Josh
>> a: [[A] [B] [C]]
== [[A] [B] [C]]
>> third a
== [C]
(that is a hint)
>> head remove next next [[A] [B] [C]]
== [[A] [B]]
Gregg
As Josh hinted, THIRD is returning the third element, which REMOVE then operates on. You'll want to use AT, or something, to remove the element. e.g.
>> a: [[A] [B] [C]]
== [[A] [B] [C]]
>> head remove at a 3
== [[A] [B]]
>> a: [[A] [B] [C]]
== [[A] [B] [C]]
>> head remove find/only a [c]
== [[A] [B]]
amacleod
head remove find/only a [c]
this is exactly what I need....
"at" ...new to me!
Thanks all!
Greg,
remove find/only a [c]
seems to work too, without head...
Gregg
Yes, as long as you don't need the result to be at the head.
>> a: [[A] [B] [C]]
== [[A] [B] [C]]
>> remove find/only a [c]
== []
I just included HEAD to make the result clear in this case.
amacleod
I see...I would want that result with head...thanks

GiuseppeC
Hope there is someone here in the morning as I need quick help:
Hope there is someone here in the morning as I need quick help:
GiuseppeC
I have a variable:
mycode: "CODE1"
I need to check  if exist a series named CODE1
If it does not exist create a series called CODE1
append to CODE1 (taken from mycode) something.
PeterWood
Is this any help?
>> value? 'mycode
== false
>> mycode: []
== []
>> value? 'mycode
== true
Something like this, if I understood what you are trying to do properly:
>> if not value? to-word mycode [set to-word mycode [something]]
== [something]
>> CODE1
== [something]
That will create CODE1 in the global context though.
GiuseppeC
I have tried also:
value? get first [mycode]
Lets assume mycode is: CODE1
I whish to create a series whose name as I would write:
CODE1: copy []
Sorry
I whish to create a series whose name is CODE1. Se the code should dinamically take it from MYCODE and execute a line like: CODE1: copy []

Last message posted 184 weeks ago.