0
$\begingroup$

Itried first to compile this Module

cdl4u2 := Module[{lst1, lst2, lst3},
  lst1 = RandomSample[Range[0, 9], 4];
  lst2 = RandomSample[Complement[Range[0, 9], lst1], 4];
  lst3 = RandomSample[Complement[Range[0, 9], lst1, lst2], 2];
  {lst1, lst2, lst3}]

first tried Compile[expresion] but the syntax ask at least 2 items, so I tried with

pdya = Compile[{a}, Module[{lst1, lst2, lst3},
   lst1 = RandomSample[Range[0, 9], 4];
   lst2 = RandomSample[Complement[Range[0, 9], lst1], 4];
   lst3 = RandomSample[Complement[Range[0, 9], lst1, lst2], 2];
   {lst1, lst2, lst3}]]

where a isw a dummy parameter.. well finally it looks like I created a

CompiledFunction[{10, 11.2, 5468}, {
Blank[Real]}, {{3, 0, 0}, {2, 2, 3}}, {{0, {2, 0, 0}}, {
  9, {2, 0, 1}}, {4, {2, 0, 8}}, {2, {2, 0, 9}}, {-1, {2, 0, 5}}, {
  1, {2, 0, 3}}}, {0, 10, 1, 0, 4}, {{6, 1, 2}, {6, 0, 4}, {41, 258, 
  2, 0, 2, 2, 0, 5, 2, 0, 6}, {35, 6, 2, 0}, {6, 5, 7}, {3, 2}, {36, 
  4, 7, 2, 0}, {4, 7, 2, -1}, {
  42, "RandomSample", 2, 1, 0, 2, 0, 8, 2, 1, 1}, {6, 1, 6}, {6, 0, 
  2}, {41, 258, 2, 0, 6, 2, 0, 5, 2, 0, 7}, {35, 7, 2, 0}, {6, 5, 
  4}, {3, 2}, {36, 2, 4, 2, 0}, {4, 4, 6, -1}, {
  42, "Complement", 2, 1, 0, 2, 1, 1, 2, 1, 2}, {
  42, "RandomSample", 2, 1, 2, 2, 0, 8, 2, 1, 0}, {6, 1, 2}, {6, 0, 
  7}, {41, 258, 2, 0, 2, 2, 0, 5, 2, 0, 6}, {35, 6, 2, 2}, {6, 5, 
  4}, {3, 2}, {36, 7, 4, 2, 2}, {4, 4, 2, -1}, {
  42, "Complement", 2, 1, 2, 2, 1, 1, 2, 1, 0, 2, 1, 3}, {
  42, "RandomSample", 2, 1, 3, 2, 0, 9, 2, 1, 2}, {34, 1, 3, 1, 0, 2, 
  0, 3}, {1}}, 
Function[{a}, 
Module[{lst1, lst2, lst3}, lst1 = RandomSample[
Range[0, 9], 4]; lst2 = RandomSample[
Complement[
Range[0, 9], lst1], 4]; lst3 = RandomSample[
Complement[
Range[0, 9], lst1, lst2], 2]; {lst1, lst2, lst3}]], Evaluate]

nothing like I expected this is a deg.exe file that I can use without a mathematica working in Maybe I want something that only can be done using a cpp compiler ??? thanks for any help ans sorry if I made mistakes in english ...

$\endgroup$
  • $\begingroup$ Indeed, Compile produces dynamic libraries that can be called only by Mathematica. $\endgroup$ – Henrik Schumacher Feb 7 at 18:33
  • $\begingroup$ Thanks Henrik Schumacher, I supose need to make it in C or C++ or Java ... I had already the idea that it'd be closed to Mathematica ... at least had worked out the algorithm it'll be easier to write C $\endgroup$ – Anxon Pués Feb 7 at 18:54
  • 1
    $\begingroup$ You can always apply ExportString to the compiled function and browse the actual C-code. You might recycle some of the code snippets in an external C- or C++-program. $\endgroup$ – Henrik Schumacher Feb 7 at 19:00
  • $\begingroup$ Tried it Henrik Schumacher... well it's not like can use ... I appreciate your advice, maybe next opportunity this would have to be cooked old way in Tontöpfen! $\endgroup$ – Anxon Pués Feb 7 at 19:43
  • 1
    $\begingroup$ Got it in Google translator, in spanish we say "cazuelas de barro" and still I have some at home but can not use with modern induction kitchenfires ... but older make veri interesting sauces working slowly over woodcoal! believe me I'm spanish we are concerned in how to prepare specialities $\endgroup$ – Anxon Pués Feb 7 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.