World: r3wp
[Core] Discuss core issues
older newer | first last |
Ladislav 16-Jan-2007 [6732x2] | yes, Rebolek, that is a good suggestion solving the issue |
so to file! " " should be %%2520 while to file! "^(20)" should be % , right? | |
Rebolek 16-Jan-2007 [6734] | yes, I think so. Little bit messy, I think. |
Ladislav 16-Jan-2007 [6735] | do I understand correctly that you don't like it? (do you want something better then?) |
Maxim 16-Jan-2007 [6736] | we want the whole truth , NOW , (sorry... chit chat seems to infect me somtimes) |
Geomol 16-Jan-2007 [6737] | Good points here! :-) I now see the problem. It might be best to return an error, when subtracting 1 from the lowest value of a date. Make sure, you think it through as much as you can, and then be consistent. If one datatype return an error in such a situation, another might as well. |
Ladislav 16-Jan-2007 [6738] | Date again to be specific, I think, that REBOL has to pass this tests (and similar): any [ error? try [date-d: 1/Jan/0000 - 1] not error? try [load mold date-d] ] |
Maxim 16-Jan-2007 [6739] | I agree |
PeterWood 16-Jan-2007 [6740] | On the subject of date! and values having meaning. I think that the zone refinement needs to be looked at again: >> dt: 17-Jan-2007/9:52+25:00 == 17-Jan-2007/9:52+25:00 but >> 17-jan-2007/9:55+5:45 ** Syntax Error: Invalid date -- 17-jan-2007/9:55+5:45 ** Near: (line 1) 17-jan-2007/9:55+5:45 To the best of my knowledge +25:00 is not a valid time zone offset but +5:45 is (Nepal). |
Gabriele 17-Jan-2007 [6741] | zone has a resolution of 30 minutes. it is indeed a problem for a couple zones (like the one you pointed out). |
PeterWood 17-Jan-2007 [6742x2] | Not handling the 45 minute zones (I don't think that there are any 15 minute zones) isn't a big problem. Its the inconsistency that bugs me - GMT +25:00 is a less correct value than GMT +5:45. |
..to me. | |
Gabriele 17-Jan-2007 [6744] | yep, but rebol is not actually doing sanity checks on zones. the 45 problem is only due to a limitation of the implemetation. |
Ladislav 17-Jan-2007 [6745] | it looks, that the current zone range is -32:00 to +31:30. The range can be transformed to -16:00 to +15:45, which should be sufficient, shouldn't it? |
Geomol 17-Jan-2007 [6746x2] | A day no Mars is 24.6 hours, so I think, we're ok with -16:00 to +15:45 timezone. |
A day *on* | |
Chris 17-Jan-2007 [6748x6] | uses: func [args [block!] spec [block!][ args: context args func [options [block!] compose/only [ options: make (args) options do bind (spec) in options 'self ] ] |
Usage: >> f: uses [x: y: 1][print y] >> f [] 1 >> f [y: 2] 2 | |
Although arguments for any 'uses based functions must be contained in a block, it does allow for optional arguments with preset values. | |
Any suggestions/bugs? | |
Hmm, lost a close bracket in a VNC post... | |
uses: func [args [block!] spec [block!]][ args: context args func [options [block!]] compose/only [ options: make (args) options do bind (spec) in options 'self ] ] | |
Ladislav 17-Jan-2007 [6754] | does anybody know if there is any difference between negate bitset and complement bitset ? |
Gabriele 17-Jan-2007 [6755] | i think they are the same. |
Anton 17-Jan-2007 [6756] | That looks pretty good, Chris. Can you post any examples where you used it ? |
Volker 17-Jan-2007 [6757] | how about locals too? then you have closures. And itdoes not work recursively, how about copying the body when binding? |
Anton 17-Jan-2007 [6758] | Locals ? You can have as many locals as you want in the args block. |
Volker 17-Jan-2007 [6759] | true, everything is optional. late here^^ |
Maxim 17-Jan-2007 [6760] | a part for a little bit of excentricity on your part... do the trailing ^^ you add on most/all post mean something I have been missing? |
Chris 17-Jan-2007 [6761x4] | Anton, I don't have any good samples at the moment -- it's part of an unfinished project. I'll try and come up with some based on the usage requirements I have. |
I see it mostly as an alterate way of writing functions that would otherwise require many refinements. The benefit being neater presentation. | |
print-cgi: uses [ status: 200 type: 'text/plain content: "" location: %/ ][ print switch status [ 200 [rejoin ["Content-Type: " type "^/^/" content]] 302 [join "Status: 302^/Location: " location] ] ] print-cgi [content: "Text"] print-cgi [type: 'text/html content: "<html>Text</html>"] print-cgi [status: 302 location: http://www.rebol.net/] | |
A quickie example, but illustrates the flexibility and readability. | |
Anton 18-Jan-2007 [6765] | Nice one. |
PeterWood 18-Jan-2007 [6766x3] | Ladislav: -16:00 to +15:45 is more than enough according to Wikipedia Because the earliest and latest time zones are 26 hours apart, any given calendar date exists at some point on the globe for 50 hours. For example, April 11 begins in time zone UTC+14 at 10:00 UTC April 10, and ends in time zone UTC-12 at 12:00 UTC April 12. Full story at http://en.wikipedia.org/wiki/Timezones |
And a list of all the current (and a few old ones) at http://en.wikipedia.org/wiki/UTC%2B0 | |
UTC-0:25 was used in Ireland as Dublin Mean Time. In 1916 the time was changed to GMT. (Thankfully!) | |
Ladislav 18-Jan-2007 [6769] | :-D |
Oldes 19-Jan-2007 [6770] | I have a question, I have this code: >> b: "1234str" ri: func[b /local i][i: copy/part b 4 b: skip b 4 i] probe ri b probe b 1234 1234str Why the b string is not "str" ? |
Cyphre 19-Jan-2007 [6771] | Here is the explanation: >> a: "1234" == "1234" >> b: a == "1234" >> b: skip b 2 == "34" >> a == "1234" >> b == "34" >> |
Ladislav 19-Jan-2007 [6772x3] | ...because the index attribute of REBOL series is not volatile. |
Cyphre - I doubt this explains it | |
correction : the index attribute of REBOL any-blocks and any-strings is not volatile | |
Oldes 19-Jan-2007 [6775] | Ok, so how should I write the code, which will eat the 4 chars and change the position if I don't want to return the new b from the function |
Ladislav 19-Jan-2007 [6776] | as I said: you cannot change the index of a series, so the only possibility is to share the variable |
Cyphre 19-Jan-2007 [6777] | Ladislav, I though the 'b in function 'ri is different from the 'b in global context so that's why the index differs. |
Ladislav 19-Jan-2007 [6778] | actually the error lies in the fact, that many users think, that SKIP changes the index of a series. It actually doesn't: b: "1234" index? skip b 2 ; == 3 index? b ; == 1 |
Oldes 19-Jan-2007 [6779] | but than it's quite useless... I wanted to do a function read-integer buffer and etc. and make it universal:( I know, I can set buffer as global variable (or in the context) and do just read-integer etc. |
Ladislav 19-Jan-2007 [6780x2] | you don't have to, the following works too: |
ri: func [b [word!] /local i] [i: copy/part get b 4 set b skip get b 4 i] | |
older newer | first last |