Live data from Hacker News

Regex that only matches itself

codegolf.stackexchange.com

31–40 of 66 posts

Re: Regex that only matches itself

#31
post #23

Earlier quoted context omitted.

That isn't a match... I can still see the neat aspect of the post. But that is not a match.

What do you mean?

Regex libraries often distinguish between a string containing a regex, and matching it.

The string "aaaa" is a Regular Expression that describes a language with exactly one string: "aaaa".

Some regular expression libraries have two operations: They can tell you if a string contains a match somewhere within it, or is exactly a match. Some other libraries only do the first operation, and you need to explicitly ask for "^aaaa$" to get an exact match.

This is one of the things on the differences between the formal definition of a Regular Expression, and a regex library.

Re: Regex that only matches itself

#32

Earlier quoted context omitted.

And monads.

My suspicion is that no one wants to explain monads because if they did it would be painfully obvious that they're a purgatorial way of getting around the basic mismatch between functional purity and actual computers.

In Haskell and PureScript, Monad is a typeclass just like any other.

They are an abstraction, effectful computation is not inherent to them, they represent computational contexts, e.g. the list monad is used to model non-determinism, the maybe monad represents computations that can fail, both of these are pure.

This is an excellent set of posts for building an intuition about monads: http://mvanier.livejournal.com/3917.html

Re: Regex that only matches itself

#34
post #2

This is ridiculous. How does one go about deriving something like this? Really impressive.

If you think that's crazy, check out https://www.infoq.com/presentations/miniKanren at the 31:30 mark. These two guys teach their logic programming system a subset of scheme, then they can run it "backwards" to find quines - programs that evaluate to themselves.

Re: Regex that only matches itself

#35

Earlier quoted context omitted.

My suspicion is that no one wants to explain monads because if they did it would be painfully obvious that they're a purgatorial way of getting around the basic mismatch between functional purity and actual computers.

In Haskell and PureScript, Monad is a typeclass just like any other. They are an abstraction, effectful computation is not inherent to them, they represent computational contexts, e.g. the list monad is used to model non-determinism, the maybe monad represents computations that can fail, both of these are pure. This is an excellent set of posts for building an intuition about monads: http://mvanier.livejournal.com/39…

> the list monad is used to model non-determinism

See this is the kind of thing that made learning Haskell so hard for me. I'm not a math guy, I'm terrible at math. I have no idea what "non-determinism" means, and I'd venture to guess that list monad is used to model "ordered collections of things".

Re: Regex that only matches itself

#37
post #3

I wish I was as smart as these people.

Everybody is a Genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid. - Albert Einstein

As a non-fish that can't climb trees I find this even more depressing.

Re: Regex that only matches itself

#38

Earlier quoted context omitted.

In Haskell and PureScript, Monad is a typeclass just like any other. They are an abstraction, effectful computation is not inherent to them, they represent computational contexts, e.g. the list monad is used to model non-determinism, the maybe monad represents computations that can fail, both of these are pure. This is an excellent set of posts for building an intuition about monads: http://mvanier.livejournal.com/39…

> the list monad is used to model non-determinism See this is the kind of thing that made learning Haskell so hard for me. I'm not a math guy, I'm terrible at math. I have no idea what "non-determinism" means, and I'd venture to guess that list monad is used to model "ordered collections of things".

"non-determinism" implies unordered.

Re: Regex that only matches itself

#39

Earlier quoted context omitted.

My suspicion is that no one wants to explain monads because if they did it would be painfully obvious that they're a purgatorial way of getting around the basic mismatch between functional purity and actual computers.

Actually, it's the other way around. Monad tutorials are so frequent that it's become a meme among Haskellers that everyone will eventually write a monad tutorial to relay his own mental model of monads.

And as someone who's read what is probably most of those tutorials - I fulfill the other half of the meme.

"To understand monads, you first need to understand monads."

Re: Regex that only matches itself

#40

Earlier quoted context omitted.

In Haskell and PureScript, Monad is a typeclass just like any other. They are an abstraction, effectful computation is not inherent to them, they represent computational contexts, e.g. the list monad is used to model non-determinism, the maybe monad represents computations that can fail, both of these are pure. This is an excellent set of posts for building an intuition about monads: http://mvanier.livejournal.com/39…

> the list monad is used to model non-determinism See this is the kind of thing that made learning Haskell so hard for me. I'm not a math guy, I'm terrible at math. I have no idea what "non-determinism" means, and I'd venture to guess that list monad is used to model "ordered collections of things".

I'm not a math guy either and I did indeed find it difficult to penetrate the inner sanctum of Haskell for this very reason. I won't say I've completely succeeded in that effort, but I've come quite a long way.

I'm fairly certain that in this context, non-determinism means that there can be more than one answer/result.

Post reply on HN