TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

A Forth haiku is an attempt to mix math, art and Forth

47 点作者 pointfree超过 10 年前

5 条评论

evincarofautumn超过 10 年前
This is awesome and really shows off the beautiful compactness of Forth.<p>It took me a moment to figure out what to actually do. Basically you just write a little program that produces three floating-point values from 0.0 to 1.0, and these are used as the R, G, and B channels of each pixel in the output. For example, an all-red image is:<p><pre><code> 1 0 0 </code></pre> And a blue-cyan-magenta rectangle is:<p><pre><code> x y 1 </code></pre> You get the x and y of the current pixel with the “x” and “y” words, and you get the current time with the “t” word in order to make animations. Here’s one that continually oscillates between black and white:<p><pre><code> : r 5 ; : sin&#x27; sin 1 + 2 &#x2F; ; : t&#x27; t r * sin&#x27; ; t&#x27; t&#x27; t&#x27; </code></pre> (You can change the value of “r” to make it oscillate faster or slower.)<p>Looking at the glossary[1] and cannibalising other examples is really helpful.<p>[1]: <a href="http://forthsalon.appspot.com/word-list" rel="nofollow">http:&#x2F;&#x2F;forthsalon.appspot.com&#x2F;word-list</a>
评论 #8312094 未加载
评论 #8311195 未加载
ANTSANTS超过 10 年前
See also IBNIZ, a livecoding environment with a language inspired by (and even more terse than) FORTH.<p><a href="http://countercomplex.blogspot.com/2011/12/ibniz-hardcore-audiovisual-virtual.html" rel="nofollow">http:&#x2F;&#x2F;countercomplex.blogspot.com&#x2F;2011&#x2F;12&#x2F;ibniz-hardcore-au...</a>
amenghra超过 10 年前
<a href="http://forthsalon.appspot.com/haiku-view/ahBzfmZvcnRoc2Fsb24taHJkchILEgVIYWlrdRiAgICAstmWCgw" rel="nofollow">http:&#x2F;&#x2F;forthsalon.appspot.com&#x2F;haiku-view&#x2F;ahBzfmZvcnRoc2Fsb24...</a>
kaoD超过 10 年前
I wondered if the Forth code was being transpiled into JS or GLSL. Inspecting the source reveals it is JS, which seems sensible since it has stacks.<p>That made me wonder, how hard would it be to turn Forth code into imperative GLSL? Seems like a fun exercise and would allow huge canvases.
pkaye超过 10 年前
I seem to remember something similar but used a C like language.
评论 #8311171 未加载
评论 #8311166 未加载