The Solution of Enigma about Ladislav sameness
[1/8] from: rotenca:telvia:it at: 29-May-2002 16:17
ATTENTION!
This is the solution of the sameness problem (followed by some comments):
------------------------------------------------
a: #{31}
parse/all a [b:]
------------------------------------------------
The interesting fact is that this is the only case (i know) where the same
data has two different datatype in Rebol.
Said in other words: two different datatypes share the same data.
In the above example, every string you insert in be, will appear "binaryzed"
in a:
insert b "^-^/^@" ;== "1"
a ;== #{090A0031}
The trick works on every any-string datatype: file!, url!, tag!, email!,
image!, issue! (i did not test all of them). An example with file!:
>> a: %1 ;== %1
>> parse/all a [b:] ;== false
>> insert b "^-^/^@" ;== "1"
>> a ;== %%09%0A%001
It could be useful to change the datatype of some data on the fly, without
copying it like the function TO do.
Who find the right solution?
1) Ladislav
2) Gabriele Santilli
---
Ciao
Romano
[2/8] from: lmecir:mbox:vol:cz at: 29-May-2002 23:37
Hi Romano,
<<Romano:>>
The interesting fact is that this is the only case (i know) where the same
data has two different datatype in Rebol.
<</Romano>>
Have a look at the ERROR! datatype to see another example of this
Ciao
-L
[3/8] from: rotenca:telvia:it at: 30-May-2002 0:50
Hi Ladislav,
>Have a look at the ERROR! datatype to see another example of this
As usual! :-)
So we have:
string! / any-string! (parse)
block! / hash! (parse)
object! / error! (disarm)
A parse bug makes list! fail.
No more?
Thinking to error!: could be introduced a global option to disarm exception on
error!, this could also "fill" some security hole and leave unchanged the
default behaviour.
---
Ciao
Romano
[4/8] from: lmecir:mbox:vol:cz at: 30-May-2002 10:19
Hi,
<<Romano>>
>Have a look at the ERROR! datatype to see another example of this
As usual! :-)
So we have:
string! / any-string! (parse)
block! / hash! (parse)
object! / error! (disarm)
A parse bug makes list! fail.
No more?
<</Romano>>
I wonder, whether the block! to hash! really works correctly (i.e. cannot
cause any data mismatches)?
I have observed this behaviour:
a: first [()]
parse :a [b:]
append b 'a
probe :a
a: first [a/b]
parse :a [b:]
append b 'a
probe :a
a: first [a/b:]
parse :a [b:]
append b 'a
probe :a
a: first ['a/b]
parse :a [b:]
append b 'a
probe :a
Ciao
-L
[5/8] from: lmecir:mbox:vol:cz at: 30-May-2002 10:27
Hi,
another possibility:
a: ['a/b]
b: first a
c: do a
insert tail :c 'a
probe :b
Ciao
-L
[6/8] from: rotenca:telvia:it at: 30-May-2002 17:42
Hi Ladislav,
> another possibility:
>
> a: ['a/b]
> b: first a
> c: do a
> insert tail :c 'a
> probe :b
THE GROWING LIST:
string! / any-string! (parse)
block! / hash! (parse)
block! / paren! (parse)
object! / error! (disarm)
block! / lit-path set-path! path! (parse)
path! / lit-path! (do - evaluation)
For path! / lit-path! and evaluation, see:
a: to-lit-path 'k
b: a
---
Ciao
Romano
[7/8] from: rotenca:telvia:it at: 30-May-2002 17:59
Hi Ladislav,
> I wonder, whether the block! to hash! really works correctly (i.e. cannot
> cause any data mismatches)?
Not tested well. But i have found this fun challenge to sameness and
reflection:
x3: make hash! [1] ;== make hash! [1]
parse/all x3 [x4:] ;== false
insert/only x3 x3 ;== make hash! [1]
x3 ;== make hash! [make hash! [...] 1]
x4 ;== [make hash! [...] 1]
type? x4 ; == block!
type? x4/1 ;== hash!
Question:
What does means [...]?
Answer:
mut-equal1?
---
Ciao
Romano
[8/8] from: lmecir::mbox::vol::cz at: 30-May-2002 23:40
Hi all,
uploaded a new version of:
http://www.rebolforces.com/~ladislav/evaluation.html
underlining the newly discussed matters.
Have a look at it
Ciao
-L