World: r3wp
[!REBOL3]
older newer | first last |
Paul 16-Feb-2010 [832] | The problem may be where we would want to switch context again for example ifI wanted to later use count. |
Andreas 16-Feb-2010 [833] | A correction to BrianH's STRICT-EQUAL? response: "noone has tried to phrase the doc string accordingly" is factually incorrect, as can be easily seen in the log. I posted two rephrasal suggestions. |
Gregg 16-Feb-2010 [834] | The two suggestions from Andreas: 1) "TRUE for values that are equal and of the same case and datatype." 2) "Returns TRUE for EQUAL? values that are of the same case and datatype." I'll add the following option: Returns TRUE for values that are equal and of the same case and datatype. Which is just Andreas's #1 with "Returns" at the head, to match the doc string for EQUAL? and others. That makes it 73 chars total. I don't think that's a problem, but I also don't think it's neccessary in this case. It wouldn't hurt of course, but certain information may have to be elided from doc strings, and this piece of information for STRICT-EQUAL? is easy to deduce and understand IMO. |
Andreas 16-Feb-2010 [835x3] | I have two refined suggestions posted as bug#1497. |
Returns TRUE if the values are equal. | |
And regarding the necessety, maybe it's just me, but when I compare: - Returns TRUE if the values are equal. - Returns TRUE if the values are equal and of the same datatype. I would deduce that "and of the same datatype" is the only difference between those functions. I personally have been with REBOL long enough to know that this is not true, but I still think that these docstrings in this case are misleading. | |
Steeve 16-Feb-2010 [838] | Who tested map! with case-sensitive lookup capabilities. And what workaround did you used ? |
Andreas 16-Feb-2010 [839] | One workaround is to not use MAP! at all. The other workaround is to convert keys you want to be case sensitive to BINARY!. |
Steeve 16-Feb-2010 [840] | Nice, here i go for binaries. |
Gregg 16-Feb-2010 [841] | Andreas, what about something like one of these: - "Returns TRUE if the values are strictly equal and of the same datatype." - "Returns TRUE if the values are strictly equal and the same datatype." - "Returns TRUE if the values are strictly equal, including their datatype." - "Returns TRUE if the values are strictly equal, including datatype." We can argue that just adding the word "strictly" doesn't help, but then the help for EQUAL? isn't very helpful either. :-) My thinking here is that there are a number of things that may seem confusing about strict equality, and we can't address them all in the doc string. Case sensitivity is important, and if we want to single that out, I'm OK with it, but might there be other cases as well? >> strict-equal? d1 d2 == true >> d1 == 16-Feb-2010/13:25:30-7:00 >> d2 == 16-Feb-2010/14:25:30-6:00 >> equal? [a] [A] == true >> strict-equal? [a] [A] == false >> strict-equal? 'a 'A == true R3 addresses those cases, but are there others? What about user defined types (not sure what the status or goal is on utype! values at this point)? |
Andreas 16-Feb-2010 [842x4] | Yes, just rephrasing the strict-equal? docstring as "Returns TRUE if the values are strictly equal." woul also be an option |
I would then drop mentioning datatype equality, so that an interested user will have to consult more detailed documentation on how strict equality is defined | |
And yes, all the cases you mention no longer hold for R3. | |
But actually, I quite like "Returns TRUE if the values are strictly equal." This does not lead a user who reads only the docstring to wrong conclusions. | |
Sunanda 16-Feb-2010 [846] | Request for help received via REBOL.org's feedback form. If you can help, please post here and I'll forward him the URL of the archive: =============== Using Rebol 3.0 Alpha, 2.100.97.3.1, how can I save the value removed from a series when I use the remove function? See example 1 below; I would like to be able to save the value "red" in a variable. Can a "parse" statement be used instead of the remove. How would it be coded? See example 2 below. Should'nt the value be "red" example 1 text: "redblueyellow" == "redblueyellow" remove/part text 3 ==text: "blueyellow" Example 2 saved-text: "redblueyellow" == "redblueyellow" difference saved-text text == "d" I tried this an hour later and got == "rd" =============== |
Andreas 16-Feb-2010 [847x3] | Save the value: use TAKE instead of REMOVE |
And DIFFERENCE treats the two strings as _sets_ of characters (i.e. they are internally UNIQUEd) and returns only those characters which are not present in both strings. | |
Here's an example for TAKE: | |
Sunanda 16-Feb-2010 [850] | Is there a useful DIFF-type function anywhere that extracts the substring differences between strings? |
Andreas 16-Feb-2010 [851x2] | >> text: "redblueyellow" == "redblueyellow" >> take/part text 3 == "red" >> text == "blueyellow" |
IIRC Gabriele and Bohdan both have provided diff-style scripts for R2 in the script library. | |
BrianH 16-Feb-2010 [853] | Strictly per current behavior of R3, just tested: - For decimal! it means more precise comparison (17 digits versus 15 by default, also with EQUIV?). - For string types it means case-sensitivity. - For word types it means case-sensitivity and binding (only binding for EQUIV?). - For block types it means strictly equivalent contents. This seems reasonable to me, but it should be documented. I'll review the ticket mentioned above. |
Andreas 16-Feb-2010 [854x2] | Thanks Brian, much appreciated. |
I updated the docbase "comparisons" page to reflect this: http://www.rebol.net/wiki/Comparisons#EQUAL.3F | |
BrianH 16-Feb-2010 [856] | Added a comment to that ticket, with a suggestion for doc strings that fit the limit: - STRICT-EQUAL? "Returns TRUE if the values are equal and of the same datatype, case." - STRICT-NOT-EQUAL? "Returns TRUE if the values are equal and of the same datatype, case." Nice, consise, and 68 and 69 characters, respectively, no problem. You can even change "datatype, case" to "datatype & case". |
Graham 16-Feb-2010 [857x2] | eh? |
STRICT-EQUAL? == STRICT-NOT-EQUAL? | |
BrianH 16-Feb-2010 [859x2] | Sorry, replace TRUE with FALSE (as I did in the comment). |
That was a typo above. | |
Graham 16-Feb-2010 [861] | why do we need both? |
BrianH 16-Feb-2010 [862x2] | Because != and <> need a function to redirect to. |
And you can use STRICT-NOT-EQUAL? as a function value if need be, but not NOT STRICT-EQUAL?. | |
Graham 16-Feb-2010 [864x2] | maybe we should dispense with all infix operations |
make life very messy! | |
BrianH 16-Feb-2010 [866] | People like them. And they'll like them more when you can make user-defined op! functions. |
Gregg 17-Feb-2010 [867] | Returns TRUE if the values are equal and of the same datatype, case. That ending doesn't read very well to me. |
BrianH 17-Feb-2010 [868] | Like I said, ", " could be replaced with " & " and it would do as well. Would you like that? Either is considered standard English... |
Robert 17-Feb-2010 [869] | Would it be possible to make R3 a Windows-Host-Script language? |
BrianH 17-Feb-2010 [870x3] | Yes, but it wouldn't be useful unril we have user-defined datatypes (to wrap the OLE objects in). |
unril -> until | |
There might be a workaround for that with extensions, but I'd wait until we have the next host kit before making an ActiveScripting host, so we can use embedded extensions and the revamped command! type. | |
Robert 17-Feb-2010 [873] | Ok. IMO we need callbacks as well. And a good documentation how this will be integrated into the event system. |
BrianH 17-Feb-2010 [874x2] | The plan has always been to implement callbacks and integrate them into the event system through devices. |
But you never know until it happens. | |
Robert 17-Feb-2010 [876x2] | Is there a way to get the literal of a function parameter? Example: "my-funct my-data" and "my-funct: funct [parameter]..." Can I get 'my-data within my-funct? |
In R2 I could write: in object 'self, but no longer in R3. What's the equivalent in R3? | |
Pekr 17-Feb-2010 [878] | Those things shold be defined by Carl ASAP, as those are pretty fundamental. We talk about u-types for ages, but noone knows, how in fact those are they going to be implemented or how they will work in the end. Ditto for callbacks :-) |
BrianH 17-Feb-2010 [879x3] | BIND? - and it works in R2 as well. |
That's the equivalent to in object 'self, bind? object. | |
As for your first question, try a lit-word parameter like this: my-funct: funct ['parameter]... | |
older newer | first last |