Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Linked lists considered harmful

Name: Anonymous 2009-10-10 20:46

  ↑    slava_pestov 4 points 5 hours ago [-]
  ↓    A perfect illustration of why single linked lists are simply the wrong data structure in
        99% of cases. Just use arrays and you won't have to choose between tail recursion, and
        front-to-back iteration order.
        permalink report reply

Name: Anonymous 2009-10-10 23:30

>>37
Do you disagree about excessive variable use making functions hard to understand?

How's this for long but readable thanks to structure? You may just have to wait until you happen to see an example you like, since I'm going out soon.
[m]: menu-rotations-4D ( -- gadget )
    3 3 <frame>
        { 1 1 } >>filled-cell
         <pile> 1 >>fill
          "XY +" [ drop rotation-step 4D-Rxy rotation-4D ]
                button* add-gadget
          "XY -" [ drop rotation-step neg 4D-Rxy rotation-4D ]
                button* add-gadget
       @top-left grid-add   
        <pile> 1 >>fill
          "XZ +" [ drop rotation-step 4D-Rxz rotation-4D ]
                button* add-gadget
          "XZ -" [ drop rotation-step neg 4D-Rxz rotation-4D ]
                button* add-gadget
       @top grid-add   
        <pile> 1 >>fill
          "YZ +" [ drop rotation-step 4D-Ryz rotation-4D ]
                button* add-gadget
          "YZ -" [ drop rotation-step neg 4D-Ryz rotation-4D ]
                button* add-gadget
        @center grid-add
         <pile> 1 >>fill
          "XW +" [ drop rotation-step 4D-Rxw rotation-4D ]
                button* add-gadget
          "XW -" [ drop rotation-step neg 4D-Rxw rotation-4D ]
                button* add-gadget
        @top-right grid-add  
         <pile> 1 >>fill
          "YW +" [ drop rotation-step 4D-Ryw rotation-4D ]
                button* add-gadget
          "YW -" [ drop rotation-step neg 4D-Ryw rotation-4D ]
                button* add-gadget
       @right grid-add   
         <pile> 1 >>fill
          "ZW +" [ drop rotation-step 4D-Rzw rotation-4D ]
                button* add-gadget
          "ZW -" [ drop rotation-step neg 4D-Rzw rotation-4D ]
                button* add-gadget
       @bottom-right grid-add   
;[m]

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List