Hey Jon, i worked through the code and run it.
Just for curiosity: Is there a way in core.logic to print things to console...to analyze/trace control/data flow? I guess the pick-one relation is non-determistic. And the transport relation should fail serveral times during execution. And would it be possible to include some kind of "logica time stamp". Should be just a counter. So you could see in what temporal order the actions are in case the result list is out of order. Am Montag, 3. Juli 2017 22:16:06 UTC+2 schrieb Smock Jonathan: > > Hey Daniel, > > I realized I could put it behind a gist link: > https://gist.github.com/jonsmock/3e4abf488bfcc064f33373a3d090e027 > > Don't look if you want to think it through, but feel free if you're stuck. > The invitation to offer hints is still open as well. > > I think my code could be cleaned up, but I did get my recursive version > working (once I noticed I had hardcoded the order of the final solution > list). > > Let me know if you need help! > > Thanks, > Jon > > On Mon, Jul 3, 2017 at 3:36 PM, Smock Jonathan <[email protected] > <javascript:>> wrote: > >> Hi Daniel, >> >> I did this one just now: >> https://en.wikipedia.org/wiki/Fox,_goose_and_bag_of_beans_puzzle >> >> It looks like I can solve it, but I'm having trouble making my solution >> fully recursive. Instead I had to create 8 fresh variables for the initial >> state, the 6 intermediate states, and the final solution state. With that, >> my solution comes back very quickly. >> >> Do you want to see code, or do you want hints? I don't want to spoil it, >> if you want to keep working through it. >> >> I will say the final gotcha for me was in encoding the final solution. I >> keep a list of which animals/items are on each side of the river, and while >> I can give a list of animals/items of the initial state, I can't hardcode >> the list on the ending state. Instead I use a list with 3 fresh variables. >> This ensures the farmer ends with all 3 items on the other side, but it >> doesn't constraint the the order of the list to any particular order. Does >> that make sense? >> >> Let me know how I can help! Good luck! >> >> Jon >> >> On Mon, Jul 3, 2017 at 11:06 AM, Daniel S <[email protected] >> <javascript:>> wrote: >> >>> Hello, >>> >>> anyone solved the River Crossing Puzzle ( >>> https://en.wikipedia.org/wiki/River_crossing_puzzle) >>> with minikanren yet? >>> >>> bye >>> >>> Daniel >>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "minikanren" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected] <javascript:>. >>> To post to this group, send email to [email protected] >>> <javascript:>. >>> Visit this group at https://groups.google.com/group/minikanren. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> > -- You received this message because you are subscribed to the Google Groups "minikanren" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/minikanren. For more options, visit https://groups.google.com/d/optout.
