Re: [Ur] Browser-based adventure game
> fun render (sgs : source gameState) : signal xbody = Thanks! I changed the function as you suggested. -Michael ___ Ur mailing list Ur@impredicative.com http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
Re: [Ur] Browser-based adventure game
On 10/12/2016 12:17 PM, Michael Rohs wrote: - What is the type of a function that produces arbitrary HTML snippets. Is xbody correct? Ur/Web's XML types track context, e.g., body vs. head, which allow different nested tags. So [xbody] is only the right type for tags that fit under . - What is the name of "show" and "eq" functions? I used "show_list", "show_gameState", "show_pair", and "eq_pair" instead of just "show" and "eq". Is this correct? That matches conventions I've followed. It would be confusing to shadow [show] and [eq] themselves, which other code might still expect to use with other types. - Is there a more convenient syntax for list construction than "1 :: 2 :: 3 :: []", something like "[1, 2, 3]"? Not at the moment. Square brackets are used for another meaning (actual type parameters to functions). - Does Ur/Web do tail-call optimization? I can confirm a "yes" answer here. - Will there be other collections beyond lists (dictionary/map, array)? No other collection structures are in my mental to-do list for extending the standard library. I find that most usual applications of those data structures wind up being done (more declaratively) with SQL instead. ___ Ur mailing list Ur@impredicative.com http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
Re: [Ur] Browser-based adventure game
Hi Michael, I am afraid I cannot give you "definitive" answers for much of your questions. Anyway, I will try my best :) - Is there a more convenient syntax for list construction than "1 :: 2 :: 3 > :: []", something like "[1, 2, 3]"? > I am afraid there is not. > - I had to pass both a "gameState" and a "source gameState" parameter to > the "render" function (for the same game state). Is there a way around that? > Yes. You can change the render function to produce a "signal xbody" rather than producing a "xbody": fun render (sgs : source gameState) : signal xbody = gs <- signal sgs; return (let fun cols (row : int) (col : int) : xtr = (* ... *) end) Now you can pass the signal render produces to the signal attribute of the dyn tag: (* Entry point of the program. *) fun main () : transaction page = (* ... *) (* ... *) > - I minimized the use of mutable data. So when the game state changes much > of the page gets updated. This should probably be done in a more > fine-grained way in reality. > As long there is no performance problem, I think your implementation is fine. > - Does Ur/Web do tail-call optimization? > I believe it does. Sincerely, Saulo ___ Ur mailing list Ur@impredicative.com http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
Re: [Ur] Browser-based adventure game
Hi Saulo, Here are some points of doubt: - What is the type of a function that produces arbitrary HTML snippets. Is xbody correct? - What is the name of "show" and "eq" functions? I used "show_list", "show_gameState", "show_pair", and "eq_pair" instead of just "show" and "eq". Is this correct? - Is there a more convenient syntax for list construction than "1 :: 2 :: 3 :: []", something like "[1, 2, 3]"? - I had to pass both a "gameState" and a "source gameState" parameter to the "render" function (for the same game state). Is there a way around that? - I minimized the use of mutable data. So when the game state changes much of the page gets updated. This should probably be done in a more fine-grained way in reality. - Does Ur/Web do tail-call optimization? - Will there be other collections beyond lists (dictionary/map, array)? Best, Michael > On 12 Oct 2016, at 16:27, Saulo Araujowrote: > > Hi Michael, > > Thanks for sharing your game with the community. I skimmed its source code > and I did not found anything that I would qualify as a non-canonical use of > Ur/Web. However, beware that I am an Ur/Web beginner too :) Maybe you can > pinpoint which parts of the code you are afraid are non-canonical uses of the > language... > > Sincerely, > Saulo > > On Wed, Oct 12, 2016 at 8:33 AM, Michael Rohs > wrote: > Hi, > > As part of my exploration of Ur/Web I wrote a tiny browser-based adventure > game. > > https://github.com/mirohs/urweb-adventure > > It might be helpful to others looking at the language. If you find > non-canonical use of the language (I guess there is some...), please let me > know. > > Cheers, > Michael > > > ___ > Ur mailing list > Ur@impredicative.com > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > > ___ > Ur mailing list > Ur@impredicative.com > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur ___ Ur mailing list Ur@impredicative.com http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
Re: [Ur] Browser-based adventure game
Hi Michael, Thanks for sharing your game with the community. I skimmed its source code and I did not found anything that I would qualify as a non-canonical use of Ur/Web. However, beware that I am an Ur/Web beginner too :) Maybe you can pinpoint which parts of the code you are afraid are non-canonical uses of the language... Sincerely, Saulo On Wed, Oct 12, 2016 at 8:33 AM, Michael Rohs < michael.r...@hci.uni-hannover.de> wrote: > Hi, > > As part of my exploration of Ur/Web I wrote a tiny browser-based adventure > game. > > https://github.com/mirohs/urweb-adventure > > It might be helpful to others looking at the language. If you find > non-canonical use of the language (I guess there is some...), please let me > know. > > Cheers, > Michael > > > ___ > Ur mailing list > Ur@impredicative.com > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > ___ Ur mailing list Ur@impredicative.com http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
[Ur] Browser-based adventure game
Hi, As part of my exploration of Ur/Web I wrote a tiny browser-based adventure game. https://github.com/mirohs/urweb-adventure It might be helpful to others looking at the language. If you find non-canonical use of the language (I guess there is some...), please let me know. Cheers, Michael ___ Ur mailing list Ur@impredicative.com http://www.impredicative.com/cgi-bin/mailman/listinfo/ur