Why prolog is declarative language
I'm adding also a link to the awesome-prolog repository, where a lot more of resources can be found. I personally love working with grammars. I think they are useful and powerful. I have done a lot of personal work with tools like Flex and Bison, so when I discovered that Prolog has native support for them, via what it calls Definite Clause Grammars DCG , I immediately fell for it.
It may not be the perfect option to deal with highly complex semantics, but it sure does it for most common uses in text processing. What is your experience with declarative programming? Do you think it's worth it? Feel free to comment about your favorite languages or recommend learning resources! I always believe imperative programming is prerequisite for declarative programming, I don't think we are there yet.
Of course, as I said, imperative is better for learning for several reasons. I think we'll be teaching C and Javascript to beginners for a long, long time. I have no problem with it :D. Let's Code - Oct Andrew Meredith - Oct Saifullah Usmani - Oct DEV Community is a community of , amazing developers We're a place where coders share, stay up-to-date and grow their careers. We know programming is different than just talking to another person, so why even try to compare them?
Well, what if we could just write a program where we instead describe the rules that we need to abide by instead of explicitly telling our program how to do everything? Prolog is a really awesome language that allows you to do things that many other languages such as C, JavaScript, Python, C , Ruby, etc. Before we talk more about Prolog, we need to go over what makes it so different. Could things be any other way? This is where declarative programming differs from imperative programming. With declarative languages, you just describe what you want your code to do, and not how to do it.
Ever heard of SQL? Think about it. Applications include: Machine learning Robot planning Automated reasoning Problem solving Intelligent database retrieval Natural language understanding Specification language. Synonyms Programming in Logic, Programmation en Logique. Share this Term. Declarative Programming Backtracking Unification.
Tech moves fast! Stay ahead of the curve with Techopedia! Join nearly , subscribers who receive actionable tech insights from Techopedia. Thank you for subscribing to our newsletter! Though the declarative idea is the backbone of prolog, it is possible to see prolog code as procedural.
A prolog programmer will generally do both depending on the part of the code they are reading or writing. When learning prolog, however, experience in procedural programming is in no way useful. Prolog is considered a difficult language to master Template:Whom , especially when the student tries to rush things, mainly because of the different way of thinking the student has to adopt and amount of recursion in prolog programs.
When used correctly, however, prolog can be a very powerful language. Prolog is most useful in the areas related to artificial intelligence research, such as problem solving, path planning or natural language interpretation. Some fields that are not strictly AI, such as parser building, can also benefit greatly from prolog. However, those that do not work with natural language systems daily can also benefit greatly from Prolog.
As Prolog uses certain programming techniques that are considered difficult or advanced most notably recursion , Prolog can be a great way of gaining insight into these techniques.
0コメント