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

World: r3wp

[Core] Discuss core issues

[unknown: 5]
19-Feb-2008
[9258]
would be nice to also break out of one of evaluated cases.
btiffin
19-Feb-2008
[9259]
There is always a REBOL way  :)  And after I post this, someone else 
will come by with the real answer.
 

>> print catch [case/all [true [print 1] true [print 2] true [throw 
"4"] true [5]]]
[unknown: 5]
19-Feb-2008
[9260x2]
that will work btiffin.
That seems rather clean also.
Ingo
20-Feb-2008
[9262]
How about the following wording for case? 


Evaluates conditions until the first is true, then evaluates what 
follows it.
[unknown: 5]
20-Feb-2008
[9263x5]
Makes it sound a bit like the first condition must be true.
Evaluates each condition until true, then evaulates what follows 
it.
Then again that one makes it sound like all conditions must be true.
Evaulates conditions until a condition is true, then evaluates what 
follows it.
That sounds less confusing.
Ingo
20-Feb-2008
[9268x2]
Evaluates conditions until a condition is true, then evaluates the 
associated value.
("what follows it" could be all the rest ...)
[unknown: 5]
20-Feb-2008
[9270]
So let me play newbie for a moment.  If I see your phrase I might 
think that case is going to evaluate each condition until that condition 
is true and then evaluate what follows it.  Similiar to an until 
function.
Ingo
20-Feb-2008
[9271]
Evaluates the conditions, until the first true condition is found. 
Then evaluates the associated value.
[unknown: 5]
20-Feb-2008
[9272x2]
Anyone have information on the STATS command.  I'm trying to find 
some comprehensive information on it.  I remember at one time there 
was a discussion regarding using stats to measure performance of 
functions, etc..
Not just memory usage.
btiffin
20-Feb-2008
[9274]
stats/evals is handy.   Use it with  stats/evals/clear   And then 
look at rebol.org's  mem-stats.r  by Carl.  It's not "comprehensive 
info" but it's info.   :)
Anton
20-Feb-2008
[9275]
I think "next value" is more precise than "associated value".
[unknown: 5]
20-Feb-2008
[9276]
thanks Btiffin.  I'll look for Carl's mem-stats.r function also.
james_nak
22-Feb-2008
[9277]
I don't know where to put this question exactly but has anyone created 
any code to generate an Outlook appointment request?
Gregg
22-Feb-2008
[9278]
I did some MAPI test R&D a long time back, though I think I wrapped 
it in a DLL to call from REBOL. 

Can you generate an iCal %.ICS file and do it that way?
[unknown: 5]
22-Feb-2008
[9279]
The valuable?/potential? function would have to be updated.  It needs 
to check for value.  so it would be:


valueable?: func [arg][found? all [any-word? :arg not lit-word? :arg 
value? :arg]]
Rod
23-Feb-2008
[9280]
I am trying to pull some information out of a moderately formatted 
wiki and am tripping over something simple.


I have grabbed what equates to a record in a table so far that looks 
as follows.

||Key 123||Description text||Status||02/23/08||Y||

I have parse giving me this as a block of values.


Since this wiki is only loosely formatted the first field varies 
one line to the next, sometimes might just be Key, or *Key ###.  
What I am working too hard at is how to test a line is a pure Key 
### value.  I went looking using find for "Key "(with the space) 
 values but that still picks up "*Key ###" values.  I have multiple 
key types but generally it follows the pattern of trying to avoid 
the leading * lines and any line that isn't a known Key with some 
number following it.


My old procedural habits would like a simple substring so I can test 
from the beginning for x number of characters.


I have tried copy/part but am not getting the range syntax correct.


I am also thinking I should just further split the field to the key+number 
so I can test that both parts exist and have appropriate values. 

Suggestions or nudges towards enlightenment?
btiffin
23-Feb-2008
[9281x2]
Umm, I'll get this wrong; but parse is the ticket.

nums: make bitset! [#"0" - #"9"]
valid: parse value [ "Key" 3 nums]

I think.
space: make bitset! " "
valid: parse/all value ["Key" space 3 nums space to end]

Maybe?
Brock
23-Feb-2008
[9283x3]
I'd include a characterset that excludes the * character
sorry bitset... 
nums: make bitset! [#"0" - #"9"]
skip-char: complement make bitset! [#"*"]
valid: parse value [skip-char "Key" " " 3 nums]
... something to that affect anyway.
Ingo
23-Feb-2008
[9286]
How about:

nums: charset [#"0" - #"9"]
space: charset [#" "] 

parse wiki ["||" any space "key" any space 3 nums any space "||" 
] 
and so on ...]
Rod
23-Feb-2008
[9287]
Brian, the first one seems to work for my test data, will give it 
a try on the real thing on Monday.  Thanks all for the tips, will 
keep them handy as I refine this little script.
Graham
23-Feb-2008
[9288]
Anyone got a clean-script that works with the new rebol syntax ?
[unknown: 5]
23-Feb-2008
[9289]
Is there an easy way to remove double blocks from a block.  So that 
something that looks like [[something]] looks like [something]?  
If not shouldn't we have something like this in REBOL as a mezz function?
Henrik
23-Feb-2008
[9290x2]
this has been discussed before, but I think the solution has scrolled 
out of view a long time ago...
R3 can do it using the new methods that loops can use, I believe.
[unknown: 5]
23-Feb-2008
[9292]
Are you saying it can't be done until R3?
Henrik
23-Feb-2008
[9293x3]
it can easily be done. the simplest way is:
form [[1][2][3]]
but it has limitations
[unknown: 5]
23-Feb-2008
[9296]
Can you expland on the limitations?
Henrik
23-Feb-2008
[9297x3]
you lose bindings and it won't work on series inside the blocks inside 
the block.
oops, it should be to-block form [[1][2][3]]
there are better solutions, but that is the quickest one.
[unknown: 5]
23-Feb-2008
[9300]
That is how I do also Henrik, I would be interested in a better solution 
but I was thinking we need one to handle the blocks within blocks
Henrik
23-Feb-2008
[9301]
the only other way in R2 is to process each block one by one with 
a loop
[unknown: 5]
23-Feb-2008
[9302]
I can build the function to loop through a block looking for others 
but am curious about the effect on bindings.
Henrik
23-Feb-2008
[9303]
I think we made a 'flatten function once.
[unknown: 5]
23-Feb-2008
[9304x2]
good name
Tell me more about in what way you think the bindings will get lost.
Henrik
23-Feb-2008
[9306x2]
with FORM you always lose bindings
try searching for flatten in AltME. plenty of references to it, I 
can see here.