USING: accessors arrays colors.constants combinators db.sqlite db.tuples db.types kernel locals math monads persistency sequences sequences.extras ui ui.gadgets.controls ui.gadgets.layout models.combinators ui.gadgets.labels ui.gadgets.scrollers ui.pens.solid io.files.temp ; 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 short head-slice ; : interface ( -- book ) [ [ [ $ TOOLBAR $ ] COLOR: AliceBlue >>interior , [ "Genres:"