<div dir="auto">The code does the following 2 things:<div dir="auto">A Verb class assembles the necessary morphemes in order in accordance with the verb's subject, object, mode, grmamatical order, tense and polarity.</div><div dir="auto"><br></div><div dir="auto">If all of the morphemes' default forms were mashed together at this point a valid Ojibwe verb form would not be produced</div><div dir="auto"><br></div><div dir="auto">The code in the mutate methods of each morphene transforms a sequence like</div><div dir="auto">gi-bizindaw-in-si-in-w-in-m-ban</div><div dir="auto">into</div><div dir="auto">gi-bizindoo--si-n-oo-n-inini-mwaa-ban</div><div dir="auto">gibizindoosinoonininimwaaban</div><div dir="auto"><br></div><div dir="auto">A third piece of code creates thousands of verb instances and populates a web form to show every conjugated form of a given verb, though that is not important here.</div><div dir="auto"><br></div><div dir="auto">The mutation of each morpheme is dependent on the type and form of the preceding and following morpheme, occasionally requiring even more information from the parent verb.</div><div dir="auto"> As most morphemes' mutation method are unique, the subclasses of Morpheme for the most part override the Morphems superclass's mutate implementation. However, it would reduce my code's current redundancy if I could place something like a macro expansion at the beginning of each mutate method's internal code, as there is a piece of code used to set up each mutate method's local variable space that I copied and pasted many times.</div><div dir="auto"><br></div><div dir="auto">The code I wrote already functions fine, it is just that while I was writing I was thinking to myself how convenient it would be if I could "jump to" functions, and now I understand that the best way to do that would just be to macro expand an often repeated segment of code.</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, 17 Aug 2018, 15:24 Abe Dillon, <<a href="mailto:abedillon@gmail.com">abedillon@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Jacob, can you please describe in greater detail <b>what</b> you're trying to accomplish with your morpheme code? Not <b>how</b> you wish to accomplish it, but <b>what</b> the code is supposed to do?<br><br>I've looked into other projects that try to model morphemes and similar language constructs to get a better idea of the problem space (<a href="https://www.nltk.org/" target="_blank" rel="noreferrer">NLTK</a>, <a href="https://textblob.readthedocs.io/en/dev/" target="_blank" rel="noreferrer">TextBlob</a>, <a href="https://polyglot.readthedocs.io/en/latest/MorphologicalAnalysis.html" target="_blank" rel="noreferrer">PyGlot</a>, etc.) and it looks like machine learning is often employed for morpheme-related tasks. It may be that the rules for identifying and manipulating morphemes are inherently so complex that they don't lend themselves to elegant codification. That's usually the case for fields in which people turn to machine learning.<br><br>It may also be a case where functional decomposition would help. The examples you've given aren't really sufficient to understand the problem. It could be a legitimate deficiency in Python's feature set, or it may be that Python already has features that could serve you better, or it may be that the problem is inherently difficult to codify in an elegant way.<br><br>Without a concrete use-case, it's nearly impossible to justify adding a new feature to Python. This discussion is unlikely to lead to any meaningful action otherwise.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 16, 2018 at 4:37 PM, Jacob Solinsky <span dir="ltr"><<a href="mailto:jacobsolinsky@gmail.com" target="_blank" rel="noreferrer">jacobsolinsky@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">So when getx is executed inside a let form, if it tries to read/write the value of X it interacts with the X entry in the let form's symbol table before moving to find X in the global environment, right? That is similar to what I was trying to accomplish in python, but with the local symbol table of the calling function rather than a let form.<div dir="auto"><br></div><div dir="auto">I think the way a "jump to" function rather than a "call function" would be implemented would be by removing the prologue and epilogue of the function's compiled code. Something vaguely like this:</div><div dir="auto"><br></div><div dir="auto">def foo(a,b):</div><div dir="auto"> c = bar(d =3)%</div><div dir="auto"> return c+2</div><div dir="auto"><br></div><div dir="auto">def bar(d)</div><div dir="auto"> a += 2</div><div dir="auto"> e = 4</div><div dir="auto"> return a + b + d +e</div><div dir="auto"><br></div><div dir="auto">foo(7, 2)</div><div dir="auto"><br></div><div dir="auto">Here would be the symbol table</div><div dir="auto"><br></div><div dir="auto">Scope Foo</div><div dir="auto">__________</div><div dir="auto">a: fp - 1</div><div dir="auto">b: fp - 2</div><div dir="auto">d: fp - 3</div><div dir="auto">e: fp - 5</div><div dir="auto">c: fp - 4</div><div dir="auto"><br></div><div dir="auto">The interpreter would have to recognize that bar was being jumped to rather than called and thus inject bar's arguments and variable declarations and return value (if assigned to) into foo's stack frame.</div><div dir="auto"><br></div><div dir="auto">The translation of the above code would be this (I apologize for the strange pseudoassembly, I don't know any of those languages on a more than cursory level. The below code is obviously very slow, each variable read from the memory and written to memory at every step, with no storage of local variables in registers.) The "return c+2" statement is changed from a return into a c += 2 assignment in the calling function.</div><div dir="auto"><br></div><div dir="auto">PUSH fp, returnregister # preserve old value in return register</div><div dir="auto">PUSH -1(fp), 7 # load a</div><div dir="auto">PUSH -2(fp), 2 # load b</div><div dir="auto">PUSH -3(fp), 3 # load d</div><div dir="auto">PUSH -4(fp), 0 # initialize c</div><div dir="auto">ADDI -1(fp), -1(fp), 2 # a += 2</div><div dir="auto">PUSH -5(fp), 4 # load e</div><div dir="auto">ADD -4(fp), -1(fp), -2(fp) # c = a + b + d + e</div><div dir="auto">ADD -4(fp), -4(fp), -5(fp) # c = a + d + d + e continued</div><div dir="auto">ADDI returnregister, -4(fp), 2 # return c + 2</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, 16 Aug 2018, 14:44 Jonathan Fine, <<a href="mailto:jfine2358@gmail.com" rel="noreferrer noreferrer" target="_blank">jfine2358@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Jacob<br>
<br>
I'm finding the python-ideas list a bit noisy, so I'm sending this off-list.<br>
<br>
I've found<br>
<br>
<a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Dynamic-Binding.html" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">https://www.gnu.org/software/emacs/manual/html_node/elisp/Dynamic-Binding.html</a><br>
<a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Variable-Scoping.html" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">https://www.gnu.org/software/emacs/manual/html_node/elisp/Variable-Scoping.html</a><br>
<br>
Please confirm that this is at least close to what you want, to be<br>
able to program your problem efficiently.<br>
<br>
Meanwhile, I'm thinking about how your algorithm might be expressed in Python.<span class="m_-3399976315378484278HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Jonathan<br>
</font></span></blockquote></div>
<br>_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank" rel="noreferrer">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
<br></blockquote></div><br></div>
</blockquote></div>