My Julia function never runs


I’m currently working on this package.

When I try to run the main function nothing happens.

julia> y=[0,0,1,1,1]
julia> X = [1 -2; 1 -1; 1 0; 1 1; 1 2]
julia> fidSampleLR(y, X, 5)

There’s a println at the first line of this function and nothing is printed. Looks like Julia takes an infinite time to compile the function. What’s the problem please?

Some things come at mind:

  1. How much time have you waited? Some seconds or did you let the function run for minutes/hours and nothing happened?
  2. Did you try to create a function with just the X first lines, and then incrementally add lines until the problem happens?
  3. Are you sure you are running the right version of the code? How do you have the package installed? Do you have it deved? Add a println a change to another function that works (some other function works, right?) and see if the print happens.

Is it stuck in the while loop?

I waited more than 20 minutes.

When I remove the CDDLib stuff, it works.

Use Debugger.jl. I installed from your github repo and found that it hangs here (I had to copy/paste an image rather than the REPL text because it froze :grimacing:):

1 Like

Thanks! This debugger looks great, I never tried it.

Will ask to the package maintainer.

This seems to work by replacing import CDDLib with using CDDLib.

This is considerably strange. Just changing import CDDLib to using CDDLib solves the problem without you changing anything else? Because if your code works with using CDDLib it should either work with import CDDLib or gives an error saying some functions does no exist (because they were not imported to the current scope). Even if the package is doing type piracy the code should either work on both cases, or error soon in the import case.