World: r3wp
[Core] Discuss core issues
older newer | first last |
Graham 18-Jun-2006 [4896x2] | as this happens |
** User Error: ESMTP: Invalid command ** Near: insert smtp-port reduce [from reduce [addr] message] | |
Robert 18-Jun-2006 [4898x2] | Anton, why do the actual numbers for FOR matter? The thing is, those numbers are of type decimal! as my app has to use decimal! values for calculation. |
Has someone a nice function to extract tuples by level? For example: 1.0.0 1.1.0 1.2.0 2.0.0 2.1.0 I just need all 1st level tuples, than only the second level tuples etc. | |
Volker 18-Jun-2006 [4900] | tup: 1.2.3 i: 2 probe tup/:i ; ? |
Robert 18-Jun-2006 [4901x3] | I need the function to return only 1.0.0, 2.0.0 or 1.1.0, 1.2.0, 2.1.0 |
All tuples that have a specific level set. | |
I'm just playing around with a multiplier pattern like zero? (1.0.0 * 0.1.1). This works expect for the 3rd level. | |
Anton 18-Jun-2006 [4904x7] | Robert, I was just wondering what actually triggered your initial question. |
I thought perhaps we could refactor your original code to use WHILE or REPEAT etc.. | |
I'm not arguing with your main point, which seems to be that the current behaviour of FOR is uncomfortable in this respect. (Or is it deficient ?) | |
Robert, how about this ? | |
tuples-of-level: func [level tuples /local compare][ result: copy tuples remove-each tuple result [ repeat n length? tuple [ compare: get pick [<> =] n > level if compare 0 tuple/:n [break/return yes] ] ] ] ; test blk: [1.0.0 1.1.0 1.2.0 2.0.0 2.1.0] tuples-of-level 1 blk ;== [1.0.0 2.0.0] tuples-of-level 2 blk ;== [1.1.0 1.2.0 2.1.0] tuples-of-level 3 blk ;== [] tuples-of-level 0 blk ;== [] | |
This version should scale better. | |
tuples-of-level: func [level tuples /local compare][ result: copy [] foreach tuple tuples [ if repeat n length? tuple [ compare: get pick [<> =] n > level if compare 0 tuple/:n [break/return no] yes ][append result tuple] ] result ] | |
Robert 18-Jun-2006 [4911] | Cool... I had this idea with the comparators too but not to use pick and the level as the selector. Cool stuff! |
Anton 18-Jun-2006 [4912] | :) |
Rebolek 22-Jun-2006 [4913] | Has anybody noticed problems with files that have "%" in name? |
Anton 22-Jun-2006 [4914x3] | Yes, can't open them in WinXP. |
No, yes you can. | |
read %"Hi%there.txt" <-- this filename works | |
Rebolek 22-Jun-2006 [4917] | yes, but load mold %"Hi%there.txt" does not |
Anton 22-Jun-2006 [4918] | >> load mold "Hi%there.txt" == "Hi%there.txt" what version of rebol, what os ? |
Rebolek 22-Jun-2006 [4919] | 1.3.2 on WXP |
Anton 22-Jun-2006 [4920] | no, sorry, you're right. I missed the initial % |
Rebolek 22-Jun-2006 [4921] | I think % should be automatically translated to %25 (like space is translated to ) to prevent these problems |
Anton 22-Jun-2006 [4922] | It does not mold into a loadable string. --> RAMBO. |
Rebolek 22-Jun-2006 [4923] | OK, I'll post it |
Anton 22-Jun-2006 [4924] | Note also this bug! http://www.rebol.net/cgi-bin/rambo.r?id=3189& |
Rebolek 22-Jun-2006 [4925x2] | well, that's really strange. see this >> >> load mold to file! "[s-:-a]" ** Syntax Error: Invalid email -- %[s-:-a] ** Near: (line 1) %[s-:-a] >> load mold to file! "[aas-:-df]" == ª[s-:-df] |
everything in range from "aa@.." to "ff@.." produces the second result | |
Anton 22-Jun-2006 [4927] | Add this information with the link to #3189 to your report. They should insert it into the original bug report. |
Ladislav 23-Jun-2006 [4928] | these ways can be used to circumvent the filename character problems if needed: load {%"aaa%aa"} load "%aaa%25aa" |
Pekr 25-Jun-2006 [4929x3] | how to catch following error? error? try [to-date 29-Feb_2006] |
ok, putting date in a string helps ...trying to catch leap year ... | |
I don't like it - why rebol parser interrupts me so fast? | |
Gabriele 25-Jun-2006 [4932x2] | petr, in the above case (without the quotes), the error happens before rebol gets to evaluate the TRY. |
you need to put the LOAD or DO that are loading that code in a try block. | |
Pekr 26-Jun-2006 [4934x3] | it does not seem to work: error? try [load 29-Feb-2006] |
I would prefer 29-Feb-2006 error, as well as e.g. error? try [load 380.250.250] being a bit more relaxed in interpreter ... | |
how can I catch such syntax errors? | |
Graham 26-Jun-2006 [4937] | what is your problem? |
Ladislav 26-Jun-2006 [4938] | error? try [load "29-Feb-2006"] ; == true |
Pekr 26-Jun-2006 [4939x4] | the problems is uncatchable error |
I am not talking about string .... | |
I am not sure I can meet with such situation in real-life :-) I just got asked by Bobik. The thing was, that in sqlite date field there can be invalid date. Now I am not sure how is the conversion done, if via string, but if you simply type such invalid date in console, it can't be recovered, and that is my objection in general ... | |
shouldn't we be always able to recover from whatever error happens? | |
DideC 26-Jun-2006 [4943] | To be executed, a script is loaded in a whole. So each values is loaded/binded and your error appears at this time, not while the expression is evaluated. |
Pekr 26-Jun-2006 [4944] | do you mean that I can catch the error during load? but why loading value itself fails? |
Graham 26-Jun-2006 [4945] | what uncatchable error? |
older newer | first last |