World: r3wp
[I'm new] Ask any question, and a helpful person will try to answer.
older newer | first last |
Janko 8-Jan-2009 [1633x3] | aha cool |
thanks | |
about word / value .. I see I there are functions word? value? which determine the difference between true-s | |
Sunanda 8-Jan-2009 [1636] | You mean like: word? true == false word? 'true == true Or: type? true ==logic! type? 'true == word! |
xavier 8-Jan-2009 [1637] | in the first case true is a value and in the second case true is a litteral |
Steeve 8-Jan-2009 [1638] | Janko, you can avoid the reduce/compose by using this syntax >> true = first [true] == false >> true = first [#[true]] == true |
Janko 8-Jan-2009 [1639x3] | I changed the function to this so I can have testcases structure as it was initially |
unit-test: func [ tests ] [ foreach test tests [ prin rejoin [ "===================" newline "TEST " test/n ": " ] res: if/else word? test/r [ do test/r ] [ test/r ] print if/else ( (do test/f) == res ) [ " passed" ] [ rejoin [ " **FAILED**" newline " expected: " mold test/r " | got: " mold do test/f ] ] print "" ] ] | |
I added the line :: res: if/else word? test/r [ do test/r ] [ test/r ] | |
Steeve 8-Jan-2009 [1642] | we prefer to use EITHER instead of IF/ELSE |
Janko 8-Jan-2009 [1643x3] | aha, I would like it better to.. if/else is gard to read.. but I didn't know it exists :) |
thanks | |
great, it all works now | |
Oldes 8-Jan-2009 [1646x2] | What about using: **FAILED**^/ expected: instead of: **FAILED** newline " expected: " |
>> ? newline NEWLINE is a char of value: #"^/" >> ? lf LF is a char of value: #"^/" | |
Janko 8-Jan-2009 [1648] | Thanks Oldes, I didn't know for ^/ and I also didn't know that I can type "?" instead of "help" |
xavier 8-Jan-2009 [1649x2] | and ?? too |
sometimes can be usefull :) | |
Janko 8-Jan-2009 [1651x2] | :) I didn't know for this too.. but I did >>? ?? to find out now :) |
...what it does . thanks | |
Brock 8-Jan-2009 [1653] | Example; say you are trying to debug an app and you have to print the contents of a word to the screen. say you set the word 'value to 10 displaying value to the console can be done by using; print value returns the result; 10 where as using "?? value " instead, would return the word name with the value of the word beside it value: 10 This prevents you from needed to add debugging code like' print ["Value: " :value] |
Reichart 8-Jan-2009 [1654] | Welcome Ben Bran... This world is a crazy wonderful place of amazing people that can probably help you with any REBOL question you might have. |
BenBran 8-Jan-2009 [1655] | Yes, I suppose my newnewss is really glaring... Thank You Reichart! |
Pekr 8-Jan-2009 [1656] | These ppl can help you with many things ... from religion, to compose music :-) |
BenBran 8-Jan-2009 [1657] | Yes and I need all the help I can get Pekr :-) |
Pekr 8-Jan-2009 [1658] | New to REBOL? |
BenBran 8-Jan-2009 [1659] | Read a Dummies book on it about three years ago. Been watching it ever sense. With R3 coming out, I'm going to give it a serious look. |
Pekr 8-Jan-2009 [1660x2] | Good. R3's gonna be cool. There is just still lots of work on it :-) |
But - we will be able to cooperate and hence influence its development ... | |
BenBran 8-Jan-2009 [1662x2] | Yes, thats why I signed up..... so hope to get more involved with the development.... |
time permitting.... | |
Reichart 8-Jan-2009 [1664] | I see, your name is Ben Brannen... Even before R3 comes out, you will find R2 pretty amazing... |
Maarten 8-Jan-2009 [1665] | And you may like thge new English translation of a French book; translated by Peter Wood, who is here as well. It's on lulu.com |
[unknown: 5] 8-Jan-2009 [1666] | Wanted to say Welcome to Janko and BenBran. |
Janko 8-Jan-2009 [1667] | Thanks Paul |
[unknown: 5] 8-Jan-2009 [1668] | Your welcome. |
Janko 8-Jan-2009 [1669x5] | I have another question about parse, if I may.. I am trying to make a parse block that will uppercase all letters after the . ! or ? . I did it just for dots, but I can't make it for all 3 ( one alternative is to call parse 3 times each time with different separator char. The problem can be observed here, and happens because [ A | B | C ] pattern first looks for A and if it doesn't find a checks B , which means it will skip B if A is after B. Is there any way to say "use any of those chars - *whichever comes first" ? .. example where you can see the problem: |
== true >> parse "A.B!C.D." [ any [ [thru "." | thru "!" ] mark: (print mark ) ] ] B!C.D. D. >> parse "A.B!C.D." [ any [ [thru "!" | thru "." ] mark: (print mark ) ] ] C.D. D. --- in first case it skips the C in second it skips the B .. | |
this is my code to uppercase after scentences : parse X [ ANY [ [ thru "." | thru "!" | thru "?" ] mark: ( uppercase/part trim mark 1 insert mark " " ) :mark ] ] | |
It works if I have just one kind of separator of if I have them in this order for example "a.b.c.d!e?" if I have ""a.b.c.d!e?f. " it will skip the ! ? and produce "a. B. C. D!e?f. " | |
because it will skip over ! and ? to the last "." | |
Steeve 8-Jan-2009 [1674] | hmm... do this parse source [any [["!" | "?" | "."] mark: (do something) | skip ]] |
BenBran 9-Jan-2009 [1675x2] | Thanks Reichart. Yes a good old Irish name (spelling changed when got to America). If Ihave my numbers rights, I'm 4th generation German/Irish/Swedish American and my daughter can add Spain and Mexico to her list. R2 did keep my interest these years. I'm somewhat at a loss to |
oops typo sorry.... | |
Henrik 9-Jan-2009 [1677] | BenBran, you can click the pencil above the text edit field to make multiline messages. |
BenBran 9-Jan-2009 [1678] | Thanks, Thats much better. |
Janko 10-Jan-2009 [1679] | Steeve: I solved it by doing 3 passes , one for each character (.!?) . Performance is not that important here as it's a client , but if it's possible to do it in one pass I would certanly like to learn about it. I will try what you proposed, Thanks! |
Oldes 10-Jan-2009 [1680x2] | str: "a.b.c.d!e?f. " chars: complement charset ".!?" >> parse str [any chars tmp: to end (uppercase tmp)] str == "a.B.C.D!E?F. " |
>> parse str: "assd.asd!d" [any chars tmp: (uppercase tmp)] str == "assd.ASD!D" | |
mhinson 13-Apr-2009 [1682] | Hi. I am struggiling to understand parsing & hoping for some pointers. I have read everything I can find but still cant seem to use parsing for basic extraction of information from a number of lines (or even a single line). This is what I am trying to do & would love sme help or links to documentation I may have missed please. lines: {junk wanted line1 contentA rubbish junk notNeeded line2 wanted line three content B rubbish } ;I want to extract ;wanted line1 contentA ;wanted line three content B ;That is to say everything between "wanted" up to "rubbish" but including "wanted" Thanks, /\/\ |
older newer | first last |