User loginNavigation |
archivesFunctional Reactive GUI for O'CamlHi all, Since functional reactive programming has come up here a few times in the past, I figured my posting of this wouldn't be too out-of-place... I've been working for the past few months on a functional reactive GUI system for O'Caml called "O'Caml Reactive Toolkit". The core FR logic is based heavily on Haskell's Yampa, while the FR API is modelled after PLT Scheme's FrTime (users of FrTime should feel at home with the API), so there is not much new there. The novelty is in the GUI API, which constructs a GUI via functions, in contrast to systems such as Fudgets (which uses arrows), or SuperGlue (which uses objects with explicit signal connections). The goal in API design is simplicity and clarity. As an example, here is a toy temperature conversion program: open Fr open FrGui let _ = let temp_box, temp = float_entry 20. in let fahrenheit = lift ((@temp -. 32.) *. 1.8) and celsuis = lift (@temp /. 1.8 +. 32.) in let main_window = window ~title: "Temperature converter" (hbox [ hbox [label "Convert "; temp_box; label " to:"]; vbox [ hbox [label "degrees Fahrenheit: "; float_view fahrenheit]; hbox [label "degrees Celsius: "; float_view celsius]]]) in run_dialog (main_window, main_window#close) The temperature entered by the user is instantly converted to both degrees Fahrenheit and degrees Celsius. (Note the definitions of "float_entry" and "float_view", although trivial, have been left out to save space.) Though O'Caml RT is far from complete I made a prerelease because I want to solicit feedback from others who are interested in functional reactive programming. I made a web page providing links to the source code, documentation, and (coming soon) examples. It's known to compile on Mac OS X and Linux, and it should be possible already to write many simple GUI applications using it. My questions to you are:
Thanks in advance for your feedback! (P.S. I don't want this to come off as a plug for O'Caml RT... if any of the admins feel this is too specific a topic for LtU I'll try to find a more appropriate forum to discuss it in.) The Role of Composition in Computer ProgrammingThis paper by Donald McIntyre is a classic in the J language world. It ranks up there with "Why Functional Programming Matters" in terms of concise, impressive examples. Most of the examples have a geometric bent, like finding the area of a polygon. Note that this paper was written using an early version of J, so some of the syntax has unfortunately changed. Scheme interpreters written in Standard ML?Heading into the fourth chapter of SICP, I figure that either I could attempt to build a metacircular ML or cheat and just implement a Scheme interpreter. Going down the path of least resistance, I was wondering if there are some minimalist implementations of Scheme available in Standard ML? |
Browse archivesActive forum topics |
Recent comments
22 weeks 10 hours ago
22 weeks 14 hours ago
22 weeks 14 hours ago
44 weeks 1 day ago
48 weeks 3 days ago
50 weeks 22 hours ago
50 weeks 22 hours ago
1 year 4 days ago
1 year 5 weeks ago
1 year 5 weeks ago