Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why.
No there's not a way to use functors in Prolog that is comparable to their usage in ML? That would be sad.
No functors aren't equivalent in all three mentioned programming languages, ignoring mutability concerns? Well, maybe Haskell enforces some extra constraints, but there's no reason you couldn't conform if you actually needed the mathematical properties that entails.
Peteris's post was about how four different languages have things they call 'functor' that are completely different. He then went on to explain them. None of the things called 'functor' in the post are related except in that they share the same name. 'Functor' is one of these things that, in computing has radically different meanings depending on context.
Back to Prolog though. Prolog has things called 'atom', essentially symbolic identifiers. Prolog allows you to specify the relationship between various atoms, thus the term 'foo(bar, baz)' states that atoms 'bar' and 'baz' have a relationship symbolised by the atom 'foo'. Prolog calls the atom in a term that symbolises the relationship between its arguments the 'functor', though something like 'predicate' would likely have been a less confusing choice.
I am being sponsored by Syntress! They bought me an amazing dedicated server to run catonmat on. If you're looking web services, I highly recommend the Syntress guys!
Education Sponsors
I am being sponsored by A-Writer! If you ever need help with essay writing, look no further than A-Writer! They will help you with your writing in as quickly as 3 hours!
@Will: No.
"Functor" means so many different things i thought it strange to base an article
on the word.
Comment Responses
No what?
No there's not a way to use functors in Prolog that is comparable to their usage in ML? That would be sad.
No functors aren't equivalent in all three mentioned programming languages, ignoring mutability concerns? Well, maybe Haskell enforces some extra constraints, but there's no reason you couldn't conform if you actually needed the mathematical properties that entails.
I think you've misunderstood.
Peteris's post was about how four different languages have things they call 'functor' that are completely different. He then went on to explain them. None of the things called 'functor' in the post are related except in that they share the same name. 'Functor' is one of these things that, in computing has radically different meanings depending on context.
Back to Prolog though. Prolog has things called 'atom', essentially symbolic identifiers. Prolog allows you to specify the relationship between various atoms, thus the term 'foo(bar, baz)' states that atoms 'bar' and 'baz' have a relationship symbolised by the atom 'foo'. Prolog calls the atom in a term that symbolises the relationship between its arguments the 'functor', though something like 'predicate' would likely have been a less confusing choice.
Reply To This Comment