In arrow.clj: What is iarr an abbreviation for?
Perhaps a docstring on ||| would help, I'm having trouble understanding it. Maybe add these examples, I found them helpful ((arr inc) 1) ;; 2 ((>>> (arr inc) (arr dec)) 1) ;; 1 ((flow (arr inc) >>> (arr inc) >>> (arr inc)) 1) ;; 4 ((*** (arr inc) (arr dec)) [1 1]) ;; [2 0] ((&&& (arr inc) (arr dec)) 1) ;; [2 0] ((fst (arr inc)) [1 1]) ;; [2 1] Scott On Mon, Jun 20, 2011 at 7:57 AM, Jonathan Fischer Friberg <odysso...@gmail.com> wrote: > Hi, > > I figured that I would announce a library that I have been working on for a > while now. > > It's called Hafni, and it's a swing wrapper. Why another swing wrapper? > I wanted to solve the following problems: > > 1. There are a lot of boilerplate code needed. > > 2. Changes made to content is not very functional. > > 3. Changing content is (sometimes) annoyingly hard. > > To solve these problems, I looked into the very functional world of Haskell > and found something called Functional reactive programming (FRP)[1][2] which > has been used to solve problem 2 in gui programming for Haskell. To be able > to program FRP, the datatype "arrow" was created (or maybe the other way > around), and this is what Hafni uses. I wont go into detail here since it is > not very easy to explain in a short mail, and there are a lot of resources > out there on the subject (see the links). > > To be honest, when I first started programming on Hafni, I didn't know that > there existed other swing wrappers for java (I guess I also wanted to try > this myself, which meant that I didn't really search it out), but since they > do exist, lets compare Hafni to the two I have seen on this mailing list: > seesaw [3] and GUIFTW [4]. > > 1. Hafni is strictly a swing wrapper and does not claim to be anything else. > Seesaw - aims to provide a ui library, "It happens to be built on Swing". > GUIFTW - "It's not tied to any GUI toolkit but instead front-ends for > each can be written easily." > > 2. Hafni has facilities, but is not really interested in exactly how > components look. > Seesaw - Doesn't really express an opinion about this, but seems to have > a lot of facilities for making components look a certain way. > GUIFTW - "Style it in a CSS fashion" > > 3. When events happen, Hafni uses the "Event" and "arrow" datatypes to make > things happen while both > seesaw and GUIFTW uses something that looks like > the standard java event function(s). It should be noted that Hafni > event/arrows > behaves exactly like corresponding for seesaw and GUIFTW if no changes is > made to content. > > The reason of 2 (which, in a way, leads to 3) is that when I wrote swing > code manually, the parts > that I were most annoyed with weren't to make things look as I wanted them, > it was changing them. > > I haven't really looked into it exactly (or tried it), but it looks like > seesaw and Hafni can be combined > since seesaw deals directly with java objects (the "config!" function is > especially interesting) [5]. > > I would like to end this mail with an example of Hafni. This example is the > same as in the Hafni readme. > > (frame :content (comp-and-events (button :text "*") > :act (flow (output-arr this :text) >>> > (arr #(str % "*")) >>> > (input-arr this :text))) > :size 200 200 :dont_exit_on_close) > > As it's already explained in the readme, let's look at the most interesting > part: > > (flow (output-arr this :text) >>> (arr #(str % "*")) >>> (input-arr this > :text)) > > This code snippet says that the current text of the button created with > (button :text "*") should "flow" to > the function #(str % "*") which adds a "*" to the text, which should flow to > the text of that same button. > The result of this is that when the button is pressed, the text of that > button is changed as follows: > "*" > "**" > "***" > "****" > etc ... > > And finally, the link to Hafni: https://github.com/odyssomay/Hafni > > ___________________ > > I really hope that someone finds this project interesting, and at best even > useful. ;) > > Questions, comments, ideas, critique? > > Jonathan > > 1. http://en.wikipedia.org/wiki/Functional_reactive_programming > 2. http://www.haskell.org/haskellwiki/Functional_Reactive_Programming > 3. https://github.com/daveray/seesaw > 4. https://github.com/santamon/GUIFTW > 5. http://daveray.github.com/seesaw/seesaw.core-api.html#seesaw.core/config! > > Additional links: > http://www.haskell.org/haskellwiki/Arrow > http://en.wikibooks.org/wiki/Haskell/Understanding_arrows > http://www.haskell.org/arrows/ > > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en