[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Partition for Emacs Lisp
From: |
TomSW |
Subject: |
Re: Partition for Emacs Lisp |
Date: |
Sun, 28 Jun 2009 14:10:19 -0700 (PDT) |
User-agent: |
G2/1.0 |
On Jun 28, 10:11 pm, Marc Tfardy <b...@cyk.cyk> wrote:
> This is unfortunately my experience too. After 10+ years with
> Mathematica and after my swtich to (Emacs) Lisp I miss many of
> mathematica functions and concepts. (for explanation - I used
> mathematica primary in non-mathematical way, simply as all purpose
> programming language.)
>
> > Everyone just write it from scratch. (it's not easy to write them
> > either, due to the cons business) things like Partition, Flatten,
> > Part, Level, etc gets asked every maybe 3 months for example in
> > comp.lang.lisp over the past decade, and the answers are always wild.
After learning a bit of Haskell I was surprised that CL doesn't have
functions like dropWhile, takeWhile etc. So naturally, I implemented
them asap (curiously, the existence of cons proved no hindrance) - and
then didn't really use them much.
Lisp's macros can be an reason for using a more imperative style (and
a lot of elisp code favours the imperative style for performance
reasons). For example, if you want to consume the partitions of your
list immediately, you could make a do-groups macro:
(do-groups ((a b c) list)
(foo (+ a b) c))
regards
Tom SW