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

World: r3wp

[Core] Discuss core issues

PeterWood
29-Sep-2006
[5487]
>> a: 72
== 72
>> to char! a
== #"H"
>> b: #{48656C6C6F}
== #{48656C6C6F}
>> to string! b
== "Hello"
Maxim
29-Sep-2006
[5488]
sometimes REBOL is to simple.  we forget that it can be as simple 
as that.  ;-)
Gabriele
30-Sep-2006
[5489]
graham: i think mine dies because of the wrong quoting, not empty 
fields, but i haven't tested it. i would actually be surprised to 
see a csv parser that handles quoting that way, because the only 
way to handle them is to ignore them.
Anton
30-Sep-2006
[5490]
Gordon, use TO-STRING or AS-STRING.
MikeL
30-Sep-2006
[5491]
Gordon, This may be too obvious to mention but if you know it is 
not a binary file then don't read it with the /binary refinement 
then you won't need to convert.
Gordon
30-Sep-2006
[5492]
Hi guys;
  Thanks for the input.


PeterWood & Anton:  I could have sworn that I tried both to-char 
and to-string.  It is the obvious answer, but I have been trying 
so many things in solving a parse problem that I missed it.  Now 
I remember, I did try them but at the time I complicated the character 
testing by using quotes and brackets and braces, or in the case of 
the hex string - not using the #{}.  Anyway, thanks for your time 
in answering. 


Gabriele:  As I was waking up this morning, I was thinking about 
modifying your CVS parser to make it work with (improperly) quoted 
strings.  That may be the simplier answer to my parsing problem.


MikeL: I started by not using the /binary but then the 'read' converts 
the #{0D0A} sequences to just #{0A} so I was going to try using the 
/binary option to preserve the original #{0D0A} and got sidetracked 
into changing the rest of the file back into a string.  Turns out 
that I will be going back to just using the 'read' without the /binary 
option and try modifying Gabriele's, CVS parser to handle improperly 
embedded quotes.
Gabriele
30-Sep-2006
[5493x2]
gordon, can you just ignore the quotes? (if you know they are not 
really relevant in your file)
(ie in my code allow " in the charset and remove the quoted field 
rule)
Rebolek
5-Oct-2006
[5495]
I'm not sure, if I like that:

>> to integer! ""
== 0
Ladislav
5-Oct-2006
[5496]
would you prefer an error to be caused?
Henrik
5-Oct-2006
[5497]
maybe a list of  how rebol converts empty values to other types would 
be in order
Sunanda
5-Oct-2006
[5498]
1.2.1 and early do give an error in this case.
So, at the very least., its an undocumented change of behaviour.
Henrik
5-Oct-2006
[5499]
RAMBO it?
Rebolek
5-Oct-2006
[5500]
Ladislav I expected error! but I'm not sure about that
Gabriele
5-Oct-2006
[5501x3]
>> to decimal! ""
** Script Error: Invalid argument:
** Near: to decimal! ""
one of the two needs to be changed. :)
(i believe this is in rambo already, you should do a search first)
Anton
5-Oct-2006
[5504]
I think I prefer the error.
Maxim
5-Oct-2006
[5505x2]
this is where as-integer and as-decimal make sense IMHO.   return 
the most logical representation of supplied value, with a defined 
fall back when no sense can be made of input.
but the rules must be clearly documented, in any case.
Rebolek
6-Oct-2006
[5507]
The bug is in RAMBO (RAMBO Ticket #3928) for 352 days. Seems hard 
to fix ;)
Gabriele
6-Oct-2006
[5508]
if you guys think it should have a higher priority, i can raise it.
Rebolek
6-Oct-2006
[5509]
It will be good to know what is typical longevity of bugs according 
to their priority.
Henrik
6-Oct-2006
[5510]
Ladislav posted on 18. sep.: do you like this: any [1 true] ; == 
1 ?

I have a variant: any [false none] ; == none


Would it make more sense to return FALSE? It seems to me that FALSE 
should have precedence over NONE.
Gregg
6-Oct-2006
[5511]
False and none are treated the same in many cases, so I think it's 
fine the way it is; otherwise you have to consider all the other 
cases as well.
Henrik
6-Oct-2006
[5512]
well:

pick [do-this do-that] false ; == does 'do-that

pick [do-this do-that] none ; == error

This came from a function where I had a refinement:

f: func [/act] [
	pick [do-this do-that] act
]


You can't do that, since /act is none. Sure you can then use EITHER, 
if do-this and do-that are not necessarily in one block, but you 
couldn't extend the existing code with:


>> pick [do-this do-that] any [act false] ; == still none, which 
gives error

So you have to use something less clean like:

>> pick [do-this do-that] any [act 2]
Rebolek
6-Oct-2006
[5513]
you can do
>>pick [do-this do-that] found? any]
Ladislav
6-Oct-2006
[5514]
I pulled out the question, sorry, it was a misread at my side
Rebolek
6-Oct-2006
[5515]
argh, again:

>>pick [do-this do-that] found? act
Ladislav
6-Oct-2006
[5516]
I am content with it as it is
Henrik
6-Oct-2006
[5517]
rebolek, thanks. as long as there is a way to discern between none 
and false with one function
Ladislav
6-Oct-2006
[5518]
some interesting block "quirks":

    block1: #[block! [a b] -1] none
    block2: #[block! [a b] 4] none
    mold/all block1 ; == "#[block![a b]-1]"
    mold/all block2 ; == "#[block![a b]4]"
    index? block1 ; == -1
    index? block2 ; == 3
    length? block1 ; == 4
    length? block2 ; == 0
Maxim
6-Oct-2006
[5519x2]
all and any are extremely capable as they are.  and I  don't see 
why they should change.  all and any are NOT boolean operations, 
they are program flow just like if and either.
'ANY on returns a non false or non none value.  it does not return 
such a value from the block itself. if you specify only none and 
false value, it effectively assumes all is bad and returns none.


'ALL is the same, but will only return a value unless one value equates 
to false or none (in which case it considers the block a failure 
and returns its own value, not the value from the block itself).
Robert
9-Oct-2006
[5521]
Gab, the same applies for:

This doesn't look very consisten to me:

>> to-integer none
== 0
>> to-decimal none
** Script Error: Invalid argument: none
** Where: to-decimal
** Near: to decimal! :value
Gabriele
9-Oct-2006
[5522]
yes, i agree. i think other cases like that have been pointed out 
in the past.
Ladislav
9-Oct-2006
[5523x2]
I don't know how INDEX?/XY works. Help, please.
(is it meant for IMAGE! datatype?)
Rebolek
9-Oct-2006
[5525]
Ladislav: it seems so:

>> n: make image! 100x100
== make image! [100x100 #{
000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000...
>> n: skip n 300
== make image! [100x100 #{
000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000...
>> index?/xy n
== 0x3
Ladislav
9-Oct-2006
[5526]
thanks
Rebolek
9-Oct-2006
[5527]
I'm curious, if there's also some function for setting position in 
image! - something like AT/xy
Anton
9-Oct-2006
[5528]
There is:
>> at logo.gif 12x10
== make image! [100x24 #{
7C7C7CF5F5F5FEFEFEFEFEFEB5B5B5020202020202020202020202020202
020202020202BDBDBDFEFEFEFEFEFEF5F5F5A5A5A59B...
Rebolek
9-Oct-2006
[5529]
Ah, thanks

>> index?/xy at logo.gif 12x10
== 12x10
Louis
9-Oct-2006
[5530]
mail: read pop://user:[pass-:-mail-:-example-:-com]


How should the above line be written when the user name is an email 
address?
PeterWood
9-Oct-2006
[5531x2]
You should find the answer here: http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-topic-index.r?i=mail
or here: 

http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-thread.r?m=rmlFSJQ
Louis
10-Oct-2006
[5533x2]
Thank you, Peter!
Problem: no matter which email client I use, only 8 emails can be 
downloaded. On the 9th email the client locks up. What can I do about 
this? I am expecting some very important email.
PeterWood
10-Oct-2006
[5535x2]
Try dowloading DideC's excellent delete-mail program - http://membres.lycos.fr/didec/rebsite/delete-emails/delete-emails3.0.0.html
It will let you look at the headers of the mail in your mailserver's 
inbox.