3 ms·
Ask HN: How to create a DSL to represent clothing?
I've been thinking about this for a long time. People usually give the advice of "scratch your own itch" to generate ideas: well, when it comes to selecting what to wear I'm not only color blind but also, how to put it, somewhat fashion-challenged. Current solution is to have my wife select stuff and give me the look-over in the morning. I know, pathetic.
In search of a better approach, I thought of creating a list of all clothing items I have with attributes (type:t-shirt, color:green, etc.). I'd like to create a DSL that I can (1) use to describe my whole outfit and (2) "compile" the selected outfit for "errors", e.g. red short doesn't go with brown sweater.
To get me started, what's the best approach to building such a thing?
- __d 8y agoPerhaps you could start out building your data model using an existing language? That'd give you the chance to experiment with the semantics, and figure out what you need to express in your DSL in a fairly rigorous way. Once you've nailed that, you could start playing with syntaxes that could be compiled to that data model. Some sort of declarations and then expressions for "outfits", maybe? Have you considered using Prolog? I'm no expert, but that was my first thought for tackling this kind of problem.