A general remark...

Josh Grams solves the problem of ->
Erich Rast wrote:
>Someone on stackoverflow gave me a working implementation in Python 3
>
>https://stackoverflow.com/questions/32694444/
>
>but it uses advanced features and I have no clue how to translate this
>to Racket.
Josh constructs the list of ALL combinations and all total preorders. Erich apparently tried the same, so it is OK, but the solution in Python with generators is more economic, incremental, "non-deterministic". This somehow didn't appeal to Erich, who calls it an "advanced" feature of Python...

But we have generators in Racket as well!!
Use (require racket/generator)
and you have your (generator ...); (yield...) etc. The syntax of generators in Racket is a bit clumsy, but the Python solution can be mapped to Racket as it is.

Eli gives a small tutorial here:

http://stackoverflow.com/questions/25291125/racket-how-to-define-a-recursive-generator-like-python


Jerzy Karczmarczuk

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to