tag:blogger.com,1999:blog-5569894.post3056853590342839560..comments2023-11-08T13:18:07.006+00:00Comments on Distributed Memory: A first refactoring of A-star in ErlangSteve Gilhamhttp://www.blogger.com/profile/03622573187942388226noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-5569894.post-47200549979015285632009-03-17T09:21:00.000+00:002009-03-17T09:21:00.000+00:00There was a spurious comma in the highlighting scr...<A HREF="http://stevegilham.blogspot.com/2009/03/bugfix-syntax-highlight-brush-for.html" REL="nofollow">There was a spurious comma in the highlighting script</A>, which borked IE. Fixed now.Steve Gilhamhttps://www.blogger.com/profile/03622573187942388226noreply@blogger.comtag:blogger.com,1999:blog-5569894.post-47358403729495351512009-03-16T12:26:00.000+00:002009-03-16T12:26:00.000+00:00It appears that the syntax highlighting for Erlang...It appears that the syntax highlighting for Erlang is working for FireFox, but is doing something weird for IE.<BR/><BR/>If you go to the whole-month page for October, the Erlang code shows but isn't highlighted; and as noted vanishes altogether if you just go to the single entry.Steve Gilhamhttps://www.blogger.com/profile/03622573187942388226noreply@blogger.comtag:blogger.com,1999:blog-5569894.post-4762875532990819422009-03-11T19:03:00.000+00:002009-03-11T19:03:00.000+00:00I can't see the Erlang Code. It shows up for an in...I can't see the Erlang Code. It shows up for an instant when I click on the title, then it disapears. Thanks!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5569894.post-51612303247164174122008-10-06T16:18:00.000+01:002008-10-06T16:18:00.000+01:00Wow, that code cleaned up nicely!The remaining &qu...Wow, that code cleaned up nicely!<BR/><BR/>The remaining "if" statements in crossing_time and display are fine. However, just for the mental exercise, you can also think of them in terms of operations over lists. The crossing_time fun, for example, operates over a list of [16, 8, 4, 2] where 2 represents the current "true" branch of the "if", and display operates over the list [16, 8, 4, 2, 1] where 1 represents the "true" branch. Folding over these lists would work, but note that doing so would require walking the whole list. While that's admittedly not very expensive, it still costs more than the short-circuiting "if". You could do this to walk the list while still short-circuiting:<BR/><BR/>crossing_time(Swap) -><BR/> crossing_time(Swap, [{16, 10}, {8,5}, {4,2}, {2,1}]).<BR/>crossing_time(_, [{2,1}]) -> 1;<BR/>crossing_time(Swap, [{Val, Result} | _])<BR/> when Swap band Val =/= 0 -><BR/> Result;<BR/>crossing_time(Swap, [_ | T]) -> crossing_time(Swap, T).<BR/><BR/>I wouldn't argue that that's clearer than the "if" though.Unknownhttps://www.blogger.com/profile/05290344629915279127noreply@blogger.com