私は、 @Craige_Hales の優れた回答「変数名ではなく変数/式の内容を新しいスクリプトに挿入する」をスクリプトを組み合わせて拡張したいと考えていますが、構文がわかりません。これを機能させるためのアイデアはありますか?
私はJMP 18.1.2を使用しています
Names Default To Here( 1 );
dt = New Table( "My Table" );
e1 = Expr(
Print( "Run some code." )
);
e2 = Expr(
Print( "Run some other code." )
);
e3 = Expr(
Parse( Eval Insert( "\[
^e1^;
^e2^;
]\" ) )
);
// These work.
Eval( Eval Expr( dt << New Script( "Test 1", Expr( Name Expr( e1 ) ) ) ) );
Eval( Eval Expr( dt << New Script( "Test 2", Expr( Name Expr( e2 ) ) ) ) );
// This does not work.
Eval( Eval Expr( dt << New Script( "Test 3", Expr( Name Expr( e3 ) ) ) ) );
e3を印刷して内容を確認してください
Name Expr(e3) = Parse(Eval Insert("
^e1^;
^e2^;
"));
これはおそらくあなたが探しているものを実現するでしょう
Names Default To Here(1);
dt = New Table("My Table");
e1 = Expr(Print("Run some code."));
e2 = Expr(
Print("Run some other code.")
);
e3 = Parse(Eval Insert("\[
^Name Expr(e1)^;
^Name Expr(e2)^;
]\"));
Eval(Eval Expr(dt << New Script("Test 3", Expr(Name Expr(e3)))));
デバッグが大変なので、私は通常Parseの使用を避けます。
Names Default To Here(1);
dt = New Table("My Table");
e1 = Expr(Print("Run some code."));
e2 = Expr(
Print("Run some other code.")
);
e3 = EvalExpr(
Expr(Name Expr(e1));
Expr(Name Expr(e2));
);
Eval(Eval Expr(dt << New Script("Test 3", Expr(Name Expr(e3)))));