Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #22096

Re: Stream programming

Date 2012-03-23 21:44 +0100
From Kiuhnm <kiuhnm03.4t.yahoo.it>
Newsgroups comp.lang.python
Subject Re: Stream programming
References <4f6c9e17$0$1383$4fafbaef@reader2.news.tin.it> <CAOFbRmL63M5TZ4mqaz70J04HVP6OiKVSYBudayHwJUt-SZ1QFA@mail.gmail.com> <4F6CBA4C.3020206@mrabarnett.plus.com> <mailman.943.1332530583.3037.python-list@python.org>
Message-ID <4f6ce0ab$0$1384$4fafbaef@reader1.news.tin.it> (permalink)
Organization TIN.IT (http://www.tin.it)

Show all headers | View raw


On 3/23/2012 20:23, Nathan Rice wrote:
>>>>   I will use "<=>" to mean "is equivalent to". That's not part of the DSL.
>>>>   A flow has one or more streams:
>>>>    1 stream:
>>>>      [1,2,3]
>>>>    2 streams:
>>>>      [1,3,5] | [2,4,6]
>>>>   Two flows can be concatenated:
>>>>    [1,2,3] + [4,5,6]<=>    [1,2,3,4,5,6]
>>>>    [0] + ([1,2] | [3,4]) + [10]<=>    [0,1,2,10] | [0,3,4,10]
>>>>    ([1,2] | [10,20]) + ([3,4] | [30,40])<=>    [1,2,3,4] | [10,20,30,40]
>>>
>>>
>>> Algebraically, your concatenation rules don't really make sense - your
>>> flows are both distributive and non distributive.  You also make the
>>> implicit assumption of an order over streams in a flow, but disregard
>>> the implications of that assumption in some cases.  I understand what
>>> you're trying to communicate, so I think you need to be a little more
>>> strict and explicit in your definitions.
>>>
>> When concatenating, either there are the same number of streams, or one
>> of them is a single stream which is duplicated.
>>
>> Therefore, in this example:
>>
>>     [0] + ([1, 2] | [3, 4])
>>
>> you're concatenating a single stream with a pair, so the single stream
>> is duplicated:
>>
>>     ([0] | [0]) + ([1, 2] | [3, 4])
>>
>> and then they can be concatenated:
>>
>>     ([0, 1, 2] | [0, 3, 4])
>>
>> However, this:
>>
>>     ([0, 1] | [2, 3]) + ([4, 5] | [6, 7] | [8, 9])
>>
>> won't work.
>
> I understand how he wants the system to work in this case; my point
> was that it isn't consistent.
>
> He stated flows can be concatenated, so [0] is just a flow of a single
> stream.  Because he clearly intends that streams in a flow are
> ordered, that indicates that he wants some sort of algebraic module.
> He could get close if he can extend a stream to meet the requirements
> of a ring, then a flow would be a module over the ring of streams.
> The problem he is going to run into is that operations on streams as
> he defines them are not commutative.  Identity elements for the two
> binary operations are also not immediately obvious to me.

Instead of talking of what I wasn't trying to do and, indeed, I didn't 
do, you should try to understand what I wanted to do and, in fact, I did.
I'm afraid your cup is too full to understand simple things as the one I 
wrote in my OP.

Kiuhnm

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Stream programming Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-23 17:00 +0100
  Re: Stream programming Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-23 17:02 +0100
  Re: Stream programming Nathan Rice <nathan.alexander.rice@gmail.com> - 2012-03-23 12:33 -0400
    Re: Stream programming Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-23 21:33 +0100
      Re: Stream programming Nathan Rice <nathan.alexander.rice@gmail.com> - 2012-03-23 17:18 -0400
        Re: Stream programming Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-24 01:26 +0100
      Re: Stream programming Ethan Furman <ethan@stoneleaf.us> - 2012-03-23 14:12 -0700
        Re: Stream programming Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-24 00:57 +0100
  Re: Stream programming MRAB <python@mrabarnett.plus.com> - 2012-03-23 18:00 +0000
  Re: Stream programming Nathan Rice <nathan.alexander.rice@gmail.com> - 2012-03-23 15:23 -0400
    Re: Stream programming Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-23 21:44 +0100
  Re: Stream programming Ray Song <emacsray@gmail.com> - 2012-03-24 07:32 +0800
    Re: Stream programming Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-24 01:41 +0100
  Re: Stream programming Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-03-24 03:23 +0000
    Re: Stream programming Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-24 12:05 +0100
  Re: Stream programming Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-03-26 11:27 +0200
    Re: Stream programming Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-26 13:45 +0200

csiph-web