🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #165

Re: Types, arrays, generality, and notation (was: Fortran90 and Arrays)

#165
From: Raul Deluth Miller-Rockwell
Date: Mon, 13 Apr 1992 00:26
49 lines
2754 bytes
Stephen P Spackman:
>  You are searching in a tree, and you want to use the natural tree
>  structure and not get it flattened to a vector. I *don't* know of a
>  language with a type structure in which this very practical problem
>  can be made to drop out notationally though - but wait another five
>  or ten years, and you'll see it cropping up. It'll look like an
>  alternate interface that makes an automatic coercion (an interface
>  inheritance, actually) unnecessary.

This doesn't look like a difficult problem.  As I understand it, you
wish a function which will take as arguments a tree, and keys to look
for inside that tree -- then return the sub-trees indicated by those
keys.  Just about any language should be able to deal with this.

Of, maybe you wish an operation which will take a matching function,
instead of a key?  Or maybe references to matching functions?

>  |For example: let's scan addition across an list of integers
>  |(1,3,5,7,9).  What happens if the result is (16,8,5,15,25) [I
>  |summed from the middle element out, alternating left and right]?
>  |Is this meaningful to any algorithm you know?

>  You need to use "cons" instead of "+" to see how it might be
>  interesting - "+" has the wrong algebraic properties for this
>  operation, and that ought (in principle) to be a static type error.

Using a "cons" like operation, instead of "+" here's a few examples of
random-order reduction on the above list:
   cons_reduce (1,3,5,7,9)
((1,3),(5,(7,9)))
   cons_reduce (1,3,5,7,9)
((((1,3),5),7),9)
   cons_reduce (1,3,5,7,9)
((1,((3,5),7)),9)

Now, what is meant by a random-order scan?  Using J's scan with this
random order "cons reduce" operation, I get results like:
   cons_reduce\ (1,3,5,7,9)
1                
(1,3)            
((1,3),5)        
(1,((3,5),7))    
((1,3),(5,(7,9)))

Maybe you want a grove of "trees" where the partial results are
interdependent?  Or what?

-- 
Raul Deluth Miller-Rockwell                   <rockwell@socrates.umd.edu>
Technical Details
Message-ID: <ROCKWELL.92Apr12192640@socrates.umd.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!socrates!socrates!rockwell
References: <ROCKWELL.92Mar21001252@socrates.umd.edu> <STEPHEN.92Apr10055926@estragon.uchicago.edu> <1992Apr10.184017.10041@newshost.lanl.gov> <STEPHEN.92Apr11043808@estragon.uchicago.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.misc
Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!socrates!socrates!rockwell
From: rockwell@socrates.umd.edu (Raul Deluth Miller-Rockwell)
Subject: Re: Types, arrays, generality, and notation (was: Fortran90 and Arrays)
In-Reply-To: stephen@estragon.uchicago.edu's message of 11 Apr 92 09:38:02 GMT
Message-ID: <ROCKWELL.92Apr12192640@socrates.umd.edu>
Sender: rockwell@socrates.umd.edu (Raul Deluth Miller-Rockwell)
Organization: Traveller
References: <ROCKWELL.92Mar21001252@socrates.umd.edu>
 <STEPHEN.92Apr10055926@estragon.uchicago.edu>
 <1992Apr10.184017.10041@newshost.lanl.gov>
 <STEPHEN.92Apr11043808@estragon.uchicago.edu>
Date: Mon, 13 Apr 1992 00:26:40 GMT
Lines: 49