mathlink-0.1.0.0: examples/mltest.nb
(* Content-type: application/mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 7.0' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 145, 7]
NotebookDataLength[ 6650, 216]
NotebookOptionsPosition[ 5513, 170]
NotebookOutlinePosition[ 5872, 186]
CellTagsIndexPosition[ 5829, 183]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"SetDirectory", "[", "\"\<~/hs/mathlink/examples/\>\"",
"]"}]], "Input",
CellChangeTimes->{{3.439309979806336*^9, 3.439310029119624*^9}, {
3.439504790090583*^9, 3.439504790564527*^9}}],
Cell[BoxData["\<\"/home/twadleigh/hs/mathlink/examples\"\>"], "Output",
CellChangeTimes->{{3.439504769908993*^9, 3.439504791247632*^9},
3.440168667032764*^9, 3.440177535376698*^9, 3.4401803149179897`*^9}]
}, Open ]],
Cell[TextData[{
"Wrapping the ",
StyleBox["MathLink",
FontSlant->"Italic"],
" executable in a shell script is a nice way to pass extra arguments to the \
GHC RTS without interferring with the command line arguments that ",
StyleBox["MathLink",
FontSlant->"Italic"],
" needs to pass to establish the connection."
}], "Text",
CellChangeTimes->{{3.440168766081661*^9, 3.440168924034021*^9}}],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"lnk", "=",
RowBox[{"Install", "[", "\"\<mltest.sh\>\"", "]"}]}]], "Input",
CellChangeTimes->{{3.439310037308844*^9, 3.4393100665348454`*^9}, {
3.4393123483575773`*^9, 3.439312353820722*^9}, {3.439313763736014*^9,
3.439313786830782*^9}, {3.439314248568095*^9, 3.439314249330996*^9}}],
Cell[BoxData[
RowBox[{"LinkObject", "[",
RowBox[{"\<\"/home/twadleigh/hs/mathlink/examples/mltest.sh\"\>", ",", "8",
",", "8"}], "]"}]], "Output",
CellChangeTimes->{3.44016866928712*^9, 3.440177537593532*^9,
3.440177639653508*^9, 3.44017776858574*^9, 3.440178011557703*^9,
3.440180317121654*^9}]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"AddTwo", "[",
RowBox[{"2", ",", "3"}], "]"}]], "Input",
CellChangeTimes->{{3.43931006947751*^9, 3.43931007209233*^9}}],
Cell[BoxData["5"], "Output",
CellChangeTimes->{3.44016867170964*^9, 3.4401775395852757`*^9,
3.440177642067905*^9, 3.440177770296537*^9, 3.440178013081019*^9,
3.440180318765966*^9}]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"ReverseNumbers", "[",
RowBox[{
"1", ",", "2", ",", "3", ",", "\[ImaginaryI]", ",", "\[ExponentialE]", ",",
"\[Pi]"}], "]"}]], "Input",
CellChangeTimes->{{3.4401687018512993`*^9, 3.440168712601337*^9}, {
3.440180321606152*^9, 3.440180358834758*^9}}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
"3.141592653589793`", ",", "2.718281828459045`", ",", "0.`", ",", "3.`",
",", "2.`", ",", "1.`"}], "}"}]], "Output",
CellChangeTimes->{
3.440168712981926*^9, 3.440177541747458*^9, 3.4401776436073923`*^9,
3.440177771845735*^9, 3.4401780146157618`*^9, {3.440180323067984*^9,
3.440180359740733*^9}}]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"GreetWorld", "[", "]"}]], "Input",
CellChangeTimes->{{3.440168718131279*^9, 3.4401687204719067`*^9}}],
Cell[BoxData["\<\"Hello, world!\"\>"], "Output",
CellChangeTimes->{3.4401687210248337`*^9, 3.440177543338463*^9,
3.4401776462215652`*^9, 3.440177773588876*^9, 3.440178015619836*^9,
3.440180378796352*^9}]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"ReverseArray", "[",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"1", ",", "2", ",", "3"}], "}"}], ",",
RowBox[{"{",
RowBox[{"4", ",", "5", ",", "6"}], "}"}]}], "}"}], "]"}]], "Input",
CellChangeTimes->{{3.440168935664534*^9, 3.440168948360408*^9}}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"6", ",", "5", ",", "4"}], "}"}], ",",
RowBox[{"{",
RowBox[{"3", ",", "2", ",", "1"}], "}"}]}], "}"}]], "Output",
CellChangeTimes->{3.440168948815699*^9, 3.4401775454085293`*^9,
3.440177647824188*^9, 3.4401777759225273`*^9, 3.440178017618819*^9,
3.4401803839453077`*^9}]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"TweakExpression", "[",
RowBox[{"{",
RowBox[{"ASymbol", ",", "\"\<A string\>\"", ",", "3", ",",
RowBox[{"N", "[", "\[Pi]", "]"}], ",",
RowBox[{"a", "+", "b", "+", "c"}]}], "}"}], "]"}]], "Input",
CellChangeTimes->{{3.440177547780761*^9, 3.440177550781266*^9}, {
3.44017765139118*^9, 3.440177724259131*^9}, {3.440177844791916*^9,
3.440177845556456*^9}, {3.440178025829589*^9, 3.440178050101166*^9}}],
Cell[BoxData[
RowBox[{"tsiL", "[",
RowBox[{"lobmySA", ",", "\<\"gnirts A\"\>", ",",
RowBox[{"-", "3"}], ",",
RowBox[{"-", "3.141592653589793`"}], ",",
RowBox[{"sulP", "[",
RowBox[{"a", ",", "b", ",", "c"}], "]"}]}], "]"}]], "Output",
CellChangeTimes->{
3.4401777251469917`*^9, 3.440177777974738*^9, 3.4401778462290287`*^9, {
3.4401780196886597`*^9, 3.440178050944537*^9}, 3.440180387144931*^9}]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"Uninstall", "[", "lnk", "]"}]], "Input",
CellChangeTimes->{{3.439313773653487*^9, 3.439313777607768*^9}}],
Cell[BoxData["\<\"/home/twadleigh/hs/mathlink/examples/mltest.sh\"\>"], \
"Output",
CellChangeTimes->{3.440168967229312*^9, 3.440177561117154*^9,
3.440177755031232*^9, 3.440177984565681*^9, 3.4401780921022263`*^9,
3.440180388638576*^9}]
}, Open ]]
},
WindowSize->{1590, 1102},
WindowMargins->{{0, Automatic}, {Automatic, 27}},
ShowSelection->True,
FrontEndVersion->"7.0 for Linux x86 (64-bit) (November 11, 2008)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)
(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[567, 22, 213, 4, 61, "Input"],
Cell[783, 28, 209, 2, 88, "Output"]
}, Open ]],
Cell[1007, 33, 398, 10, 96, "Text"],
Cell[CellGroupData[{
Cell[1430, 47, 315, 5, 61, "Input"],
Cell[1748, 54, 310, 6, 88, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[2095, 65, 146, 3, 61, "Input"],
Cell[2244, 70, 187, 3, 88, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[2468, 78, 284, 6, 61, "Input"],
Cell[2755, 86, 353, 8, 88, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[3145, 99, 126, 2, 61, "Input"],
Cell[3274, 103, 210, 3, 88, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[3521, 111, 300, 8, 61, "Input"],
Cell[3824, 121, 355, 9, 88, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[4216, 135, 444, 8, 61, "Input"],
Cell[4663, 145, 421, 9, 88, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[5121, 159, 130, 2, 88, "Input"],
Cell[5254, 163, 243, 4, 88, "Output"]
}, Open ]]
}
]
*)
(* End of internal cache information *)