[squeak-dev] Anybody got an elegent construct for this functional monstrosity?

gettimothy gettimothy at zoho.com
Sat Nov 27 16:30:38 UTC 2021


I have a ReadStream and I want to detect some substrings in it.



This works, but it is ugly.





((self match:'{|') | 

(self match:'|-') |

(self match:'|}') |

(self match:'{{') |

(self match:'}}') |

(self match:'[[') |

(self match:']]') |

(self match:'__') |

(self match:'==') |

(self match:'::') |

(self match:'**') |

(self match:'##') |

(self match:'''') )




Is anybody aware of an elegant approach to this?





Something along the lines of 





self matchAny: { '{|'  . '|-' . '|}' . '{{' . '}}' .  '[[' . ']]' . '__' . '==' . '::' . '**' . '##' . '''' }






thx in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211127/4ff1d129/attachment.html>


More information about the Squeak-dev mailing list