list joining, modifying questions

I'm getting some unexpected results when running the following code:
to openRunControl options
    (* Determine pc, make sure navigator view is open *)
    [color=blue]log options[/color]
	...
    if options's tac_fu_sw is not empty
        set options's tac_fu_sw to options's tac_fu_sw &&& (rc_stay_open: true)
        openTacFuSw options's tac_fu_sw
    end if
	...
End openRunControl

to openTacFuSw options
	...
    [color=orange]Log options[/color]
    set the duplicatepropertykeymode to last //stay_open will overwrite old stay_open intended for run control dialog
    openRunControl (stay_open:true) &&& options
    [color=violet]log (stay_open:true) &&& options[/color]
    Click "run control/tac fu sw"  
	...
    if options's rc_stay_open is empty or options's rc_stay_open is false
        closeRunControlDialog
    end if
end openTacFuSw

openRunControl is called like this: openRunControl (battery_activate:(all:"enable"), dpaps:"applied", perm_to_fire:"ic", tac_fu_sw:(all:"ready"), tactical_trigger:"depressed")

and produces these log messages:
log wrote:
2011-02-09 12:03:10.156 -0500 log (battery_activate:(all:"enable"), dpaps:"applied", perm_to_fire:"ic", tac_fu_sw:(all:"ready"), tactical_trigger:"depressed")
...
2011-02-09 12:03:13.126 -0500 log ((all:"ready"),(rc_stay_open:"true"))
2011-02-09 12:03:13.173 -0500 log ((stay_open:"true"),(all:"ready"),(rc_stay_open:"true"))
...
2011-02-09 12:03:16.194 -0500 log ((stay_open:"true"),(all:"ready"),(rc_stay_open:"true"))

I don't understand why the &&& operator is producing nested lists. This is not the behavior i see in the manual's examples (although those examples are with normal lists and not property lists).

As a workaround, i tried replacing the line
openRunControl (stay_open:true) &&& options
with
replace property (stay_open: true) of options
openRunControl options

And I got the following error:
log wrote:
2011-02-09 12:36:02.316 -0500 FAILURE Screen_Error.png Invalid Parameters Invalid Parameter -- destination of Replace Properties command must be an object that is modifiable

Why wouldnt options be modifiable?

Thanks for any help.

Comments

  • here's the example i was looking at:
    To join two lists as one (without nesting), the &&& operator may be used:
    put (3,4,5) into tr1 -- (3,4,5)
    put (5,12,13) into tr2 -- (5,12,13)
    put tr1 &&& tr2 into longList -- (3,4,5,5,12,13)
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    Despite the similarity in names, lists and property lists are different types of structures. The &&& operator combines values into a list. If the operands are both lists, they are joined into a single list. But if the operands are property lists, then a list is created containing each property list as a separate value in the new list.

    To combine two property lists, take a look at the 'adding properties' or 'replacing properties' operators (the word 'properties' is optional). They produce results similar to these:
    put (a:1,b:2) adding (b:3,c:4)
    --> (a:"1", b:"2", c:"4")
    put (a:1,b:2) replacing (b:3,c:4)
    --> (a:"1", b:"3", c:"4")
    
    I hope that helps.
Sign In or Register to comment.