[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math


View post   

File: 9 KB, 680x190, prolog_logo_splash.gif [View same] [iqdb] [saucenao] [google]
2566638 No.2566638 [Reply] [Original]

Hey /sci/, I have a quick question for all you programmers out there.

I'm fascinated by theoretical logic so I want to start learning Prolog as my first programming language. Is this a good idea?

>> No.2566715

Selfbump for narcicism

>> No.2566725

Never even fucking heard of it.

>> No.2566780

>>2566725
It's good for AI and such. What PlL's do you know?

>> No.2566791

*PL

>> No.2566822

I don't know prologue but I'd start with something a little dumber just to get your feet wet. Java is in vogue now as the beginners language.

However, (almost) all languages can do the basic read/print business you need to know, so really anywhere is fine. I say go for it OP, but if you fail, retreat onto Java or something where googling for examples will yield plentiful fruit.

>> No.2566827

>>2566822
Thanks, appreciate the advice

>> No.2566846

>I'm fascinated by theoretical logic
Ok, whatever. I find it rather boring.

>so I want to start learning Prolog as my first programming language
What? No. That's not a good idea at all.
Prolog is more about recursion than it is about logic. The "logic" part works like in a relational database, it's not really that much logic involved, to be honest.
It has this interpreter that mechanically reads and applies rules in a certain order. (You'll need to learn about this anyway if you want to start coding in prolog.)

Nevertheless, learn prolog anyway. It's a fun language.
(Like Lisp, C and Perl, I can recommend these too.)

>> No.2566862

> I'm fascinated by theoretical logic so I want to start learning Prolog as my first programming language. Is this a good idea?

No, it is a fucking terrible idea. It is the opposite of a general purpose programming language, and you will end up learning everything ass-backwards. Prolog should not be attempted unless you are a sadist or already have a familiarity with conventional programming languages, either procedural or object oriented.

Start with Java, move to C, then do some prolog. Prolog made my A.I. course a nightmare.

>> No.2566867

>>2566846
Noted, thanks.

>> No.2566869

>>2566822
DO NOT start with Java, I repeat: DO NOT start with Java.
It's a horrible language and the only reason for using it is you're forced too because of your employer/university/whatever

>Java is like Alzheimers: it starts slow and then it takes away all your memory.

>> No.2566888

>>2566869
Nigga you just went full retard. That's like saying "Don't learn english, you only need it because everyone else uses it!" Java is the first course everybody teaches at uni because it's so easy to learn. It's a shit language but it's a shit language that runs on every platform known to man and in which many projects you as a coder will likely be attached to will be running on.

>> No.2566891

>>2566869

Just out of curiosity, what language would you tell him to start with?

I personally started programming in JustBASIC (Yeah, troll me) and now everyone tells me I'm fucked in the head for life.

>> No.2566907

>>2566891
Ignore the idiot, Java is a fine first language. If you're confident enough you can start in C or C++ but those languages are more complicated. Java is chosen as a beginner's language for two reasons - it's less confusing to a newcomer, and it's object oriented.

>> No.2566916

>>2566862
Why exactly? Too complicated shiity language?

>> No.2566935

>>2566888
>it's a shit language that runs on every platform known to man
That's a bullshit argument. Every platform that has a Java virtual machine will also have an ANSI C compiler.
>your argument is invalid.

>>2566891
C is as good a place as any other to start.
If you can write in C you will be able to migrate to any curly-braces-language in no time.
Inbefore braindamaged 12 year olds claim you can't program object orientated in C.

>> No.2566954

>>2566916
Because it is extremely limited with what you can achieve with it. You can't, say, write a program to draw shit to the screen in Prolog. You can't write a physics engine in Prolog. It's a niche programming language, designed around using predicate logic.

I mean technically it is turing complete, but goddamn it is so backwards ass that if you try to do anything you would normally make a programming language do your brain will split apart at the seams trying to work out how. It is VERY specialized.

>> No.2566966
File: 74 KB, 661x716, what_programming_language.png [View same] [iqdb] [saucenao] [google]
2566966

>> No.2566971

As a first language it couldn't be worse.
It's completely unlike any programming language I'd used before (or after) learning it.

>> No.2566983
File: 88 KB, 962x485, whatIgotcomputing.jpg [View same] [iqdb] [saucenao] [google]
2566983

>>2566935
And yet, Java is a popular language that you will nearly certainly need to use in your career. It is also better to start on than C because it isn't as complicated, you don't need to worry about bullshit like Structs and Malloc.

Graduating from Java to C makes sense. But continue, I'm sure you know way more about this than all of the computing professors at all of the worlds universities that teach Java first for this exact reason.

>> No.2567000

>>2566954

Hmm... What language should I use if I want to work with AI then ?

>> No.2567021

>>2566966
Hahahahahaha it's funny because it's true

>> No.2567033

>>2567000
Same as everyone else, Java/C. Unless you're just doing this for a hobby, you will almost never get a chance to use Prolog in the real world. It's nice to know because it's so different (some people find it interesting), but don't bet on actually needing it.

Most narrow A.I. we see in use today (Google etc) is not coded in Prolog.

>> No.2567034

>>2566638
Ignoring everyone ITT because they have no clue wtf they're talking about, yeah, start with Prolog. It's interface is actually very beginner-friendly (as you don't even need those input/pitpüut-bullshit someone mentioned). And if you're interested in logic, learning Prolog is obviously your way to go. You will learn a lot about how to automate the evaluation of logical statements, as Prolog has a lot of tricks going for that. Be prepared Prolog tends to be a bit dirty for someone coming from pure logic. Nonetheless, it's much closer to the ideal than almost any other language (aside from LISP, which is hands down the best programming language atm for just about everything involving actually computing stuff and not just glueing predefined components together).

>> No.2567035

I don't know it, but it has a niche popularity in logic and AI. Just don't expect it to have broad general purpose use, or wide popularity. I don't see any reason not to start with it if it interests you.

>> No.2567050

>>2566983
>I'm sure you know way more about this than all of the computing professors at all of the worlds universities that teach Java first for this exact reason.
>implying that's the reason Java is taught at universities.
>implying it's not some OOP bullshit fad.
>implying it's not influenced on some level by monetary reasons.
>implying you aren't sucking Sun's throbbing uncircumcised member.
Please tell me why one should use Java instead of C as a first language.

And don't fucking give me "it's easier hurr", because that's a big load.

Basic algorithms are written in C just like they are in Java. Object orientated abstraction doesn't come into play after you've mastered the first few basics, at which point the slight syntatic overhead in C won't be a problem at all. (Seriously, are you Americans really this retarded that you can't even malloc() and free() some struct you've designed yourself? No wonder you're being outsourced by smelly Indians.)

One argument that *might* count would be that C isn't typesafe at all (everything's an integer, heh), but you won't learn good programming habits by having a syntactical corsett forced on you. (Some goes for object oriented abstraction. Having to write a class for "hello world" is motherfucking ridiculous.)

>> No.2567068

>>2567050
>implying
>implying
>implying
>implying
>implying
>implying
>implying
>implying
please kill yourself

>> No.2567079

>>2567034
thank you

>> No.2567083

>>2567050
>OOP
>A fad
I've been in the software development industry for 20 years. Oddly, this "fad" has dominated the industry for that entire time. Any language that is not OO, is a bad first language.

>> No.2567092

>>2567068
>implying that's an argument.
Wow, I didn't expect you to concede so readily.

Enjoy your "public static void main", retard.

>> No.2567103

>>2567034
I honestly can't tell whether you're trolling or you're really a lisper.
*sigh* I guess that just goes to show how ignorant and obnoxious the average lisper is.

>> No.2567106

>>2567050
>Please tell me why one should use Java instead of C as a first language.

Pretty exceptions.

Write in the sixth position of an array of 5?
Java: IndexOutOfRange exception on line x, file y.
C: LOL I SEGFAULT U

Read an uninitialized reference or a null reference?
Java: Won't compile, your variable has not been initialized. Or throw a NullPointerException on line x on file y.
C: Your boolean value is -0x44ffff22 and your int is LOL I SEGFAULT U

>> No.2567113

>>2567092
Not the person you were arguing with, moron.
Ffs, there are more than two people on the internet.

>> No.2567115

>>2567103
yeah right.

>> No.2567127
File: 20 KB, 475x475, 1288350712322.jpg [View same] [iqdb] [saucenao] [google]
2567127

>>2567050
> implying I'm American
> implying that C isn't significantly harder than Java
> implying that managing memory isn't difficult to new programmers

>> No.2567133

>>2567083
I didn't say OO is bad, I just don't like the way Java forces it upon you and all the children who are full of shit and think you can't write object orientated in C.
(Yes, not *everything* is possible. But talking about C as if it didn't give you the means for some SERIOUS abstraction and equating it with assembly or some bullshit is just retarded.)

>> No.2567146

>>2567106
Haha oh man, every time people would get a Seg Fault in our Algorithms class they would tear their hair out in frustration because the C compiler is a fucking useless piece of shit that doesn't tell you where your mistake is.

>> No.2567168

>>2567146
It's not the compiler's job to tell you that your code will segfault.
Segfaults are a runtime thing, like logic errors. Duh.

>> No.2567179

>>2567146
>the C compiler
There's more than 1, you know...
Also, a segfault is a runtime, not compile time. Cursing the compiler is kind of stupid and shows a serious lack of understanding the most basic concepts of how things work in a modern computer/operating system.

>> No.2567185

>>2567133
To be correct, neither Java nor C fully support OOP.

>> No.2567202

>>2567146
You have no fucking idea what a compiler is, do you?

>> No.2567226

>>2567133
I think many CS programs start with Java BECAUSE it forces it on you. (and it simplifies away some things like memory management) As such, it's an easy way to learn OOP, and it's easier to learn OOP if it's the first kind of programming you learn. Then if you want to use straight C for other things later, it's easy to learn that too.

>> No.2567230

Not OP, but is Python a good starting point for learning a programming language. And if so, does anyone know any good books/tutorials for it?

(Also, is Python 2 preferable to Python 3?)

>> No.2567288

>>2567106
Back in my day, if you write to the sixth position of an array of 5 in C, it would overwrite your stack pointer, and the computer would start executing data, and the screen would fill up with garbage and probably reboot. Programming is so easy now, even retards can do it.

>> No.2567301

>>2567106
It's generally true that you have better error recovery in interpreted languages.

>> No.2567315

>>2567230
Python is a fine starting language. It's very cool and flexible and popular. But it will never be fast, and you won't learn anything about how the computer works underneath. Python in a Nutshell is a good book.

>> No.2567331

>>2567106
You could EASILY make an array class which does bounds checking and throws exceptions in C++. But that would come at a slight sacrifice in performance.

You see, you're complaining about a meaningless design tradeoff; you didn't actually reveal any flaw in the language itself.

>> No.2567337

>>2567301
Java isn't interpreted. It's compiled. It has better error recovery because It's managed. (It's compiled to bytecode rather than machine code, and the virtual machine manages memory access)

>> No.2567353
File: 72 KB, 469x428, trollface.jpg [View same] [iqdb] [saucenao] [google]
2567353

>>2567301

>> No.2567363

>>2567353
I thought exactly the same thing :)

>> No.2567368

>>2567337
>implying other interpreted languages aren't compiled into bytecode, like for example Python, Prolog, Ruby, Perl and TCL
>implying a "virtual machine" isn't just a trendy euphemism for "interpreter"

>> No.2567371

sup guys, i want to do sum logic programming

>Java
>C
>C
>Java
>C C C
>Java

>> No.2567383

>>2567331
> You could EASILY make an array class which does bounds checking and throws exceptions in C++
I'm sure that would make a nice beginner topic for somebody that's just learning to program. Or maybe not.

> you didn't actually reveal any flaw in the language itself.

We're not discussing flaws in the languages themselves. We're discussing which one is easier for a beginner to learn.

>> No.2567393

>>2567106
>Read an uninitialized reference or a null reference?
Every compiler that isn't a complete piece of shit will have options to make him choke on obvious errors like that.

On the other hand, detecting wheter or not some variable is initialized or not *in general* during compilation is equivalent to the halting problem.