From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mateusz Kowalczyk Newsgroups: gmane.lisp.guile.user Subject: Re: Potluck dish -- a game Date: Wed, 19 Feb 2014 08:02:44 +0000 Message-ID: <53046524.7090809@fuuzetsu.co.uk> References: <7718dde8.1da333e2.53045d1d.7e931@o2.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1392796989 30643 80.91.229.3 (19 Feb 2014 08:03:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 19 Feb 2014 08:03:09 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Feb 19 09:03:14 2014 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WG27e-00020t-4j for guile-user@m.gmane.org; Wed, 19 Feb 2014 09:03:14 +0100 Original-Received: from localhost ([::1]:57051 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WG27d-0001fg-Pb for guile-user@m.gmane.org; Wed, 19 Feb 2014 03:03:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WG27I-0001WL-E0 for guile-user@gnu.org; Wed, 19 Feb 2014 03:02:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WG27D-0005zY-9x for guile-user@gnu.org; Wed, 19 Feb 2014 03:02:52 -0500 Original-Received: from mailex.mailcore.me ([94.136.40.61]:36607) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WG27D-0005zC-2F for guile-user@gnu.org; Wed, 19 Feb 2014 03:02:47 -0500 Original-Received: from host86-144-102-27.range86-144.btcentralplus.com ([86.144.102.27] helo=[192.168.1.15]) by mail10.atlas.pipex.net with esmtpa (Exim 4.71) (envelope-from ) id 1WG27B-0002Ej-8t for guile-user@gnu.org; Wed, 19 Feb 2014 08:02:45 +0000 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 In-Reply-To: <7718dde8.1da333e2.53045d1d.7e931@o2.pl> X-Enigmail-Version: 1.6 X-Mailcore-Auth: 11603993 X-Mailcore-Domain: 1390428 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 94.136.40.61 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:11080 Archived-At: On 19/02/14 07:28, Ścisław Dercz wrote: > Dnia 18 lutego 2014 19:27 "Thompson, David" napisał(a): > >> On Tue, Feb 18, 2014 at 3:53 AM, Panicz Maciej Godek >> wrote: >>> Hi, >>> sorry that it took so long, but my friend Drcz wrote a clone of >>> Pandora game in Guile using my SLAYER framework. Due to some >>> difficulties of a technical nature, I only managed to set up the >>> website today, so now the screens are available here: >>> http://puszcza.gnu.org.ua/software/slayer/?page=screenshots >> >> Cool! Thanks for sharing. Care to explain a bit about the monoid >> code? I'm interested in monads as applied to games. >> >> - Dave >> > > Hi! > > Actually it's not "a clone of Pandora game", the game is called "pandora" > and it is "a chimera-alike". > The monoid... I wanted to write the mechanics in a purely functional style, > and the obvious choice was to describe it as a couple of world->world > transformations; these in turn form a monoid under the composition action > (and with identity map as unit). > That's all, unfortunately it does not have much to do with monads per se... > or does it? I'm an categorial ignorant! Categories for the Working Mathematician states: “All told, a monad in X is just a monoid in the category of endofunctors of X, with product × replaced by composition of endofunctors and unit set by the identity endofunctor.”. There is tons of reading material about this if you want to look up the quote. Whether you can argue that it holds in Guile is another matter, especially considering that trying to reason about these things in a dynamically typed language is silly to begin with. You can try ;) The common way to make a monad from functions of type ‘a → b’ (that is a monad for (→ a) is to make η/return the constant function and to make μ/bind/>>= look like ‘f >>= k = λ r → k (f r) r’. I don't see this exercised anywhere in the source although again, I'm not looking too carefully. I hope that satisfies your question. > > Cheers, > d. > -- Mateusz K.