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

World: r3wp

[Core] Discuss core issues

Terry
15-Jan-2005
[281]
ic.. here's another .. how can i determine if a 'word has been set 
yet, in the code?
Sunanda
15-Jan-2005
[282]
>> value? 'xx
== false
>> xx: 1
== 1
>> value? xx
== true
Terry
15-Jan-2005
[283x2]
what if i dont want to spin the value?  is there no way to check 
other than trying it?
or wait.. nvm :)
Sunanda
15-Jan-2005
[285]
Value? 'xx shouldn't "do" anything with the word being tested-- so 
it should be safe at all times
Or am I missing your point?
>> xx: func [] [print "hello"]
>> value 'xx
>> value? 'xx
== true      -- does not print "hello"
Terry
15-Jan-2005
[286]
no, I read your post too quickly
Geomol
19-Jan-2005
[287]
I often wonder, why 'while' takes a condition-block, when 'if' doesn't. 
Is there an explanation for that?
Ladislav
19-Jan-2005
[288]
of course. The IF condition is evaluated once, while WHILE condition 
may be evaluated many times.
Gabriele
19-Jan-2005
[289]
Geomol, if you try to write your implementation of WHILE, you'll 
immediately see the reason. :)
Geomol
19-Jan-2005
[290]
Thanks! :-)
Ashley
20-Jan-2005
[291]
Given that we have a 'read-net func, would a 'write-net equivalent 
make sense? (could then have a [view] 'request-upload func to match 
'request-download)
Geomol
22-Jan-2005
[292]
Did I just found an error with replace? Try these:
>> replace/all "abc{def" "{" "^^{"
== "abc^^{def"
>> replace/all "abc{def" "{" "^{"
== "abc{def"

So I can't get a result with just one ^?
Volker
22-Jan-2005
[293]
^^^{ ? a "^{" is the same as a "{". To allow {this ^{ is a paren} 
 .
Geomol
22-Jan-2005
[294]
>> replace/all "abc{def" "{" "^^^{"
== "abc^^{def"
Volker
22-Jan-2005
[295x2]
Yes thats right. Its molded. "^" is escaped, the escape-char is "^"..
print replace/all "abc{def" "{" "^^^{"
Geomol
22-Jan-2005
[297x4]
yes, seems right
The result is 8 bytes.
But
s: {this ^{ is a paren}
gives an error: ** Syntax Error: Invalid string
>> s: "this ^{ is a paren"
works ok.
Volker
22-Jan-2005
[301]
works on 1.2.48.4.2 . what are you using?
Geomol
23-Jan-2005
[302x3]
1.2.57.3.1
I'm trying to build a string with rebol content inside (also strings). 
And I get into trouble. I think, it's a bug. Try this:
>> s: "^"abc^/def^}ghi^""
== {"abc
def^}ghi"}
>> to-block s
** Syntax Error: Invalid string -- "abc
** Near: (line 1) "abc
This works:
>> s: "^"abc^""
== {"abc"}
>> to-block s
== ["abc"]

so my example above should work too, right?
Sunanda
23-Jan-2005
[305]
Looks like to-block isn't noticing the carat:
>> to-block "^{}"
== [""]
>> to-block "^{"
** Syntax Error: Invalid string -- {
** Near: (line 1) {
Geomol
23-Jan-2005
[306x3]
I don't think, you can have a block with only a '{' inside. REBOL 
will think of it as the start of a string. If you put '{' in between 
"", you don't have to use caret, but you can:
>> to-block "^{^}"
== [""]
>> to-block "{}"
== [""]

I think, my problem start, when I have a newline before a '{':
>> to-block "^"^/{^""
** Syntax Error: Invalid string -- "
** Near: (line 1) "
Because this works:
>> to-block "^"{^""
== ["{"]
I figure, the problem is with strings, not with to-block or any other 
command.
[unknown: 5]
23-Jan-2005
[309]
Probably because the caret can be used even in strings and used for 
line termination formatting etc..
Geomol
23-Jan-2005
[310]
I would be ok with reporting this to RAMBO, but would like to be 
sure, it's a bug first. (I don't like too much in RAMBO, if it's 
not a bug anyway.)
Anton
24-Jan-2005
[311]
Can you give an example of your input and final desired output ?
Geomol
24-Jan-2005
[312x3]
Input:
Input: "^"^/{^""

That's a string with 4 bytes: A ", then a newline, a { and another 
".
Operation: to-block
Desired output: ["^/{"]

That's a block with a string, that consists of 2 bytes: a newline 
and a {.

If this can be solved, then I can solve my other problems, I think. 
(Same goes with } btw.)
Maybe it's easier to see, if I use binary:
>> b: #{220A7B22}	; That's my input string as binary.
Try these:
>> to-string b
>> to-block b
The last one will fail, but it should give me:
== ["^/{"]
sqlab
24-Jan-2005
[315x3]
>> s: input
^/{
== {"^^/^{"}
>> to-block s
== ["^/{"]
>> print s
^/{
>> print to-block s

{
>>
Is that what you want?
I guess as soon as you have a newline in your string you should start 
the string with { and not with "
Geomol
24-Jan-2005
[318x3]
Interesting!
I would just think, that I should write the string like this then:
>> s: {"^/^{"}
but that's not a string for some reason!?
Thanks sqlab. I'll see, if your way can solve my problem, when I 
get home later today.
sqlab
24-Jan-2005
[321]
Why do you think, that this is no string?
eFishAnt
24-Jan-2005
[322]
>> s: "^/{"
== "^/{"
>> type? s
== string!
sqlab
24-Jan-2005
[323]
It's the molded representation of an internal string
Geomol
24-Jan-2005
[324x2]
Try it!
You get a new line with { in the beginning. That's REBOL way to tell 
you, you haven't finished your string. Like this:
>> s: {"^/^{"}
{

if I put in a } to finish the string, I get:
{    }
** Syntax Error: Invalid string -- }
** Near: (line 2) }
sqlab
24-Jan-2005
[326]
I see, the problem arises when you type it.
Geomol
24-Jan-2005
[327]
I would initially think, that {"^/^{"} would be a valid string with 
4 chars inside. 2 ", 1 newline and one {, but it isn't.
sqlab
24-Jan-2005
[328]
Did you check if it is the same behaviour when loading from a file?
Geomol
24-Jan-2005
[329]
yes
sqlab
24-Jan-2005
[330]
I have seen different behaviour from typing in the console and loading 
from a file

for example
>> func: [;  []]
** Syntax Error: Missing ] at end-of-script
** Near: (line 1) func: [;  []]
>>