Click here to Skip to main content
13,000,469 members (57,793 online)
Rate this:
Please Sign up or sign in to vote.
See more: (untagged)
i wanna make calculator using prologe any help guys please any tutorials ?
Posted 27-Apr-12 8:56am
wizardzz 27-Apr-12 15:26pm
You should pose a question when you get stuck on something specific, until then, well and even then, your friend is Google.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Googling "prolog calculator tutorial" got me this little gem: Prolog Calculator!


SAKryukov 27-Apr-12 15:38pm
Wow! during the time I spend of explaining why all that makes no sense, you got a sample you call a little gem!
My 5, but nevertheless, in terms of general approach, I'm still holding my views: Prolog is no good for calculators, and a calculator is a poor way to learn Prolog -- please see.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I don't think you can find any good tutorial on this combination of topics, because I fail to imagine a reasonable knowledgeable person who would take this pointless task. Likewise, I would not advise you to waste your time on it.

If you want a good "regular" (numeric) calculator, Prolog would make little to no sense. This is a logic programming language, strongly declarative, with notoriously weak imperative semantics. Please see:[^],[^],[^],[^],[^].

Even if you use Prolog implementation with enforced (I would say, "artificially enforced") imperative feature, notably Object-Oriented Visual Prolog, formerly Borland Turbo Prolog, it would not match with several much more suitable languages. Please see:[^],[^].

Generally, making a traditionally-looking calculator with buttons is a popular but very poor model for learning programming. Who need them? Anyone can easily make a decent expression-oriented calculator with any non-trivial scripting/interpretive language, because they have expression evaluators, which just few lines of code. For example, take a look at my JavaScript calculator:[^].

Such calculators are possible just because the imperative interpretive languages can parse/evaluate strings containing expressions in the same language, like JavaScript Eval. Please see:[^],[^].

From the other hand, if I assume that you want to make a calculator to learn Prolog, I would advise to find a better goal. Such task would defeat the purpose of this language. In addition to having extra hassles, you would risk to go around essence of the logical programming and the essential features of the language.

And finally, I can assume that you are already knowledgeable in Prolog and want to polish your skills to make yourself a universal Prolog developer capable of solving nearly any problem. In this case, creation of the calculator could be justified, marginally, but in this case I would not advise to look for a tutorial. For such a developer, the regular detailed language reference could serve the best.

Manfred R. Bihy 27-Apr-12 15:49pm
Well argumented, SA! 5+
SAKryukov 27-Apr-12 15:51pm
I tried hard. :-)
Thank you, Manfred.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170624.1 | Last Updated 27 Apr 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100