Skip to content

like

Description

@like(x,y)

  • find all matched items in x based on the pattern y
  • x: a string, a list of strings, a symbol, or a list of symbols
  • y: a string pattern

Pattern Conversion

In SQL like,

  • % means zero or more
  • _ means a single character

In PCRE,

  • .* mean zero or more
  • . means a single character

A conversion is required to generate corresponding pattern string. (The heading sign ^ and the last sign $ should be appended.)

Type Rules

High-level

str , (str,sym) -> bool
sym , (str,sym) -> bool
_   , _         -> domain error

Table with details (See type alias)

any

Shape Rules

Shape left rules

Examples

    @like("hello world":str, "*lo":str)
1:bool