Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[prakriya] Prakriya doesn't show all rules involved in the process? #44

Closed
vipranarayan14 opened this issue Feb 8, 2023 · 8 comments
Closed

Comments

@vipranarayan14
Copy link
Contributor

In the derivation of बुध्यात् (बुधँ अवगमने 01.0994):

Without the presence of atleast the क्ङिति च, it is difficult to understand why there is no guNa in the form.

image

Dr Dhaval's Prakriyāpradarśinī shows क्ङिति च:

image

If this is intended, I understand.

@akprasad
Copy link
Contributor

akprasad commented Feb 9, 2023

Thanks for filing this! I think we should add क्ङिति च here. The current logic, in pseudocode, is something like:

if is_knit {
  return
}
if sarvadhatuka_ardhadhatukayoh {
  do_guna()
  mark("7.3.84")
} else if puganta_laghupadhasya {
  do_guna()
  mark("7.3.86")
}

It should instead be:

if sarvadhatuka_ardhadhatukayoh {
  if is_knit {
   mark("1.1.5")
  } else {
    do_guna()
    mark("7.3.84")
  }
} else if puganta_laghupadhasya {
  if is_knit {
   mark("1.1.5")
  } else {
    do_guna()
    mark("7.3.86")
  }
}

Do you want to try making the code change?

@vipranarayan14
Copy link
Contributor Author

Yes! It will allow me to understand the inner workings of vidyut.

@akprasad akprasad changed the title Prakriya doesn't show all rules involved in the process? [prakriya] Prakriya doesn't show all rules involved in the process? Feb 11, 2023
@vipranarayan14
Copy link
Contributor Author

vipranarayan14 commented Feb 14, 2023

The current logic, in pseudocode, is something like:

if is_knit {
  return
}
if sarvadhatuka_ardhadhatukayoh {
  do_guna()
  mark("7.3.84")
} else if puganta_laghupadhasya {
  do_guna()
  mark("7.3.86")
}

The actual code used for applying guna is different from what you have described here. It seems it is more like:

if laghu_upadha && can_use_guna {
    do_guna()
    mark("7.3.86")
} else if ik_anta && can_use_guna {
    do_guna()
    mark("7.3.84")
}

can_use_guna checks if the next term is kit or Nit and a few other criteria.

Due to can_use_guna, if the next term is not kit or Nit, the entire block won't run in both the cases.

@akprasad
Copy link
Contributor

Thanks for checking -- I was speaking loosely to keep the description simple, but I'll be more precise in the future.

In this case, the control flow is quite complex, but I think we can try pushing it in:

if laghu_upadha {
  if can_use_guna {
    mark("7.3.86")
  } else {
    mark("1.1.5");
  } 
}

Feel free to heavily modify this function, too -- I dislike the control flow here, and if you can find a cleaner approach, I'm all for it.

@vipranarayan14
Copy link
Contributor Author

Thanks for checking -- I was speaking loosely to keep the description simple, but I'll be more precise in the future.

In this case, the control flow is quite complex, but I think we can try pushing it in:

if laghu_upadha {
  if can_use_guna {
    mark("7.3.86")
  } else {
    mark("1.1.5");
  } 
}

I did the same thing. But I couldn't make it pass all the tests. After that, I couldn't find time to work on it. I'll try it again sometime tomorrow and let you know.

Feel free to heavily modify this function, too -- I dislike the control flow here, and if you can find a cleaner approach, I'm all for it.

Thanks for the permission 🙂. Some people don't like others disturbing their codebase. However, I'll modify them in small steps so that I don't break anything accidentally. (Your extensive suite of tests wouldn't allow me to break anything anyway.)

@akprasad
Copy link
Contributor

The lack of rule logging here is making some other debugging difficult, so I'll take a look at the refactor.

@akprasad
Copy link
Contributor

I've implemented a fix for this locally and will push it out in the next round of cleanup. As illustration, here's the case you mentioned above:

image

@akprasad
Copy link
Contributor

akprasad commented Nov 3, 2023

Pushed.

@akprasad akprasad closed this as completed Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants