<div dir="ltr"><div>It looks far prettier than a mess of logical spaghetti!<br><br></div>But is this documented with examples for the help &amp; understanding of object-challenged geezers from the days of punch-card boxes converted twice/day to error-message listings?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 12, 2015 at 10:37 AM, Michael Heuer <span dir="ltr">&lt;<a href="mailto:heuermh@gmail.com" target="_blank">heuermh@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Forrest Curo <span dir="ltr">&lt;<a href="mailto:treegestalt@gmail.com" target="_blank">treegestalt@gmail.com</a>&gt;</span> wrote<div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div>Since switches have so far not been included, is there a way around this?<br><br></div>An array of Events?<br><br></div>An array of functions, either numbered or associative? How to declare and call such an array?<br></div></div></blockquote><div><br></div></span><div>ChucK doesn&#39;t have function pointers or similar, so I&#39;ve resorted to functors<br><br><a href="https://github.com/heuermh/lick/blob/master/lick/fn" target="_blank">https://github.com/heuermh/lick/blob/master/lick/fn</a><br><br></div><div>E.g.<br><br></div><div>class DoSomething extends Procedure {<br></div><div>  fun void run() { ... }<br></div><div>}<br></div><div>class DoSomethingElse extends Procedure {<br></div><div>  fun void run() { ... }<br></div><div>}<br></div><div><br></div><div>DoSomething doSomething;<br></div><div>DoSomethingElse doSomethingElse;<br><br></div><div>ArrayList procedures;<br>procedures.add(doSomething);<br></div><div>procedures.add(doSomethingElse);<br><br></div><div>while (true) {<br></div><div>  procedures.sample() $ Procedure @=&gt; Procedure procedure;<br></div><div>  procedure.run();<br></div><div>  1::second =&gt; now;<br></div><div>}<br></div><div><br><br></div><div>Yeah, it ain&#39;t pretty.<span class="HOEnZb"><font color="#888888"><br><br></font></span></div><span class="HOEnZb"><font color="#888888"><div>   michael<br></div></font></span></div></div></div>
<br>_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" rel="noreferrer" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
<br></blockquote></div><br></div>