Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

still a rookie

 [1/4] from: giovanni::cardona::com at: 11-Dec-2000 12:07


I finally buy the REBOL book and start reading it. As Mr. Sassenrath says, you have to un-learn some other programming practices in order to understand the simplicity of REBOL. But given the fact I learned so many languages in my past 18 years, I think I have so much to "un-learn", because there's some facts I still dont get in order to 're-program' my programming skills (something I dont use since some time ago, many cool authoring tools out there :) Why I can't assign or use a value for certain operations? I set this variable;
>> myname: [giovanni cardona iguina]
Example 1;
>> uno: 1 >> myname: skip myname -uno <-doesnt work >> myname: skip myname -1 <-it works. but I want this on a variable
Example 2;
>> LE: length? myname >> print myname/LE <-doesnt work >> print myname/3 <-this path works, but I want this on a variable
Why I can use variables this way? sounds logical to me, given the fact that REBOL claims to be so flexible, of course. Also I noticed that if I set myname to the last value:
>> myname: last myname
and then insert a new name:
>> insert myname 'bonano
** Script Error: insert expected series argument of type: series port bitset. ** Where: insert myname 'bonano Then, myname loose all of the block info and the final value for myname will be the last value == iguina erasing previous values, after that, you can't execute no more "back" or skip . I dont know if you see this situation very usual for REBOL, but I find it myself very weird. Maybe Im not only looking to a problem solving, but to an understanding of REBOL's behaviour. -=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=- "Miracles happen only to those who believe in them."

 [2/4] from: johnkenyon:ibm at: 11-Dec-2000 16:44


Hi Giovanni, Confusing to start with :) I would recommend making regular use of the built-in help function.
>> myname: [giovanni cardona iguina] >> uno: 1 >> myname: skip myname -uno <-doesnt work >> myname: skip myname -1 <-it works. but I want this on a variable >> help -
USAGE: value1 - value2 DESCRIPTION: Returns the second value subtracted from the first. - is an op value. ARGUMENTS: value1 -- (Type: number pair char money date time tuple) value2 -- (Type: number pair char money date time tuple) -- so try :
>> myname: skip myname (- uno)
or
>> myname: skip myname negate uno
Example 2;
>> LE: length? myname >> print myname/LE <-doesnt work >> print myname/3 <-this path works, but I want this on a variable
try :
>> print myname/:LE
Also I noticed that if I set myname to the last value: Exactly
>> ? last
USAGE: LAST series DESCRIPTION: Returns the last value of a series. LAST is an action value. ARGUMENTS: series -- (Type: series port tuple) --
>> myname: last myname
This has set myname to the last _value_ in the series Try tail:
>> ? tail
USAGE: TAIL series DESCRIPTION: Returns the series at the position after the last value. TAIL is an action value. ARGUMENTS: series -- (Type: series port) -- myname: tail myname and then insert a new name:
>> insert myname 'bonano
== []
>> myname: head myname
== [giovanni cardona iguina bonano] Hope this helps a little. Regards, John

 [3/4] from: giovanni:cardona at: 11-Dec-2000 12:55


A little? it helps me a LOT, thank you! :) Thanks John!

 [4/4] from: mastercougar:netzero at: 11-Dec-2000 12:13


On Mon, 11 Dec 2000 12:07:34 -0800, you wrote:
>>> uno: 1 >>> myname: skip myname -uno <-doesnt work >>> myname: skip myname -1 <-it works. but I want this on a variable
That's because -uno has no value. change the -uno to (-1 * uno) and it will work
>>> LE: length? myname >>> print myname/LE <-doesnt work >>> print myname/3 <-this path works, but I want this on a variable
Print pick myname LE Marc Lombart mailto:[mastercougar--netzero--net] ICQ UIN 3337155