[HN Gopher] Show HN: FXYT - Tiny, esoteric, stack-based, postfix...
       ___________________________________________________________________
        
       Show HN: FXYT - Tiny, esoteric, stack-based, postfix, canvas
       colouring language
        
       Author : susam
       Score  : 68 points
       Date   : 2024-03-23 09:15 UTC (13 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | denton-scratch wrote:
       | I can't find any way for one cell to be affected by the value of
       | a different cell. I haven't thought about it much, but if there
       | were syntax to allow references to adjacent cells, you could do
       | stuff like convolution.
       | 
       | Also, it would be nice to have (a) layers, and (b) alpha values.
       | 
       | Pretty neat to jam it all into a small HTML page.
        
         | jstanley wrote:
         | You could compute the value of adjacent cells and use it in
         | your formula.
        
           | denton-scratch wrote:
           | I don't see how. There's no notation for addressing cells,
           | and every cell runs the same formula.
           | 
           | It's a bit like a spreadsheet, but with every cell running
           | the same function. But with notation for addressing cells,
           | you could make Conway's Game Of Life with a program just a
           | dozen characters in length.
           | 
           | With a z dimension and cell-addressing, you could probably
           | create something like a weather model. But to be useful,
           | you'd need a bigger canvas than 256x256.
           | 
           | You could probably do some interesting things if the language
           | allowed an arbitrary number of dimensions.
        
             | jstanley wrote:
             | > There's no notation for addressing cells, and every cell
             | runs the same formula.
             | 
             | The adjacent cells are (X,Y-1), (X,Y+1), (X-1,Y), and
             | (X+1,Y), you can use those values in your formula.
        
               | denton-scratch wrote:
               | Thanks! I didn't see that in the docs. That immediately
               | makes it more interesting.
        
         | harperlee wrote:
         | It could be cool that layers are z dimension in terms of
         | adjacency. It would also bring some challenges but hey,
         | esoteric languages exist for the bold ones!
        
       | nickcw wrote:
       | I tried to write a mandlebrot plotter in FXYT. There are a number
       | of challenges! First FXYT only provides a bounded loop - this can
       | be overcome with a bit of inefficiency.
       | 
       | However the deepest stack manipulation allowed is 3 values - the
       | R command (Rotate the three values at the top of the data stack)
       | which makes things supremely awkward. It could do with an PICK
       | instruction (duplicate the n-th on the stack). However as an old
       | FORTH programmer you always knew were getting into trouble if you
       | used PICK.
       | 
       | Despite these limitations I did figure out how to write a
       | mandlebrot plotter. Alas it runs into an iterations limit if the
       | depth is > 7, so here is a very low-res mandlebrot made with
       | FXYT!
       | 
       | NNNN7[SDD _N1024 /RDD_N1024/R+N4096<[RN1+RR]SDD _N1024
       | /RDD_N1024/R+N4096<![PPN4000N4000]SDD _N1024 /RDD_N1024/RS-
       | XN128-N12 _N512-+RR_ N512/YN128-N12 _+]PPN30_
       | 
       | You can cut and paste the string above into
       | https://susam.net/fxyt.html if you wish to see it!
       | 
       | Edit - looks like HN formatting mashes the code...
       | 
       | This link should work
       | 
       | https://susam.net/fxyt.html#NNNN7bSDDpN1024qRDDpN1024qRsN409...
        
         | susam wrote:
         | Great demo! Thanks for sharing! Copying the un-mangled code
         | here for future reference:                 NNNN7[SDD*N1024/RDD*
         | N1024/R+N4096<[RN1+RR]SDD*N1024/RDD*N1024/R+N4096<![PPN4000N400
         | 0]SDD*N1024/RDD*N1024/RS-
         | XN128-N12*N512-+RR*N512/YN128-N12*+]PPN30*
         | 
         | If you start a line in HN comment with 2 spaces, the line is
         | reproduced verbatim. See https://news.ycombinator.com/formatdoc
         | for more details about this.
        
       ___________________________________________________________________
       (page generated 2024-03-23 23:01 UTC)