Quantcast
Channel: Behaviour of `ToExpression` inside a function definition - Mathematica Stack Exchange
Browsing all 2 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Answer by Nasser for Behaviour of `ToExpression` inside a function definition

It is because "arr" inside string do not bind to the input argument. You have to do it separatly.a = {{1, 2}, {3, 4}};f[arr_] := ToExpression[ToString[arr] <> "[[1,1]]"]And now it worksBut this...

View Article


Behaviour of `ToExpression` inside a function definition

I want to create a function that takes in an array of unknown size and do some index operations on it. I am using strings to construct the expression and then trying to use ToExpression for evaluating...

View Article
Browsing all 2 articles
Browse latest View live