On Sat, Aug 13, 2016 at 2:18 PM Jafar Al-Gharaibeh <[email protected]>
wrote:

> On Sat, Aug 13, 2016 at 5:53 AM Bruce & Breeanna Rennie <
> [email protected]> wrote:
>
>> Good evening to all,
>>
>> I have written the following test program
>>
>> procedure main()
>>      every write(test())
>> end
>>
>> procedure test()
>>      every (suspend 1 to 3) & (1 to 3)
>> end
>>
>>
>> Based on what is understood from the semantics of unicon, what do people
>> believe this should do?
>>
>
> Very Interesting, especially throwing suspend into the mix!
>
> Expression evaluation work from left to write while backtracking works
> right to left. every forces all expressions to generate all possible
> solutions. The output is the easy part here. test() is going to produce the
> values generated by (suspend 1 to 3), so I expect the output to be:
> 1
> 2
> 3
>
> The mechanic of how this actually happens is the interesting part. Based
> on what I said above, for each suspend, the expression that follows & (1 to
> 3 ) will be evaluated with all possible results before backtracking to
> suspend the next result. Something like this:
> (suspend 1)  &  (1 to 3) where 1 to 3 produces the values 1, 2 and 3
> before failing and the evaluation backtracks to suspend. Of course the
> values 1, 2, and 3 are all unused in this case. Then:
> (suspend 2) &  (1 to 3) and the evaluation continues the same way.
>
> Of course I might be missing something here :)
>

Yes, I  missed something!  after looking at Steve's answer, I remembered
that suspend is not your "normal" expression. It doesn't need an every to
produce all results in its expression. That is a built-in feature of
suspend. All possible results within the suspend expression will be
produced before leaving suspend itself. Just like every, suspend fails when
all possible results are produced, so the whole expression containing
suspend fails and the evaluation never actually moves to & or beyond!

Again, the output was easy to figure out in this case, but the mechanic is
the tricky part! Thanks Steve for the insight!

To reveal the mechanics, test() could be changed to
procedure test()
     every (suspend 1 to 3) & write(1 to 3)
end

Cheers,
Jafar


>> As a part of a specific side project I am working on, I am investigating
>> some of the conditions of unicon/icon semantics.
>>
>> Any thoughts will be welcome. I do ask that nobody actually compile and
>> run this just yet. I want to see what people think first before
>> discussing the results obtained.
>>
>> regards
>>
>> Bruce Rennie
>>
>>
>> ------------------------------------------------------------------------------
>> What NetFlow Analyzer can do for you? Monitors network bandwidth and
>> traffic
>> patterns at an interface-level. Reveals which users, apps, and protocols
>> are
>> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
>> J-Flow, sFlow and other flows. Make informed decisions using capacity
>> planning reports. http://sdm.link/zohodev2dev
>> _______________________________________________
>> Unicon-group mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/unicon-group
>>
> --
>
> -- Sent From My Smartphone
>
-- 

-- Sent From My Smartphone
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. http://sdm.link/zohodev2dev
_______________________________________________
Unicon-group mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to