mathlink-0.1.0.1: 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[ 8910, 274]
NotebookOptionsPosition[ 7550, 220]
NotebookOutlinePosition[ 7909, 236]
CellTagsIndexPosition[ 7866, 233]
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\"\>", ",", "25",
",", "11"}], "]"}]], "Output",
CellChangeTimes->{3.440263039836529*^9, 3.440264120592161*^9,
3.44026426385889*^9, 3.440264416235961*^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,
3.440261706988338*^9, 3.440262267330207*^9, 3.44026304258245*^9,
3.4402641219488163`*^9, 3.4402642658697*^9, {3.4402644178146067`*^9,
3.4402644191880302`*^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}, 3.440261709575554*^9, 3.4402630445039377`*^9,
3.440264267960457*^9, 3.440264420978492*^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,
3.4402617123528633`*^9, 3.4402630465175877`*^9, {3.440264269597514*^9,
3.440264271412078*^9}, 3.4402644226770697`*^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, 3.4402617143337603`*^9, 3.4402630480736322`*^9,
3.440264274052725*^9, 3.440264424466619*^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,
3.440261716956626*^9, 3.440263049754879*^9, 3.440264276797727*^9,
3.440264426317778*^9}]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"AddExtendedComplexes", "[",
RowBox[{
RowBox[{"1", "+",
RowBox[{"3", "\[ImaginaryI]"}]}], ",",
RowBox[{"2", "+",
RowBox[{"5", "\[ImaginaryI]"}]}]}], "]"}]], "Input",
CellChangeTimes->{{3.440261725819941*^9, 3.44026175272886*^9}, {
3.440261869617639*^9, 3.440261870522575*^9}, {3.4402623078593616`*^9,
3.44026232761686*^9}, {3.440264128954616*^9, 3.440264134710162*^9}}],
Cell[BoxData[
RowBox[{"3.`", "\[InvisibleSpace]", "+",
RowBox[{"8.`", " ", "\[ImaginaryI]"}]}]], "Output",
CellChangeTimes->{
3.4402617532268353`*^9, {3.440261864732419*^9, 3.440261871312593*^9},
3.440262143838559*^9, 3.4402622723110037`*^9, 3.440262328404337*^9,
3.440263051601795*^9, 3.4402641351875563`*^9, 3.4402642789828243`*^9,
3.4402644285115223`*^9}]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"AddExtendedComplexes", "[",
RowBox[{"Infinity", ",",
RowBox[{"1", "+",
RowBox[{"3", "\[ImaginaryI]"}]}]}], "]"}]], "Input",
CellChangeTimes->{{3.4402623440640917`*^9, 3.4402623453541613`*^9}, {
3.440262468823717*^9, 3.440262473845871*^9}, {3.440264138208585*^9,
3.440264140343564*^9}}],
Cell[BoxData["\[Infinity]"], "Output",
CellChangeTimes->{3.440262345780912*^9, 3.44026247434591*^9,
3.440263054136756*^9, 3.440264140800539*^9, 3.4402642809102592`*^9,
3.440264430358942*^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,
3.440261841211409*^9, {3.440264295025028*^9, 3.44026429805313*^9},
3.440264432207209*^9}]
}, Open ]]
},
WindowSize->{1590, 1102},
WindowMargins->{{0, Automatic}, {Automatic, 31}},
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, 61, "Output"]
}, Open ]],
Cell[1007, 33, 398, 10, 96, "Text"],
Cell[CellGroupData[{
Cell[1430, 47, 315, 5, 88, "Input"],
Cell[1748, 54, 266, 5, 88, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[2051, 64, 146, 3, 88, "Input"],
Cell[2200, 69, 359, 6, 88, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[2596, 80, 284, 6, 88, "Input"],
Cell[2883, 88, 447, 9, 88, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[3367, 102, 126, 2, 88, "Input"],
Cell[3496, 106, 337, 5, 88, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[3870, 116, 300, 8, 88, "Input"],
Cell[4173, 126, 450, 10, 88, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[4660, 141, 444, 8, 88, "Input"],
Cell[5107, 151, 517, 11, 88, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[5661, 167, 418, 9, 88, "Input"],
Cell[6082, 178, 377, 7, 88, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[6496, 190, 327, 7, 88, "Input"],
Cell[6826, 199, 197, 3, 88, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[7060, 207, 130, 2, 88, "Input"],
Cell[7193, 211, 341, 6, 88, "Output"]
}, Open ]]
}
]
*)
(* End of internal cache information *)