r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[I'm new] Ask any question, and a helpful person will try to answer.

BrianH
21-May-2009
[2780x2]
[key [flags ["flag1" "flag2"] ips ["127.0.0.1" "192.168.1.1"]]
Sorry, missing a last ]
mhinson
21-May-2009
[2782]
The pairs idea sounds productive, so it is a highly structured array 
with named groups?
BrianH
21-May-2009
[2783x2]
Or you could go positional for the different types of data, instead 
of including the flags and ips words all of the time.
dat: [key [["flag1" "flag2"] ["127.0.0.1" "192.168.1.1"]]]
foreach [key val] dat [set [flags ips] val  ...]
Structured data makes things easier.
mhinson
21-May-2009
[2785]
Thank you very much for you time & help.  I will need a while to 
digest this & make it work with my existing code.

I think this type of structure is going to be the core of most of 
the data extraction I need to do, so I must get to understand it 
very well. I have a section that uses an array, but some of the more 
interesting data manipulation needs to cope with more varied keys. 
Thanks.
BrianH
21-May-2009
[2786]
This a pretty standard way for REBOL to do lightweight data structures. 
Blocks are lighter-weight than objects. Enjoy :)
RobertS
22-May-2009
[2787]
.
mhinson
22-May-2009
[2788x2]
Hi, is there an easy way to make this sort of structure work please?

data: [bike [wheels [2] owner [john]] pig [legs [4] owner [roger]]]

foreach [thing content] data [print [data/:thing/owner "~" data/:thing/wheels 
"~" data/:thing/legs]]

I want the invalid references (e.g. data/bike/legs) to return nothing 
so the list is printed for both things
I know I could put "" values in when I create the structure, but 
I wondered if the was a neater way to do this.
Henrik
22-May-2009
[2790x2]
if you wrap a path in ATTEMPT, it will return none.
when it doesn't exist
mhinson
22-May-2009
[2792]
Thanks Henrik. That sounds like what I need.
Henrik
22-May-2009
[2793]
I like to do things like:

any [attempt [this/leads/nowhere] "Unknown"]
mhinson
22-May-2009
[2794x2]
The task I am trying to accomadate is to output my data as a table. 
so I think I can adapt your example to return "" Thanks.
I cant work out how to turn that into a function, because if I do
att: func [paf][any [attempt [paf] ""]]
att this/leads/nowhere 

the invalid path returns an error before it can be passed to the 
function.   I bet there is a good answer. I have been looking at 
using :paf, but that makes it return the invalid path
Steeve
22-May-2009
[2796]
lit-path!, it's done for that.
mhinson
22-May-2009
[2797x3]
so I try to find a way to pass it as that sort of data type?
Not getting anywhere with this I am afraid.  where do I put the lit-path! 
please?
I have been trying this sort of thing
att: func [paf[lit-path!]][any [attempt [paf] ""]]
but I suspect that is not what Steeve means.
Steeve
22-May-2009
[2800]
You suspect well, but you suspect too much.

It would be better if you knew all the data types in Rebol and their 
usages.

Currently you're only trying to "guess"  how to programm with Rebol, 
not to learn it.


I don't think it's always a good method to "give" the answer directly, 
especially when they are obvious.
It' gives some bad habits to the newcommers.
Sorry.
Graham
22-May-2009
[2801x2]
Steeve is an advocate of the Socratic method
BTW, I think   any [ attempt [paf] "" ] should be any [ attempt [.. 
] copy "" ] ... ie. you need a 'copy in there.
mhinson
22-May-2009
[2803]
ok, I will continue to read the documentation. I think you are right 
Steeve, but it is hard to learn with no current programing skills. 
Perhaps I am just trying to find out how to solve my problems. 

Some of the data types seem quite straight forward, but some seem 
to need to be used before I can appreciate what they are exactly.. 
I try not to ask questions that are too trivial, and never before 
I have tried to research an answer for myself.  You maybe just misunderstand 
how stupid I am. ;-)
Graham
22-May-2009
[2804]
There are several good books on REBOL, even one in english
mhinson
22-May-2009
[2805]
Do you think the web resources are in some way worse than the printed 
books Graham?
Steeve
22-May-2009
[2806]
Mhinson, i think we all enjoy to answer to people like you.
Especially because you're a nice and psersistent personn.


But after some weeks, there are questions, we don't want to see comming 
from you.anymmore ;-)
Graham
22-May-2009
[2807]
Books are good because someone here gets to sell your their copy 
:)
mhinson
22-May-2009
[2808x2]
If anyone has any good Rebol books in English that they would like 
to sell in the UK please let me know.  Thanks.
Steeve, I suspect you doubt the time & effort I have been putting 
into learning Rebol. If you have a clear idea about which sorts of 
questions I really should be able to answer from my own research 
it would give me some useful direction to my study I think. It is 
frustrating thatl I am often trying to guess how to create the structures 
I want, perhaps if I had a better foundation I would know know better 
how to learn more directly.
Steeve
22-May-2009
[2810]
My advices for a very efficient learning of R2.

1/ Go on Rebol.com and read all the documentation published (it's 
your bible).

2/ Go on Rebol.org and download all the scripts published.  Test 
thoses you can, read their sources and try to figure how they work 
and what technics are used.

3/ When you have questions, At first , check on Rebol.org (the mailing 
list archive) most of the time your answer is there.
mhinson
22-May-2009
[2811]
Thanks Steeve, I will try not to post here any more unless I am invited. 
 I have enjoyed trying to learn Rebol & will continue, but I do understand 
that my constant questions are an anoyance, and I dont want to be 
banned from this very usefull forum. :-(
Steeve
22-May-2009
[2812]
Sorry it's not what i mean.
mhinson
22-May-2009
[2813]
Well, I dont want to cause an anoyance with too much noise
Steeve
22-May-2009
[2814]
you're really wellcome here to post questions
mhinson
22-May-2009
[2815]
Thankyou very much. I really value the help I have recieved for you 
all.
Steeve
22-May-2009
[2816]
But with the time, you'll see some strange reactions like mine.

Some of your questions will be not well considered if they not reflect 
your current level.


Your current status is not anymore "i'm a newbie", be aware of that 
fact.
Brock
22-May-2009
[2817x5]
Steeve, I've been holding off in saying this but you have been pretty 
rude to a few people here over the past couple of months with some 
people.  Because you are such an expert, you are putting others down 
for both their efforts and questions.
The one thing that Rebol has that is somewhat unique, is a nice community, 
with varied talents, interests and programming experience both with 
Rebol and other languages.  I feel your sharp answers can be detrimental 
to those lurking, and push people away, such as myself and mhinson. 
 Your tolerance would be appreciated.
Sorry, but I had to say it.
Everyone appreciates getting a response to a question.  The fact 
that this is a group called I'm New, you should maybe consider ignoring 
it if you don't want to answer questions that are repetitive or simple 
[to you].
... and that's all I will say on the topic.
Graham
22-May-2009
[2822]
Brock, I think it has to be pointed out that one also needs to ask 
appropriate questions.
Brock
22-May-2009
[2823]
It's a group labeled I'm New... that pretty much says it all.
Maxim
22-May-2009
[2824x2]
I think that mhinson still feels that he is new.  cause he realises 
that he is still struggling with simple things.
people usually stop asking basic questions when they don't need to. 
  some people learn quick, some learn slow, some have a lot of catching 
up to do.. there are many reasons for someone not to *get* rebol 
from the bat.
Brock
22-May-2009
[2826]
I've been programming (scripting) with Rebol for many years, on a 
casual basis, and I can't answer mhinson's question without sitting 
down and looking at it and fumbling through some of this.
mhinson
22-May-2009
[2827]
It would be good if there were enough newbies to form their own huddle 
& ask each other the questions that the more experienced people find 
tedious to answer. It takes me a good while to work out very basic 
things, even if I have an overview of more complex areas.  I have 
been learning Rebol for 2 months, it is the first serious attempt 
I have made at this sort of thing for over 20 years.
Maxim
22-May-2009
[2828]
some people can't learn from documents... I know I can't.  reading 
reference documents doesn't give you the why or the other inside 
knowledge... the *better* way whcih is directly applied to a problem.
Brock
22-May-2009
[2829]
My problem is I jump in for a few weeks, then jump out for a month 
or two.  I never get past the previous level and don't stretch the 
boundaries or delve into new areas.  I will always be a newbie.