You should reconsider writing mapcars like crazy. Not only makes
the code overly redundant and verbose, but since picolisp has no
compiler, it will do exactly what you express, and so it will traverse
the list once for every mapcar you do, and what's worse, it will create
a new list each time (not to mention the resulting list isn't used
anywhere at all). Also, you are adding a lot of unnecessary nesting by
filling the ArrayList inside of the method. All that code can be
rewritten like this:
(let ArrayList (ArrayList.new)
(for N (range 0 20)
(funcall (.add> T ArrayList)
(funcall (.compareTo> T BigInteger.TEN)
(big: N) ) ) ) ) )
(.forEach> (.stream> ArrayList)
(.println> T System.out) ) ) )
Personally I don't like the ((..) ..) nesting for function calls, so I
define a helper for these cases:
(de funcall "Args"
(eval "Args") )
Learn to write with proper style before your codebase grows any
further or you'll have a lot to cleanup later. Readability matters.
Also, even though the superparens are nice and all, they don't
play well with most editors' paren matching, let alone advanced s-exps
editing tools. Instead of compulsively using them you can try formatting
your code better so you don't get that much nesting. When someone is
trying so hard to avoid parens, it usually means he has not yet noticed
that lisp parens are not nearly as abundant as other symbols in common
languages. Try to count the amount of braces, parens, commas, infix
operators, semicolon, etc you need in java, then compare with lisp.
Then ask yourself, are there really so many parens?
This is mostly a matter of getting used to lisp syntax, but you never
will if you don't try... and when you do, maybe something will click
inside you that will change for the better the way you see lisp
I'm betting you are using some awkward editor to code picolisp.
Try emacs, with picolisp-mode, and paredit. It will change your life.
Just my 2 cents. Hope you don't mind me being so blunt.
On Wed, 13 Mar 2013 01:26:15 +0800
Samuel Dennis Borlongan <srborlon...@gmail.com> wrote:
> [let ArrayList (ArrayList.new)
> (prog1 ArrayList
> (mapcar (.add> T ArrayList)
> (mapcar 'big:
> (mapcar 'java
> (mapcar (.compareTo> T BigInteger.TEN)
> (mapcar 'big:
> (range 0 20]
> (.println> T System.out]