USING: accessors arrays db.tuples db.sqlite persistency db.queries io.files.temp kernel monads sequences ui ui.frp.gadgets ui.frp.layout ui.frp.signals ui.gadgets.scrollers ui.gadgets.labels colors.constants ui.pens.solid combinators math locals strings ui.images db.types ; FROM: sets => prune ; IN: recipes STORED-TUPLE: recipe { title { VARCHAR 100 } } { votes INTEGER } { txt TEXT } { genre { VARCHAR 100 } } ; : ( title genre text -- recipe ) recipe new swap >>txt swap >>genre swap >>title 0 >>votes ; "recipes.db" temp-file recipe define-db : top-recipes ( offset search -- recipes ) T{ recipe } rot >>title >>tuple "votes" >>order 30 >>limit swap >>offset get-tuples ; : top-genres ( -- genres ) f f top-recipes [ genre>> ] map prune 4 (head-slice) ; : ( str -- button ) "vocab:recipes/icons/" ".tiff" surround ; : interface ( -- book ) [ [ [ $ TOOLBAR $ $ SEARCH $ ] COLOR: AliceBlue >>interior , [ "Genres:"