Dear list,<div><br></div><div>I've had a sort of "toy question" in the back of my mind for a while now.</div><div><br></div><div>Say we'd like to livecode a shape that extends in all 6 directions (up, down, left, right, forward, backward) in some way. One way to go about this would be to write a list of unit-length vectors in those directions. However, writing that literally is not very elegant. Nicer would be to generate it. I tried and got this far;</div>
<div><br></div><div><div>(build-list </div><div>    6 </div><div>    (λ (x) (build-vector </div><div>        3 </div><div>        (λ (y) (if (eq? (quotient x 2) y) </div><div>            (if (even? x) </div><div>                1 </div>
<div>                -1) </div><div>            0)))))</div></div><div><br></div><div>Evidently it works, it looks very "scheme-ish" and so on; it's as small as I can get it.</div><div><br></div><div>However, disappointingly, it is also longer to type than its output, more or less defeating the purpose. It also doesn't really express the question itself, it seems more of a thing that heads straight for what we already know is the answer.</div>
<div><br></div><div>Would anyone else like to try too?</div><div><br></div><div>Yours,</div><div>Kas.</div>