<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-2022-jp">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p></p>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">Hi all,</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">I've just finished a language extension for CPython 3.6.x to support some additional grammars like Pattern Matching. And It's compatible with CPython.</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">I'm looking for constructive advice, and I wonder if you will be interested in this one.</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">( the project address is  </span><a href="https://github.com/thautwarm/flowpython" class="OWAAutoLink" id="LPlnk443622" previewremoved="true"><span style="font-family: Consolas, Courier, monospace;">https://github.com/thautwarm/flowpython</span></a><span style="font-family: Consolas, Courier, monospace;">)</span></div>
<div id="LPBorder_GT_15026572729240.6384179417509586" style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;">
<table id="LPContainer_15026572729190.5075151266064495" role="presentation" cellspacing="0" style="width: 90%; position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top-width: 1px; border-top-style: dotted; border-top-color: rgb(200, 200, 200); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(200, 200, 200); background-color: rgb(255, 255, 255);">
<tbody>
<tr valign="top" style="border-spacing: 0px;">
<td id="ImageCell_15026572729210.4791065799072385" colspan="1" style="width: 250px; position: relative; display: table-cell; padding-right: 20px;">
<div id="LPImageContainer_15026572729210.23074439424090087" style="height: 250px; position: relative; margin: auto; display: table; width: 250px; background-color: rgb(255, 255, 255);">
<a id="LPImageAnchor_15026572729210.4354611791204661" href="https://github.com/thautwarm/flowpython" target="_blank" style="display: table-cell; text-align: center;"><img id="LPThumbnailImageID_15026572729220.32293741777539253" width="250" height="250" style="display: inline-block; max-width: 250px; max-height: 250px; height: 250px; width: 250px; border-width: 0px; vertical-align: bottom;" src="https://avatars1.githubusercontent.com/u/22536460?v=4&s=400"></a></div>
</td>
<td id="TextCell_15026572729220.6741182054392993" colspan="2" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;">
<div id="LPRemovePreviewContainer_15026572729220.43713401397690177"></div>
<div id="LPTitle_15026572729220.7076862906105816" style="top: 0px; color: rgb(0, 120, 215); font-weight: normal; font-size: 21px; font-family: wf_segoe-ui_light, 'Segoe UI Light', 'Segoe WP Light', 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif; line-height: 21px;">
<a id="LPUrlAnchor_15026572729230.4485725578851998" href="https://github.com/thautwarm/flowpython" target="_blank" style="text-decoration: none;">thautwarm/flowpython</a></div>
<div id="LPMetadata_15026572729230.778763122856617" style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif; font-size: 14px; line-height: 14px;">
github.com</div>
<div id="LPDescription_15026572729240.21700240136124194" style="display: block; color: rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;">
flowpython - tasty feature extensions for python(python3).</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<div><span style="font-family: Consolas, Courier, monospace;">Some examples here:</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;"># where syntax</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">    from math import pi</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">    </span></div>
<div><span style="font-family: Consolas, Courier, monospace;">    r = 1  # the radius</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">    h = 10 # the height</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">    S = (2*S_top + S_side) where:</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">        S_top  = pi*r**2</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">        S_side = C * h where:</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">            C = 2*pi*r</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;"># lambda&curry :</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">    lambda x: lambda y: lambda z: ret where:</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">         ret = x+y</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">         ret -= z</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">    .x -> .y -> .z -> ret where:</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">         ret = x+y</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">         ret -= z</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">    as-with x def as y def as z def ret where:</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">         ret = x+y</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">         ret -= z</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;"># arrow transform (to avoid endless parentheses and try to be more readable.</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">  >> range(5) -> map(.x->x+2, _) -> list(_)</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">  >> [2,3,4,5,6]</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;"># pattern matching</span></div>
<div><span style="font-family: Consolas, Courier, monospace;"># use "condic" as keyword is for avoiding the conflictions against the standard libraries and packages from third party. "switch" and "match"   both lead to conflictions. </span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">    condic+(type) 1:    </span></div>
<div><span style="font-family: Consolas, Courier, monospace;">        case a:int => assert a == 1 and type(a) == 1</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">    [>]</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">        case 0     => assert 1 > 0</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">    [is not]</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">        case 1     => assert 1 is not 1</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">    otherwise  => print("nothing")</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">    condic+() [1,2,3]:</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">        case (a,*b)->b:list => sum(b)</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">        +[]</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">        case  []            => print('empty list')</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">        +[==]</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">        case  (a,b):(1,2)   => print("the list is [1,2]")</span></div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">The grammars with more details and examples can be found in</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">               https://github.com/thautwarm/flowpython/wiki</span></div>
<div><br>
</div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">Does it interest you? If so, you can try it if you have CPython 3.6.x.</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">       pip install flowpython</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">       python -m flowpython -m enable/disable </span></div>
<div><br>
</div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">Here is an example to use flowpython, which gives the permutations of a sequence.</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">    from copy import deepcopy</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">    permutations = .seq -> seq_seq where:</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">        condic+[] seq:        </span></div>
<div><span style="font-family: Consolas, Courier, monospace;">            case (a,  ) => seq_seq = [a,]        </span></div>
<div><span style="font-family: Consolas, Courier, monospace;">            case (a, b) => seq_seq = [[a,b],[b,a]]        </span></div>
<div><span style="font-family: Consolas, Courier, monospace;">            case (a,*b) => </span></div>
<div><span style="font-family: Consolas, Courier, monospace;">                seq_seq = permutations(b) -> map(.x -> insertAll(x, a),  _) -> sum(_, []) where:</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">                     insertAll = . x, a -> ret where:</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">                         ret = [ deepcopy(x) -> _.insert(i, a) or _ for i in  (len(x) -> range(_+1))  ]</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">If the object permutations are defined, try these codes in console:</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;"> >> range(3) -> permutations(_)</span></div>
<div><span style="font-family: Consolas, Courier, monospace;"> >> [[0, 1, 2], [1, 0, 2], [1, 2, 0], [0, 2, 1], [2, 0, 1], [2, 1, 0]]</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">Does it seem to be interesting?</span></div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">Thanks,</span></div>
<div><span style="font-family: Consolas, Courier, monospace;">Thautwarm</span></div>
<div><span style="font-family: Consolas, Courier, monospace;"></span><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;"> </span></div>
<br>
<p></p>
</div>
</body>
</html>