Comment

Comment by 2143

To the original author:

Under "Parser Generator":

```

   const parseChar = char =>
  input => [
    input[0] === char,
    input.slice(1, input.length)
  ];

   const parseA = parseChar('A');
   const parseA = parseChar('B');

   parseA(testString) // [ true, 'bcd123' ]
   parseB(testString) // [ false, 'Abcd123' ]
```

There seems to be a typo: the 2nd "parseA" should really be a "parseB"?

parent 2143 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton