cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to see how to import and prepare Excel data on Jan. 30 from 2 to 3 p.m. ET.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
hogi
Level XIII

from a name to a string

To remove a symbol, I can write:

y=6;
mySymbol = Expr(y);
//Delete Symbols("y"); 
////Delete Symbols(y); // <- easy
Eval(Eval Expr(Delete Symbols(Expr(Name Expr(mySymbol)))));
Show symbols()

If I need to remove a symbol from a namespace, I need the string of the symbol:

Names Default To Here( 1 );
nsref = New Namespace(
	"ns"
);
ns:x = 20;

mySymbol = Expr( x );

//nsref << Remove("x")

Eval(
	Substitute(
			Expr(
				nsref << Remove( _sym_ )
			),
		Expr( _sym_ ), Substitute( Expr( Char( __sym__ ) ), Expr( __sym__ ), Name Expr( mySymbol ) )
	)
);


s = NameExpr( mySymbol );  
str = Char(s) );  // Name not defined        
Show( str );

 

What is the right syntax for 

Char(s)

?

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: from a name to a string

Head Name(expr) ?

Names Default To Here(1);

ms = Expr(x);
Head Name(ms); // "x"

 

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: from a name to a string

Head Name(expr) ?

Names Default To Here(1);

ms = Expr(x);
Head Name(ms); // "x"

 

-Jarmo
hogi
Level XIII

Re: from a name to a string

many thanks, @jthi 

Recommended Articles