我正在尝试建立一个系统,该系统将根据提供的物品数量和有多少行打印一定数量的页面。
我基本上有一个带有几个字段的地图列表,包括一个可能很长并且跨越打印机上的多行的名称字段。我有一个功能可以辨别它将占用多少行,所以这没问题。
主要问题是我想在产品集合达到 30 行时拆分(好吧,分区,如果你使用 clojure 的术语),所以我可以开始另一个页面。有没有办法遍历集合,计算出最多 30 行的总行(如果有一个多行产品,否则会超过 30 行)然后拆分它?
我想转这个
[{:qty 2 :size "M" :product "Testing 1 2 3"}
{:qty 1 :size "S" :product "Hello there world"}
{:qty 12 :size "XS" :product "Some really long product name just to test"}
{:qty 932 :size "L" :product "More longer names to play with"}
{:qty 1 :size "M" :product "Another product name"}
{:qty 1242 :size "XS" :product "This is just an obscenely long product name that I am hoping will spill over on to the next lines"}
{:qty 2 :size "M" :product "Testing 1 2 3"}
{:qty 1 :size "S" :product "Hello there world"}
{:qty 12 :size "XS" :product "Some really long product name just to test"}
{:qty 932 :size "L" :product "More longer names to play with"}
{:qty 1 :size "M" :product "Another product name"}
{:qty 1242 :size "XS" :product "This is just an obscenely long product name that I am hoping will spill over on to the next lines"}
{:qty 2 :size "M" :product "Testing 1 2 3"}
{:qty 1 :size "S" :product "Hello there world"}
{:qty 12 :size "XS" :product "Some really long product name just to test"}
{:qty 932 :size "L" :product "More longer names to play with"}
{:qty 1 :size "M" :product "Another product name"}
{:qty 1242 :size "XS" :product "This is just an obscenely long product name that I am hoping will spill over on to the next lines"}]
进入这个
[[{:qty 2 :size "M" :product "Testing 1 2 3"}
{:qty 1 :size "S" :product "Hello there world"}
{:qty 12 :size "XS" :product "Some really long product name just to test"}
{:qty 932 :size "L" :product "More longer names to play with"}
{:qty 1 :size "M" :product "Another product name"}
{:qty 1242 :size "XS" :product "This is just an obscenely long product name that I am hoping will spill over on to the next lines"}
{:qty 2 :size "M" :product "Testing 1 2 3"}
{:qty 1 :size "S" :product "Hello there world"}
{:qty 12 :size "XS" :product "Some really long product name just to test"}
{:qty 932 :size "L" :product "More longer names to play with"}
{:qty 1 :size "M" :product "Another product name"}]
[{:qty 1242 :size "XS" :product "This is just an obscenely long product name that I am hoping will spill over on to the next lines"}
{:qty 2 :size "M" :product "Testing 1 2 3"}
{:qty 1 :size "S" :product "Hello there world"}
{:qty 12 :size "XS" :product "Some really long product name just to test"}
{:qty 932 :size "L" :product "More longer names to play with"}
{:qty 1 :size "M" :product "Another product name"}
{:qty 1242 :size "XS" :product "This is just an obscenely long product name that I am hoping will spill over on to the next lines"}]]
产品名称的最大行长为 25 个字符
提前致谢!