Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- file=FileNameJoin[{NotebookDirectory[],"squares.m"}];
- Export[file,If[Length[$ScriptCommandLine]==1,
- Print["No expressions were given to square."],
- args = Rest[$ScriptCommandLine];
- squares = Quiet @ Map[Replace[ToExpression[#], {$Failed:>ToString[#,InputForm]^2, x_ :> x^2}]&, args];
- MapThread[Print["The square of ", #1, " is ", #2, "."]&, {args, squares}]
- ],"Text"];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement