I appreciate the suggestions. As ever, I learn something from them ;)
On Fri, Mar 3, 2017 at 10:10 PM, Alexander Burger <a...@software-lab.de>
> Hi Lindsay,
> > The code below is the recursive Gosper implementation I came up with that
> > uses very little stack. This version just emits states.
> > ...
> > Picolisp continues to impress me with its expressiveness and power.
> As ever, I can't resist to suggest some optimizations :)
> > (de Plot (L)
> > (map '((X) (prin (car X))) L) )
> (mapc prin L) would be enough.
> > (de Fn (L)
> > (let R
> > (fish
> > atom
> > (mapcar
> > '((X)
> > (cond
> > ((= X "A") A)
> > ((= X "B") B)
> > (T X) ) )
> > L ) )
> > R ) )
> The 'let' is not necessary, as R is never used. And 'fish' is for nested
> structures, a flat list can be handled directly e.g. with 'filter' or
> (extract '((X) (cond ((pair X)) ((=X "A") A) ..)) L)
> As 'A' and 'B' are free variables here, 'Fn' should be named differently,
> starting with an underscrore (see doc/ref.html#conv)). You coud try 'lint'
> 'lintAll' to see what it complains.
> The PicoLisp naming conventions also recommend upper case first letters for
> locally bound variables. Functions defined globally like 'Plot' or 'Fn'
> better start in lower case.
> > (de L-Run (L D)
> > (cond
> > ((>= D MaxDepth) (Plot L))
> > (T
> Here an 'if' is shorter than a 'cond'.
> ♪♫ Alex
> UNSUBSCRIBE: mailto:firstname.lastname@example.org?subject=Unsubscribe