On Sat, Oct 22, 2016 at 3:05 PM,  <meino.cra...@gmx.de> wrote:
> Robby Findler <ro...@eecs.northwestern.edu> [16-10-22 21:28]:
>> You need to follow the design recipe to solve a problem like this. You
>> data is clear: [Listof [Listof Real]] and [Listof Real]. Next up:
>> examples. Do you have examples of the inputs and outputs you want for
>> this function?
>>
>> Robby
>>
>> On Sat, Oct 22, 2016 at 2:03 PM,  <meino.cra...@gmx.de> wrote:
>> > Hi,
>> >
>> > (I am still a newbie ... )
>> >
>> > If I remember  one rule of functional programming
>> > correctly, it says:
>> > Instead of changeing data - create new data.
>> >
>> > Suppose I have a list of list. Each "sublist" is
>> > made of a greater amount (but identical count) of
>> > exact numbers (integers).
>> >
>> > I want to process these data recursively and if
>> > all is done I want to get back a list of numbers
>> > (same count of numbers as in each sublist), which
>> > represents the maximum of all numbers of that "position"
>> > in all sublists.
>> >
>> > If I want to make this purely (may be inpractical) functional,..
>> > I see (as a newbie) the following problem.
>> > From two numbers as input I have to build a maximum and
>> > have to feed that into the next circle of recursion as
>> > one of the numbers to compare.
>> > Each time a new maximum is found I have to overwrite the
>> > old one.
>> > This contradicts the rule "Dont change data, create new one."
>> >
>> > How can I get out of this?
>> >
>> > Cheers
>> > Meino
>> >
>> >
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "Racket Users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an 
>> > email to racket-users+unsubscr...@googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> Hi Robby, hi Phillip, hi Justin,
>
> thanks a lot for your help... !!! :)
> This gives me mind twisters (but this was one reason
> for me to learn racket ;)
>
> So, I think my "knot in the logic" was
> to process one sublist at each circle of recursion
> and being urged to create a temporary maximum with
> each recursion that way, which gets possibly overwritten
> in the next circle with a new temporary maximum.
>
> The 'apply map' creates - as far as I can understand it -
> the maximum from ALL numbers of a certain position of all sublists
> in one go. It creates on ONE maximum and no temporary resuls.
> That's clever :)
>
> Cheers,
> Meino
>
> From the Dictionary of Adanced Programming:
> "Recursion, the: (see "Recursion" )
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to