alexeld
2017-1-28 09:51:43

Hey folks. A quick question about Pattern Matching (I’m rather new to it). Say I wish to match a list which contains some-pattern, where that pattern could be anywhere in the list (beginning, middle, end), how would I describe that? For example, say I always wish to find the pattern c repeated three times:

( a b c c c d) (c c c) (a b d c c c)


alexeld
2017-1-28 09:53:17

I’ve tried using the __k-style patterns, but they seem good if you know how many elements appear before or after your given pattern. Also, list-no-order doesn’t seem to help, and I don’t think list-rest will be of much use, either (from the docs).


leafac
2017-1-28 11:24:05

How about the following pattern?

`(,_ ... c c c ,_ ...)

githree
2017-1-28 14:25:04

Hi @leafac I tried to test your pollen-component package but it fails with the following message: DrRacket install: cannot use empty checksum for Git repostory package source source: <https://git.leafac.com/pollen-component.git>


leafac
2017-1-28 14:35:04

@githree: First, thanks for the interest :slightly_smiling_face: Second, we’re trying to figure this out: https://github.com/tonyg/racket-pkg-website/issues/36 Third, for the moment:

$ git clone <https://git.leafac.com/pollen-component>
$ cd pollen-component
$ raco pkg install

leafac
2017-1-28 14:37:21

Installation will fail if you don’t have LaTeX and ImageMagick installed, because of one figure in the documentation.


leafac
2017-1-28 14:37:47

Can you tell that this is my first time packaging Racket code? :stuck_out_tongue:


leafac
2017-1-28 14:39:10

While I’m still working on these issues with installation, the library code itself is functional. You can see it used in https://www.leafac.com, for which the source is here: https://git.leafac.com/www.leafac.com/tree/source/pollen.rkt


leafac
2017-1-28 14:39:45

Feedback is greatly appreciated!


githree
2017-1-28 14:46:05

Great, thanks for detailed answer! I wonder if it is possible to make a dependency like the one for LaTeX and ImageMagick optional - it seems like a bit of an overkill for just one figure - could there be a backup .png if dependency is not found. This is more general question not only related to your package. Does anyone have any example of how something like this can be achieved?


leafac
2017-1-28 14:48:16

I agree that LaTeX and ImageMagick must be optional. In fact, I included the generated .png in the repository. But raco pkg install acts funny and looks for the image in the root of the repository—as opposed to DrRacket’s Render as HTML, which looks in the documentation folder. I’m working on these issues as we speak.


leafac
2017-1-28 14:49:42

For the moment, if you want to read the documentation and you don’t have LaTeX and ImageMagick, open documentation/pollen-component.scrbl in DrRacket and render it :slightly_smiling_face:


leafac
2017-1-28 14:50:17

The library is fully documented. It’s just a packaging issue at the moment.


githree
2017-1-28 14:51:49

Looking forward to playing with components, I like the idea behind it, so good luck!


leafac
2017-1-28 14:52:35

Thanks for the kind words. In a couple of weeks this should be ready for consumption. I’ll announce it on the mailing list.