Home   Archive   Permalink

Block problem

a1: pick notes 2 ; notes is a block
a/text: decloak a1 "key" ; 'a' is a text area
probe notes/2
The probe function shows that the contents of the second block item has been decloaked.
I do NOT want that; I only want the DISPLAYED text to be decloaked.
Please help me!

posted by:   Jma       27-Jan-2014/9:27:11-8:00

Answering for Nick:
DECLOAK modifies the string and you are with PICK NOTES 2 referencing the second string in the block, the original string.
The solution would be:
a1: copy pick notes 2
Check the help for DECLOAK:
>> ? decloak
     DECLOAK data key /with
     Descrambles the string scrambled by encloak.
     DECLOAK is a native value.
     data -- String to descramble (modified) (Type: any-string)
     key -- Key to use (Type: any-string)
     /with -- Use key as-is (for speed, no hashing)
For the DATA argument, it says (modifies). There's the culprit.

posted by:   Henrik       27-Jan-2014/10:03:06-8:00

Thanks Henrik :)
JMA, you could also use:
     a/text: decloak copy a1 "key"
As long as you make a copy of the value sent to the 'decloak function, the original value won't get modified.
The same thing is true of 'sort. 'Sort doesn't just return a sorted value - it modifies the original unsorted list argument. To keep that from happening, a copy of the list must be sorted:
     n: [5 7 2 8 1]
     probe sort copy n
     probe n
     probe sort n
     probe n

posted by:   Nick       27-Jan-2014/21:53:21-8:00