TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

The Panda Language: No Loops, No Ifs, Just Fun

5 pointsby jiangplusabout 5 years ago

2 comments

eesmithabout 5 years ago
FWIW, here&#x27;s the modern Python equivalent to &quot;1..10.odd.sqr.lt(50)&quot;<p><pre><code> &gt;&gt;&gt; [s for i in range(50) if i&amp;1 and (s:=i*i) &lt; 50] [1, 9, 25, 49] </code></pre> And here&#x27;s my interpretation of the C equivalent:<p><pre><code> #include &lt;stdio.h&gt; int main() { int i, s; for(i = 1; i &lt;= 10; i++) { if (i &amp; 1 &amp;&amp; (s = i*i) &lt; 50) { printf(&quot;%d &quot;, s); } } return 0; } </code></pre> Not quite a-la 1972, but then again the example 1972 code from that page wouldn&#x27;t compile then either - variables had to be declared at the start of the function.<p>I wonder what the APL looks like. I hacked this solution:<p><pre><code> (x&lt;50)&#x2F;x←(1=2|x)&#x2F;x←((⍳10)*2) </code></pre> but I&#x27;m guessing the real solution would be 1&#x2F;3 the size.
评论 #23154063 未加载
Gravitylossabout 5 years ago
Reminds me of Ruby.
评论 #23159938 未加载