Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Why Prolog is cool

Options
  • 16-04-2003 10:41am
    #1
    Registered Users Posts: 1,865 ✭✭✭


    Most people haven't heard of Prolog, it's completly unlike standard programming languages that most people would know. Most languages (C,C++,Java etc etc) are based on telling the computer exactly what to do.
    Prolog is totally different. Instead you tell the computer what things are. You define logical relations. It's hard to explain, the best way is to try it yourself. You can't write 'normal' programmes in it, it's used a lot in Artifical Inteligence stuff. But you can do some pretty funky stuff.

    One great thing about Prolog is that it totally changes the way you think. When you learn a programming language, you learn to think in a certain way. Prolog will get you thinking totally differently, because it works totally differently.

    It's hard to explain this. If you're interested in programming and logical stuff, then I advise getting a Prolog programme and writing your own code and messing around with it. It's very easy to learn, once you get your head around it.


«1

Comments

  • Registered Users Posts: 6,240 ✭✭✭hussey


    Best Joke I've heard all day :)


  • Closed Accounts Posts: 5,564 ✭✭✭Typedef


    to define prolog... we must first define prolog


  • Registered Users Posts: 1,865 ✭✭✭Syth


    It's not a joke. I'm being serious. If you haven't tried Prolog then you can't complain. If you have then why is it a joke? I think it's very cool.


  • Registered Users Posts: 6,240 ✭✭✭hussey


    completly unlike standard programming languages
    Correct .. because it's crap

    Instead you tell the computer what things are
    You still tell it what to do though

    You can't write 'normal' programmes in it
    Exactly

    One great thing about Prolog is that it totally changes the way you think
    Yes Your right .. I used to think there is a spoon, but after Prolog I now think .. There is no spoon

    Reasons why I dont like prolog :
    Things that look correct won't run.
    The odvious way is usually in-efficient

    and example would be this
    f( N, F ) :-
    N1 is N - 1,
    f( N1, F1 ),
    F is N * F1.

    now it would be alot easier to write this :
    F(N) = N * F(N-1)

    If you haven't tried Prolog then you can't complain
    I can and so could the 130 ppl that used it with me

    I think it's very cool.
    Logic and Maths are not kewl .. Full Stop.


  • Closed Accounts Posts: 22 gerald


    PROLOG solves very specific kind of problems. If you like the enlightenment PROLOG gave you, you might want to check Common LISP, which is suitable for both AI and other jobs.

    There are free implementation such as clisp (windows, unix), cmucl(unix)... or commercial demo (lispworks, allegro cl)... to play with.


  • Advertisement
  • Registered Users Posts: 23,212 ✭✭✭✭Tom Dunne


    Originally posted by Syth
    It's not a joke. I'm being serious. If you haven't tried Prolog then you can't complain. If you have then why is it a joke? I think it's very cool.

    I think there are controlled substances being abused here.

    I have tried Prolog and I utterly detested it. Partly due to the incompetent manner in which is was taught, partly due to it's limited scope within the field of Artificial Intelligence.

    I am doing a college project at the moment and part of it utilises AI techniques. I am doing it all in Java. I am staying as far away from Prolog as possible.


  • Closed Accounts Posts: 22 gerald


    completly unlike standard programming languages
    Correct .. because it's crap

    Well, my experience of PROLOG is limited to what I read about it but AFAIK, PROLOG represents a different way of looking at the programming process. It is worth knowing for that reason if you have some time to spare.


  • Moderators, Arts Moderators Posts: 35,403 Mod ✭✭✭✭pickarooney


    Prolog is a hippy's language. That said, I kind of like it.


  • Registered Users Posts: 6,240 ✭✭✭hussey


    EDIT .. as I misquoted someone


  • Closed Accounts Posts: 22 gerald


    Well, my experience of PROLOG is limited to what I read about it but AFAIK

    so your saying you have no experience with it .. but you tell us it's a great language??[

    Can you please quote where I wrote it was a great language? I would appreciate that you do not misquote me in the future.
    I did know it .. Thankfully I forgot it
    I do not think that anybody who made the claim to know PROLOG was ever disappointed by it.
    Now, it has become a common trend to claim you know a language after secretly reading "Learn X in 24 hours" or "Learn Y in 20 days". Studies have shown that to achieve expertise in any domain take 10 years. I concede that you do not need to become an expert in a language to judge it, but I would expect you to have written substantial programs to be able to judge the true value of Prolog.

    I do not know if you have ever written a substantial program in PROLOG, but I am pretty sure I do not want to hear about it after reading your unargumented claims.


  • Advertisement
  • Closed Accounts Posts: 5,564 ✭✭✭Typedef


    Code Monkey say : "To iterate is human, to recurse divine".


  • Registered Users Posts: 6,240 ✭✭✭hussey


    Sorry Gerald .. got you mixed up with other newbie poster

    appoligies


  • Registered Users Posts: 1,328 ✭✭✭Sev


    So delightfully welcoming and receiving people are on this forum.


  • Registered Users Posts: 15,443 ✭✭✭✭bonkey


    Originally posted by hussey
    Logic and Maths are not kewl .. Full Stop.

    Why you working in IT then :)

    Absolutely every aspect of design and coding is based on logic and maths, as are most areas of network design. I guess maybe adminning can survive without logic - at least judging by most admins I've met ;)


    Seriously though....

    Prolog is an interesting language, which is utterly the wrong tool for almost every application.

    When it is used for what it was designed for, its pretty neat.

    Unfortunately, most people who learn it in Uni don't know the theory behind enough of what it was designed for to be able to do anything with it, other than the stuff it doesnt do well. I dont know why they teach it really, because you'd be much better off learning it if and when it was ever going to be useful to you. At that stage, you might have a need which would make it non-crap

    jc


  • Registered Users Posts: 1,865 ✭✭✭Syth


    Prolog isn't great for writing programmes, but the great thing about it is that you see the world in a whole new light after trying to use it. That's why it's cool. You can see the world in a new way, you approach problems in a new, logical way after you understand how prolog works.

    Another advantage is that you don't have to define inverses of functions which I think is pretty cool.

    hussey your example of
    f( N, F ) :-
    N1 is N - 1,
    f( N1, F1 ),
    F is N * F1.


    would allow you to find the Fibonnaci number, but you don't have to write a new method to find the inverse, you use the same method. That's cool.

    Logic and Maths are not kewl .. Full Stop.:mad: :mad: That's not true Maths rocks!!:D :D


  • Registered Users Posts: 2,281 ✭✭✭DeadBankClerk


    words(File, Words) :- see(File), file2list(List), seen, list2words(Words,List,_).
    
    file2list(List) :- get0(Char), file2list(Char,List).
    file2list(-1,[]).
    file2list(Char, [Char|Rest]) :- file2list(Rest).
    
    letter(Char) --> [Char], {lowercase(Char)}.
    letter(Char) --> [Char], {uppercase(Char)}.
    uppercase(Char)   :- Char >= "A", Char =< "Z".
    lowercase(Char)   :- Char >= "a", Char =< "z".
    whitespace(Char)  :- member(Char, " \t\n\r").
    punctuation(Char) :- member(Char, "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~").
    
    word(Word) --> letter(Char), rest_of_word(Rest), {name(Word, [Char|Rest])}.
    rest_of_word([Char|Rest]) --> letter(Char), rest_of_word(Rest).
    rest_of_word([]) --> [].
    
    list2words(WordList)    --> [Char], {whitespace(Char)}, list2words(WordList).  % Chomp the whitespace
    list2words(WordList)    --> [Char], {punctuation(Char)}, list2words(WordList). % Ignore punctuation
    list2words([Word|Tail]) --> word(Word), list2words(Tail).
    list2words([]) --> [].
    

    oh fear my win.


  • Registered Users Posts: 16,413 ✭✭✭✭Trojan


    • How many Prolog programmers does it take to screw in a light bulb?
    • False!


  • Registered Users Posts: 1,865 ✭✭✭Syth


    DeadBankCleark what are you trying to do with that code... A disadvantage of Prolog is that it requires explaination...


  • Registered Users Posts: 6,240 ✭✭✭hussey


    I think a Fibonacci in prolog would be
    fibonacci(0, R) :-
    	R is 0.
    fibonacci(1, R) :-
    	R is 1.
    fibonacci(I, R) :-
    	I1 is (I - 1),
    	I2 is (I - 2),
    	fibonacci(I1, R1),
    	fibonacci(I2, R2),
    	R is (R1 + R2).
    

    My code was N!

    as in Nx(N-1)x(N-2) ..... x 1

    etc

    and what I meant by Logic + Maths is predicate Calculus

    I think prolog might make ya look at languages is a different way .. but not life!!

    Have ya ever tried ML?? .. I really liked that ..


  • Registered Users Posts: 1,865 ✭✭✭Syth


    ML? What's ML?


  • Advertisement
  • Registered Users Posts: 491 ✭✭Silent Bob


    Originally posted by Syth
    DeadBankCleark what are you trying to do with that code... A disadvantage of Prolog is that it requires explaination...

    It opens a file, reads all the characters from the file and converts them into a list of atoms where each atom corresponds to a word from the file, words are separated by any of the characters listed in the whitespace/punctuation predicates :)


  • Registered Users Posts: 927 ✭✭✭decob


    Originally posted by Syth
    ML? What's ML?

    Another functional programming language. I found it easier to use and learn than prolog. Used HASKELL last year, was a bitch at times but that was more to do with what we were doing. but otherwise it was grand


  • Closed Accounts Posts: 9,314 ✭✭✭Talliesin


    Prolog appears to have advantages for applications like Baysian filters, inference engines etc. I am making this judgement purely on the basis that I've seen good applications of that nature that I've been reliably informed were written in Prolog.


  • Closed Accounts Posts: 658 ✭✭✭Trebor


    i have studined prolog, it was difficult to get my head round it but i liked it but did not see many uses for it in everyday use, not that i am saying that there isn't any, just that not in my day to day use of programming :) but it could be very pwerful when used correctly


  • Closed Accounts Posts: 7 issch


    I once wrote a Prolog emulation script in Python.
    I messed with it for about half an hour, got bored and forgot how to use it... I may still have it somewhere but probably not.

    I thought Prolog was interesting, but little more, it's an entirely different approach to programming, but I find it's quicker (and also easier) to just use C++.


  • Registered Users Posts: 332 ✭✭spod


    Using something like tuProlog (http://www.lia.deis.unibo.it/Research/2P/) from within java can prove very useful if you're doing something which could benefit from deductive stuff by using it as an embedded prolog parser from within your applications.


  • Registered Users Posts: 3,135 ✭✭✭oneweb


    It's all logical really. But I never said obvious. Don't like it (what I've eh, done of it)

    If anyone really can't get enuff PROLOG, feel free to PM me

    It is what it's.



  • Registered Users Posts: 4,431 ✭✭✭Gerry


    Perhaps there are some practical applications for prolog. But as far as I know it only actually exists for 2 days before project handup/ exam time in college. Its an awful language. Fair enough, learn it if you will be doing stuff that can only be done in prolog, otherwise stay as far away as possible. People would be better off if colleges spent more time teaching them the very basics of programming better, which might cut down on Tommy 2 scoops posting stuff like "I need a loop which counts up stuff" on this board :)


  • Moderators, Sports Moderators Posts: 8,679 Mod ✭✭✭✭Rew


    We had to do this in prolog recently

    http://www.wit.ie/rlacey/ai/Prolog/PROLOG2003_logic_b.doc

    I hate prolog....

    Fair f*cks to some of my class who put Java and VB front ends on to it. Prolog has potential for backend decision making, but its definalty no for me....


  • Advertisement
  • Registered Users Posts: 2,281 ✭✭✭DeadBankClerk


    your projects are given as .doc?

    horrible :/


Advertisement