Inline below:
On 5/22/07, Terrence Brannon <[EMAIL PROTECTED]> wrote:
Roy A. Crabtree <roy.crabtree <at> gmail.com> writes:
>
> Mebbe I am missing the pint heah:
>
> Instead of
>
> (((A pp 2) pp 3) pp4)...
>
> what if you stated it as
>
> 4 pp 3 pp 2 pp A
>
> as a slightly more friendly way of looking at it?
that's slick - I like it!
>
> After all, you can always rewrite process_prime that way, or
yes, instead of list process_prime integer
it can be integer process_prime list
>
> ...provide a wrapper
>
> And that in turn should make the code a bit cleaner:
>
> i) generate your list (2 3 4 ...)
2 }. (i. 28)
> ii) reverse it (4 3 2)
|. ( 2 }. (i. 28) )
> iii) scan apply it to A.
scan is beyond me... help needed.
Or reduce apply it: I am using the old APL names.
(The eintent is force use of the J dictionary rather than handing out the
solution. )
Summa =. reduce apply add
Pi =. reduce apply multiply
better?
> Now: restate that recursively in lazy evaluative form ...
say what?
Since in the suggested problem set you will not have the actual list:
the problem being solved _using_ the next item to _extend_ the list
you can achieve the same solution structural format
by _assuming_ the list will have the element when you need it
and stating the code in that form
and then:
write the code that initiates _evaluation_ of those code steps
_only_ when the "next item" is actually being demanded for evaluation:
in short:
wait as long as possible before evaluating.
See SETL and goal directed languages, especially those with backtracking,
for examples.
J does this rather neatly and succinctly.
See the Archives for concrete examples.
> because: ...
> > > A ( [: > process_prime~&.>/ <"0 <at> |. <at> ] , < <at> [)
2}.i.28
>
> after i.28, the rest of it seems like a hole lotta syntax for what
should
> be
>
> reverse, append, scan/reduce....
amen. it cracks me up when someone knows so much that he/she overlooks the
simple elegant solutions.
beenthere. donethat.
Thom GIlb, a Norwegian peer of Edsger Dykstra, said, much to the chagrin of
most
US based programmers, back in the 70s:
Inside every large program there's a small one struggling to get out.
Same is true in J as any where else.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
--
--
Roy A. Crabtree
UNC '76 gaa.lifer#
(For TN contact, email me to set up a confirmed date/time)
[When you hear/read/see/feel what a yehudi plays/writes/sculpts/holds]
[(n)either violinist {Menuhin} (n)or writer {"The Yehudi Principle"} (n)or
molder (n)or older]
[you must strive/think/look/sense all of it, or you will miss the meanings
of it all]
[EMAIL PROTECTED] Forwards only to:
[EMAIL PROTECTED] CC: auto to:
[EMAIL PROTECTED] Be short < 160 chars cuts off; currently
offline
[EMAIL PROTECTED] CC: auto to ^
http://www.authorsden.com/royacrabtree
http://skyscraper.fortunecity.com/activex/720/resume/full.doc
--
(c) RAC/IP, ARE,PRO,PAST
(Copyright) Roy Andrew Crabtree/In Perpetuity
All Rights/Reserved Explicitly
Public Reuse Only
Profits Always Safe Traded
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm