packages feed

mathlink-1.0.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[     12759,        344]
NotebookOptionsPosition[     11283,        286]
NotebookOutlinePosition[     11641,        302]
CellTagsIndexPosition[     11598,        299]
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, 
   3.4413812970022373`*^9, 3.441491000419338*^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\"\>", ",", 
   "3897", ",", "9"}], "]"}]], "Output",
 CellChangeTimes->{
  3.4413816897789*^9, 3.441381776726746*^9, 3.441381863003125*^9, 
   3.441382755890881*^9, 3.441383611414963*^9, 3.4413837695712976`*^9, 
   3.441384211503524*^9, 3.441385803766169*^9, 3.441386080695139*^9, 
   3.441387244598215*^9, 3.441387779567708*^9, {3.441387949000835*^9, 
   3.441387976609853*^9}, 3.44138846489312*^9, 3.4413885012431507`*^9, 
   3.441388550071382*^9, 3.4413906521514463`*^9, 3.441418693983523*^9, 
   3.4414188494746513`*^9, 3.441491002436418*^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}, 3.4413813057112007`*^9, 3.441381441541993*^9, 
   3.441383613208295*^9, 3.441383771554179*^9, 3.4413842134637823`*^9, 
   3.441385806201159*^9, 3.441387246470428*^9, 3.441387781194582*^9, {
   3.441387950532065*^9, 3.441387978232432*^9}, 3.441388469306093*^9, 
   3.4413906541514683`*^9, 3.441418696364647*^9, 3.441491004440143*^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, 3.441381307968505*^9, 
   3.441381443541602*^9, 3.441383773992701*^9, 3.44138421533407*^9, 
   3.441385807884037*^9, 3.4413872484380293`*^9, 3.441387979824582*^9, 
   3.4413884893522873`*^9, 3.441390659007481*^9, 3.441418698597937*^9, 
   3.4414910070039387`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"GreetWorld", "[", "]"}]], "Input",
 CellChangeTimes->{{3.440168718131279*^9, 3.4401687204719067`*^9}}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{"\<\"H\"\>", ",", "\<\"e\"\>", ",", "\<\"l\"\>", ",", "\<\"l\"\>",
      ",", "\<\"o\"\>", ",", "\<\",\"\>", ",", "\<\" \"\>", ",", "\<\"w\"\>", 
     ",", "\<\"o\"\>", ",", "\<\"r\"\>", ",", "\<\"l\"\>", ",", "\<\"d\"\>", 
     ",", "\<\"!\"\>"}], "}"}], ",", "\<\"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, 3.44138130986276*^9, 
   3.441381445073922*^9, 3.441383777014336*^9, 3.441384217030814*^9, 
   3.4413858094822197`*^9, 3.441387249965949*^9, 3.4414187007709637`*^9, 
   3.441491009312787*^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[{
     RowBox[{"{", "1", "}"}], ",", 
     RowBox[{"{", "2", "}"}], ",", 
     RowBox[{"{", "3", "}"}]}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"{", "4", "}"}], ",", 
     RowBox[{"{", "5", "}"}], ",", 
     RowBox[{"{", "6", "}"}]}], "}"}]}], "}"}]], "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, 3.441381351458521*^9, 
  3.441381449711451*^9, 3.4413837789184637`*^9, 3.4413842200390663`*^9, 
  3.441387251527453*^9, 3.441418703279256*^9, 3.441491011027935*^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, 3.441381360007936*^9, 3.441381452206236*^9, 
   3.441383780806993*^9, 3.441384222446288*^9, 3.4413872531264553`*^9, 
   3.441418705414536*^9, 3.441491013393704*^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, 3.441381455911284*^9, 3.44138378263803*^9, 
   3.441384224886664*^9, 3.44138725472222*^9, 3.441418706707465*^9, 
   3.441491015262816*^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, 3.4413814578432207`*^9, 3.441383783897023*^9, 
  3.4413842262926207`*^9, 3.4413860855117683`*^9, 3.4413872565223503`*^9, 
  3.441418707827199*^9, 3.4414910169835653`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"AbortTest", "[", "50", "]"}]], "Input",
 CellChangeTimes->{{3.4413814839615593`*^9, 3.44138148687442*^9}, {
  3.4413858220378847`*^9, 3.441385824935438*^9}, {3.4413860876215363`*^9, 
  3.441386092152405*^9}, {3.441387279931728*^9, 3.4413872801019363`*^9}, {
  3.4414187331544437`*^9, 3.4414187357368517`*^9}}],

Cell[BoxData["True"], "Output",
 CellChangeTimes->{
  3.441381487619445*^9, 3.44138169978981*^9, 3.441381782395792*^9, {
   3.441381905687695*^9, 3.441381921320157*^9}, 3.4413827674143963`*^9, 
   3.441383632073021*^9, 3.441384195206551*^9, {3.441385787032784*^9, 
   3.441385825540018*^9}, {3.441386088582046*^9, 3.441386093667964*^9}, {
   3.441387258934795*^9, 3.441387288148602*^9}, {3.4413877897953033`*^9, 
   3.441387795451263*^9}, {3.441388512784028*^9, 3.4413885577855253`*^9}, {
   3.44139066804643*^9, 3.4413906737232437`*^9}, {3.4414187117340508`*^9, 
   3.44141874145138*^9}, {3.4414910241849747`*^9, 3.441491033597106*^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, 3.441381406035787*^9, {3.441381675639502*^9, 
   3.441381704566267*^9}, 3.4413818574534807`*^9, 3.441382750107748*^9, 
   3.441383567485149*^9, 3.44138579638888*^9, 3.4413860740598707`*^9, 
   3.441387237789958*^9, 3.441387763869083*^9, {3.441387944051606*^9, 
   3.441387958012869*^9}, 3.441390784907803*^9, 3.441418824055894*^9, 
   3.441418861733427*^9, 3.4414910414708023`*^9}]
}, Open  ]]
},
WindowSize->{1916, 1165},
WindowMargins->{{0, Automatic}, {4, Automatic}},
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, 88, "Input"],
Cell[783, 28, 259, 3, 88, "Output"]
}, Open  ]],
Cell[1057, 34, 398, 10, 96, "Text"],
Cell[CellGroupData[{
Cell[1480, 48, 315, 5, 88, "Input"],
Cell[1798, 55, 651, 11, 88, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[2486, 71, 146, 3, 88, "Input"],
Cell[2635, 76, 691, 10, 88, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[3363, 91, 284, 6, 88, "Input"],
Cell[3650, 99, 710, 13, 88, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[4397, 117, 126, 2, 88, "Input"],
Cell[4526, 121, 857, 16, 88, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[5420, 142, 300, 8, 88, "Input"],
Cell[5723, 152, 770, 18, 88, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[6530, 175, 444, 8, 88, "Input"],
Cell[6977, 185, 681, 13, 88, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[7695, 203, 418, 9, 88, "Input"],
Cell[8116, 214, 515, 9, 88, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[8668, 228, 327, 7, 88, "Input"],
Cell[8998, 237, 367, 5, 88, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[9402, 247, 333, 5, 88, "Input"],
Cell[9738, 254, 637, 9, 88, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[10412, 268, 130, 2, 88, "Input"],
Cell[10545, 272, 722, 11, 88, "Output"]
}, Open  ]]
}
]
*)

(* End of internal cache information *)