From: Kenny
Subject: Who says Lisp is too big?
Date: 
Message-ID: <48764d7d$0$7320$607ed4bc@cv.net>
It took fourteen years, but I finally needed tailp. Unsurprisingly, in 
the functional area where first I finally used ldiff.

hth,kenny

From: Thomas F. Burdick
Subject: Re: Who says Lisp is too big?
Date: 
Message-ID: <0fb20b6e-4fd9-4a7a-b02e-8cf42c3e043e@i76g2000hsf.googlegroups.com>
On Jul 10, 7:56 pm, Kenny <·········@gmail.com> wrote:
> It took fourteen years, but I finally needed tailp. Unsurprisingly, in
> the functional area where first I finally used ldiff.
>
> hth,kenny

Cool, I'll have to remember that those exist. I know I've
reimplemented them a number of times.
From: Vassil Nikolov
Subject: Re: Who says Lisp is too big?
Date: 
Message-ID: <snz7ibtl5ep.fsf@luna.vassil.nikolov.name>
On Thu, 10 Jul 2008 13:56:16 -0400, Kenny <·········@gmail.com> said:

| It took fourteen years, but I finally needed tailp. Unsurprisingly, in
| the functional area where first I finally used ldiff.

  Difference lists [*] are important especially in declarative programming
  e.g. in order to have a fast non-destructive "one-time append"
  (<http://www.google.com/search?q=%22difference+lists%22>, e.g.
  <http://www.cs.cmu.edu/~fp/courses/lp/lectures/11-diff.pdf>).

  _________
  [*] When (TAILP l1 l0), (LDIFF l0 l1) is the difference list represented
      by the pair (l0, l1).

  ---Vassil.


-- 
Peius melius est.  ---Ricardus Gabriel.
From: Kenny
Subject: Re: Who says Lisp is too big?
Date: 
Message-ID: <4876c616$0$11641$607ed4bc@cv.net>
Vassil Nikolov wrote:
> On Thu, 10 Jul 2008 13:56:16 -0400, Kenny <·········@gmail.com> said:
> 
> | It took fourteen years, but I finally needed tailp. Unsurprisingly, in
> | the functional area where first I finally used ldiff.
> 
>   Difference lists [*] ...
>   _________
>   [*] When (TAILP l1 l0), (LDIFF l0 l1) is the difference list represented
>       by the pair (l0, l1).

Bingo! A vital component of my upcoming (this weekend???!!!) Algebra 
software ( http://www.theoryyalgebra.com/ ) is a snazzy math editor that 
does not have you forever reaching with the mouse for icons, and lets 
one type the way one thinks: the quanity x^2-x-6 over (/) the quantity 
x+2 in 12 keystrokes in that order, using the shift key only for the + 
and that only if one is not using a numeric keypad.

To do this without losing (any more of) my sanity I explode the 
hierarchical math structure being edited (x^2-x-6) into a flat list of 
the apparent unrecursed nodes x^2 - x - 6 and, when they hit the slash 
key, "gobble up" more or less stuff to the left (first just the 6, then 
the x and -, then the rest) then  recombine as a hierarchical structure. 
  (The combining code is so elegant it scares me, a true Found 
Algorithm, in the shower IIRC.) So one function determines how much to 
gobble, and then ldiff breaks out for me what was ungobbled.

It is a huge advantage at this point being a reluctant typist: if the 
typing is a PITA, I will know it. :) Imagine typing 1/4x^2 in one less 
keystroke than you see there (the software deduces the circumflex as 
well as the fact that I am typing a simple numeric fraction) and getting 
a nicely formatted fraction times a nicely formatted x-squared... and 
LDIFF made it possible!

:)

kzo
From: Vassil Nikolov
Subject: Re: Who says Lisp is too big?
Date: 
Message-ID: <snzlk09jeat.fsf@luna.vassil.nikolov.name>
On Thu, 10 Jul 2008 22:31:53 -0400, Kenny <·········@gmail.com> said:

| ...
| the quanity x^2-x-6 over (/) the
| quantity x+2 in 12 keystrokes in that order

  I thought x-3 took just three keystrokes...

  Seriously, how does one enter x^2 - x - (6/x) + 2 then?  Or how does
  the context determine that the latter will never be the case?

| ...
| Imagine typing 1/4x^2 in one less
| keystroke than you see there (the software deduces the circumflex as
| well as the fact that I am typing a simple numeric fraction) and
| getting a nicely formatted fraction times a nicely formatted
| x-squared...

  By the way, that term looked, and still looks, like 1/(4x^2) to me
  (the absence of an operator symbol binds more strongly than the
  presence of one, just like a+bc is a+(bc)); now, if there was a
  space after the fraction, like 1/4 x^2, then maybe it would look
  like (1/4)x^2.  Linearizing multi-dimensional notation is a funny
  business...

  ---Vassil.


-- 
Peius melius est.  ---Ricardus Gabriel.
From: Kenny
Subject: Re: Who says Lisp is too big?
Date: 
Message-ID: <4876dd8b$0$5012$607ed4bc@cv.net>
Vassil Nikolov wrote:
> On Thu, 10 Jul 2008 22:31:53 -0400, Kenny <·········@gmail.com> said:
> 
> | ...
> | the quanity x^2-x-6 over (/) the
> | quantity x+2 in 12 keystrokes in that order
> 
>   I thought x-3 took just three keystrokes...

TISLHFYP :)

> 
>   Seriously, how does one enter x^2 - x - (6/x) + 2 then?  Or how does
>   the context determine that the latter will never be the case?

Well the short answer may not apply to this example, but the Prime 
Directive is "Make normal stuff easy/amgic/mind-reading, and unusual 
stuff should require only another keystroke (tho usually a pair of 
them). eg, x^2-y^2 can be typed with five keystrokes (entering and 
exiting the exponent is deduced) but x^a-y^b requires a keystroke (the 
circumflex, in fact) to get in and a right arrow to get out (and I think 
I will have have TAB do the same).

As for the example, the key sequence would be: x2-x-[6/x]+2. Note that 
the software anyway decides itself the actual parens-bracket-brace thing 
inside out as one types, and anyway also makes the outer slightly bigger 
than the inner, enough to look OK with just parens but of course we go 
with the convention.

If you meant the parens not to appear, it would be x2-x-6/x<RIGHT>+2, 
TAB instead of RIGHT when I get round to it.

> 
> | ...
> | Imagine typing 1/4x^2 in one less
> | keystroke than you see there (the software deduces the circumflex as
> | well as the fact that I am typing a simple numeric fraction) and
> | getting a nicely formatted fraction times a nicely formatted
> | x-squared...
> 
>   By the way, that term looked, and still looks, like 1/(4x^2) to me
>   (the absence of an operator symbol binds more strongly than the
>   presence of one, just like a+bc is a+(bc)); now, if there was a
>   space after the fraction, like 1/4 x^2, then maybe it would look
>   like (1/4)x^2.

Absolutely, there should have been a space in there.

>  Linearizing multi-dimensional notation is a funny
>   business...

"Hopeless" might be a better word. :) I certainly never considered using 
such notation for an application where the vast bulk of my market was 
kids who already had no taste for mathematics.

kt
From: Matthias Buelow
Subject: Re: Who says Lisp is too big?
Date: 
Message-ID: <6dn1plF3dg7sU1@mid.dfncis.de>
Kenny wrote:

> It took fourteen years, but I finally needed tailp. Unsurprisingly, in
> the functional area where first I finally used ldiff.

It took you 14 years to make up an example?
Is it nontrivial at least?
From: Kenny
Subject: Re: Who says Lisp is too big?
Date: 
Message-ID: <48766600$0$5005$607ed4bc@cv.net>
Matthias Buelow wrote:
> Kenny wrote:
> 
>> It took fourteen years, but I finally needed tailp. Unsurprisingly, in
>> the functional area where first I finally used ldiff.
> 
> It took you 14 years to make up an example?

make up?! an example?!! what part of "needed"...

> Is it nontrivial at least?

Actually, the tailp is gone now, I went in another direction with that 
particular list manipulation. The ldiff is great, I do this parsing 
thing with a list where one bit gobbles up neighbors, then I reassemble 
the ldiff of the whole with what got gobbled along with the resulting 
gobblation, if you get what I mean.

And with Thomas I had fully implemented ldiff before deciding it must 
exist and finding it.

kt