# Title

I want to learn how to truly develop code in literate programming style. To 
this end, I have decided to work on some coding challenges. The existing 
code is here:
https://github.com/metaperl/coding-challenges

# Writing a Valid Parens Program in Literate LEO Programming

A few days ago someone posted a [coding 
challenge](https://www.reddit.com/r/Python/comments/dd1efi/im_on_a_mission_to_explain_all_popular_coding/)
 
that I knew I could solve, but I knew I would be better off if I could 
specify all the logical cases.

# So what is a program that validates a string for matching parentheses?

In my eyes, it breaks down into 2 modes. In mode 1: you accept an open 
paren or an empty string. This screenshot shows this logic node: 
https://i.imgur.com/XoXVgFx.png

In mode 2: you accept the complementary closed paren or another open 
parenthesis. You balk on empty string. This screenshot show this logic:
https://i.imgur.com/HZe2Txk.png

# Now that I have my logic, how do I intertwine Python code with it?

I had hoped to put Python code as children nodes of my logic nodes, but I 
ended up creating a separate node and flipping back and forth to 
transliterate the logic into Python code. Screenshot of separate node:
https://i.imgur.com/O68cen4.png

# So my questions are:

1. How to test my Python code in Leo?
2. What is a better way to structure this .leo file so that the logic and 
code are interspersed?





-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/a35acf4a-0e05-4492-84ed-2ba1c5062f14%40googlegroups.com.

Reply via email to