Re: Better RecursiveTask Example
"Dr Heinz M. Kabutz via Concurrency-interest" <[email protected]> Thu, 25 Nov 2021 06:56:51 +0200
| Newsgroups | gmane.comp.java.jsr.166-concurrency |
|---|---|
| Organization | JavaSpecialists.eu |
| Message-ID | <[email protected]> |
--===============2501157651846135494==
Content-Type: text/html; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 8bit
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<br>
<div class="moz-cite-prefix">On 2021/11/25 00:07, Tim Peierls via
Concurrency-interest wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CA+F8eeSz-YaVQfGjWvEp4P5NKB6Lf4qDR6-0LGniCBO7M39qBA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div class="markdown-here-wrapper" style="">
<p style="margin:0px 0px 1.2em!important">On Wed, Nov 24, 2021
at 4:14 PM Remi Forax via Concurrency-interest <a
href="http://mailto:[email protected]"
moz-do-not-send="true">[email protected]</a>
wrote:</p>
<blockquote style="margin:1.2em 0px;border-left:4px solid
rgb(221,221,221);padding:0px
1em;color:rgb(119,119,119);quotes:none">
<p style="margin:0px 0px 1.2em!important">We can also use
‘var’, every declarations are aligned but it is perhaps
harder to understand</p>
</blockquote>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important">* protected BigInteger compute() {
* if (from == to) { // base case
* return (from == 0) ? BigInteger.ONE : BigInteger.valueOf(from);
* }
* var mid = (from + to) >>> 1; // split in half
* var leftTask = new FactorialTask(from, mid).fork();
* var rightTask = new FactorialTask(mid + 1, to);
* var right = rightTask.invoke(); // perform half the work locally
* var left = leftTask.join();
* return left.multiply(right);
* }
</code></pre>
<p style="margin:0px 0px 1.2em!important">It is <b>definitely
</b>harder to understand. My brain is wired to look on the
left for types. Lines that are all lower-case initial before
an <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">=</code>
don’t look like sources of type information to me.</p>
</div>
</div>
</blockquote>
<p>I would second that.</p>
</body>
</html>
--===============2501157651846135494==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Concurrency-interest mailing list
[email protected]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
--===============2501157651846135494==--