First language

Python or Ruby as first programming language? And why?

Python has more libraries and learning resources, but I read that Ruby is more elegant and functional programming is better in Ruby.

Other urls found in this thread:

poignant.guide/
schemers.org/Documents/#all-texts
randomhacks.net/2005/12/03/why-ruby-is-an-acceptable-lisp/
indeed.com/q-ruby-jobs.html
amazon.com/Everyday-Scripting-Ruby-Teams-Testers/dp/0977616614
amazon.com/Wicked-Cool-Ruby-Scripts-Difficult/dp/1593271824/
tutorialspoint.com/c_standard_library/c_function_puts.htm
twitter.com/NSFWRedditVideo

LISP

Thank me later.

Neither, C++. Your welcome.

OCaml my man

I prefer Ruby, but as a first language, I'd recommend C, it was my first language and it served as an awesome bridge from pseudo-code, I didn't dive to deep into it, but it's a very good first lesson, and it will make you appreciate the syntax-sugar higher-level languages will provide, while still understanding what the syntax-sugar is actually hiding.

Fortran.

Functional programming is even better in Haskell and Scala is probably running far more "production" functional programming things.

But you may hold off on that and just kinda start modestly with learning the mathematical operators and other syntax that is in one or another way shared really in basically any typically used imperative/procedural/functional language.

You will get to some or more FP eventually anyhow.

z80 assembly thank me later

You're trolling of course, but isn't MIPS assembly actually fairly common as a teaching language? Not a first language, obviously, but still.

>Python or Ruby as first programming language?

you have a choice between:

reading one book and then having a full in depth understanding of how the entire language works and how all the language features interpolate

or you can read a couple books, and then some best practices books, and then some cookbooks and you still wont have a complete understanding of how to best use the language features and you will always be googling and checking stack overflow for finding a way to do something that will fit the way the language works because the language has no consistency in how it was designed

you guess which language I am referring to in each paragraph

MIPS and ARM assembly aren't bad at all. I suggested z80 because it is almost as annoying as x86 assembly but with no documentation.

>reading one book and then having a full in depth understanding of how the entire language ...

poignant.guide/

asshole

and no Im not going to make the correction, if anyone is serious about Ruby theyll find out which book it is

OP here.
I can not guess which language you refer to in each paragraph. Could you explain me, please?

Learn Lisp.

No, Ive wasted too much of my time explaining why languages are good on Sup Forums only to get drowned out by a lot of bullshit memes. The fact that everyone on Sup Forums accepts the low quality discussion in programming language threads makes everyone here guilty by association. You want to find a good programming language you have to work for it. If people here had respect for good languages I might hand out free advice.

(join-thread this)

...

Instead you're spending time writing a novel about why you won't say "good: ruby. bad: python"

Honestly, I thought it was the other way around.

I imagine Ruby is the language that would require one book to read. The syntax is nice.

I use Python mostly. It was the first language I picked up. I like using it but I do appreciate features of other languages, namely static typing.

Do some more research. Find out what you actually want to use the language for and see which is best for the job given libraries and your general opinion on the syntax.

Between this two, I think Python is better for starters.

>>Python or Ruby as first programming language?
>you have a choice between:
>reading one book and then having a full in depth understanding of how the entire language works and how all the language features interpolate
>or you can read a couple books, and then some best practices books, and then some cookbooks and you still wont have a complete understanding of how to best use the language features and you will always be googling and checking stack overflow for finding a way to do something that will fit the way the language works because the language has no consistency in how it was designed
>you guess which language I am referring to in each paragraph
>No, Ive wasted too much of my time explaining why languages are good on Sup Forums only to get drowned out by a lot of bullshit memes. The fact that everyone on Sup Forums accepts the low quality discussion in programming language threads makes everyone here guilty by association. You want to find a good programming language you have to work for it. If people here had respect for good languages I might hand out free advice.

actual autism

wouldn't expect less from a rubyist though

Gentoo

python has niches in scientific computing, webdev, and scripting

ruby is used for literally nothing in the current year

Ruby is for posers and hipsters.
Python is popular in academia and is often taught as a fist language in college. So that or java. But if you don't learn C/C++ soon after, you will never ever understand pointers which will severely limit your career options.

fpbp

In Scheme dialect.
schemers.org/Documents/#all-texts

Kind of interested by OCaml. What's it used for?

Finance.

Ruby is a superior language in every way except libraries. That's the only thing Python has going for it.

Learn neither of them as a first language because they're both hugely idiosyncratic and you'll have to relearn everything when you move to a more useful language.

This
The z80 chipset is the most widely used chips of all time and can be found in all sorts of things from microwaves to ti calculators.
And if you're one of the brave ones there is a book called z80 computer from scratch which will allow you to make your own 100% free(in the gnu usage of the word) computer of your dreams!

Depends on what you want to do. Python is good for bioinformatics for example.

This.

Learn any LISP dialect.
It'll seem awful at first but you'll be better for it.

I think for a first language it should be one that is strongly typed and that makes you aware of memory management. Doesn't have to be C-tier memory management, but the underlying reality of memory management should not be concealed.

This. Only to appreciate the benefits of an interpreted language and understand the trade offs

z80 and 68k assembly is pretty neat
I also like ARM

it'x x86 that's the clusterfuck

this has macfag written all over it

Both have a similar syntax on the surface, but the philosophy is different. Python is more like Pascal or JavaScript, with a huge emphasis on functions being first class citizens.
Ruby has elements form many different languages like C, LISP, Smalltalk, Perl, JavaScript and Haskell.

Both are nice, but for a beginner I'd say learn Ruby.
Python has more quirks and it's easier to make mistakes for beginners (differernt string encodings, forced whitespace indention, and sometimes functions are getting called at the object, but sometimes you put the object in the function..).

Ruby is super consistent. Like someone said: You can read one book about Ruby and one book about Rails and you'll be employable.

I recommend "The Well-Grounded Rubyist" (2nd edition) by David Black.

And for Rails "Rails 4 in Action". The current version is Rails 5, but the code from the book will work.

One word of advice:
I recommend to learn C, Java and JavaScript afterwards. And THEN come back and take another look at Ruby. Onyl then you will realize that you used DSLs and Lambdas the whole time without noticing..


>randomhacks.net/2005/12/03/why-ruby-is-an-acceptable-lisp/


>ruby is used for literally nothing in the current year

Well, I've heard about this (largely unknown) framework called "Ruby on Rails", which happens to run sites like GitHub, AirBnB, Groupon.

Also it's still pretty much in demand..
>indeed.com/q-ruby-jobs.html

It's also used for Penetration testing (Metasploit), DevOps and SysAdmins (Chef Puppet), it's pretty good for testers (thanks to great tools like RSpec or Capybara).
Last but not least: it's a great scripting language for everyday usage..

>amazon.com/Everyday-Scripting-Ruby-Teams-Testers/dp/0977616614
>amazon.com/Wicked-Cool-Ruby-Scripts-Difficult/dp/1593271824/

So if you want to grab some web content, extract some information and put it in some Files Ruby is great here.

First Python, then after switching you can value the supremacy of Ruby.
Don't get meme'd by

>Onyl then you will realize that you used DSLs and Lambdas the whole time without noticing..
I've written in C, Java, and (some) JavaScript, and a shitload of Ruby.
I still don't know how to identify a DSL or Lambda expression.

>Against the odds, Yukihiro Matsumoto created Ruby on February 24, 1993. For the past ten years, he has steadily brought Ruby to a global audience. It’s triumphant and noble and all that. Support diversity. Help us tilt the earth just a bit.
>Support diversity
dropped

pascal is the best first language.

This, to be honest.

>Ruby is more elegant
I don't understand. Ruby reads like fucking shit and just proves that Japanese people suck at programming languages.

>Ruby reads like shit
How? It's super simple and consistent.

This, exactly what I was going to say. Ruby is awesome but you should understand what is happening behind all that simplicity. Learn Python so you can learn proper programming, then learn Ruby so you can be free and productive, while hopefully knowing how to write good code.

Not compared to Python. It has all of these retarded ideas, like having pipe characters fucking everywhere. There's two functions for printing with the difference that other one adds a newline and is called "puts", short for "put string".

Then there's parenthesis. Either include them or not. Consistent? Definitely not. Even Ruby style guides encourage mixing both cases, where functions with no arguments should omit parenthesis to further confuse what the code is doing.

>Learn Python so you can learn proper programming
That is the exact opposite of proper programming

Sorry you're right the only true and proper programming is ASM.

Uhm.. OK.

There is a lambda hidden somewhere:
a = (1..3).map { |i| i*i }


And here we use the domain specific langauge of RSpec:

describe Hash do
before do
@hash = { hello: 'world', user: 'is great' }
end

it "should return a blank instance" do
Hash.new.should == {}
end

it "finds the value to a given key" do
@hash[:hello].should == 'world'
end
end

>>Pascal
Pascal is trash for anything but pseudocode
>>Ruby or Python
Faggot skiddie languages for pussies
>>C
Honestly a good first choice if you are willing to pick at some asm and can handle the initial pains of learning starting from C. You can also move onto C++ nicely from C but I would recommend learning the C way first.
>>Java
Just learn C++ instead, Java just looks like retarded C++ to me though I can see why the cross platform aspect of Java might be attractive.
>>Javascript
Might as well cut off your balls too. Learn this later, it's super simple coming from C/C++
>>Fortran
Stop
>>Forth
F U C C M Y B O I P U C C I D A D D Y
>>OCaml/Haskell/Clojure
You misspelled "Lisp for retards"
>>Lisp
Learn it, it goes nicely with C as something for learning. Know Lisp + C and a lot of other languages are pretty simple to pick up in comparison.
>>Bash/tcsh/fish/zsh/batch scripting
Nigger python/ruby these are pretty useful though..
>>C#
Java and C++'s incestuous autist baby.
>>tcl/lua
Figure these out if you need them as you need them
>>Scheme
I'd rather just use Lisp

There are people that prefer Python's syntax, but I've never met someone who didn't understood Ruby.

> like having pipe characters fucking everywhere

No, only at one single point: as marker for the temporary variables in a block/lambda.

>Then there's parenthesis. Either include them or not.

I don't even know what you are saying.

If you make a function..

def foo(x)
puts "hello #{x}, how are you?"
end


..you can either use the parentheses or not:
foo("user")
foo "user"


It's your choice.


But Ruby is consistent when it comes to how you do things.

Compare:

Python
len("; ".join("1,2,3".split(",")))


Ruby
"1,2,3"
.split(",")
.join("; ")
.length


Which is more readable and consistent in it's syntax?

It's not our fault you are too fucking dense to be able to spot simple fucking things.

>Don't get meme'd by
explain how it is a meme

You must have forgot, you are on:

Sup ForumsEVERYTHING_I_DONT_LIKE_IS_A_MEME

Whoa, almost every sentence is wrong here..

Well I'd like to hear why that person doesnt like lisp or thinks its a "meme" to learn as first language

Either start at the bottom with C and some assembly tossed in, or do Python. Ruby is similar, but Python is much more widely used and versatile.

>>>Scheme
>I'd rather just use Lisp
lisp is a dialect
you're a retard who has read a few things but has no experience
based on your other answers you have no idea what you're talking about, really

I would recommend learning basic programming with python, loops, conditionals, functions and whatever. Stop before you reach OOP, and then learn C.

How is Python more versatile than Ruby?

It has more users in infosec or academia, but that's about it. There's nothing in Python you can't do in Ruby - and vice versa.

Python is very idiosyncratic and does not teach you good programming practices outside of writing more Python.

>"Lisp and C for everything"
KYS

>"I'd rather just use Lisp [than Scheme]"
You know Scheme is a Lisp, right?

>..you can either use the parentheses or not:
Which is inconsistent.

Scheme is a very lispy lisp too :D
this language made me realize why lisp is called lisp

>pipe characters
what?
>There's two functions for printing with the difference that other one adds a newline and is called "puts", short for "put string".
tutorialspoint.com/c_standard_library/c_function_puts.htm
Even C has those two.

>Then there's parenthesis. Either include them or not. Consistent? Definitely not. Even Ruby style guides encourage mixing both cases, where functions with no arguments should omit parenthesis to further confuse what the code is doing.
>ugh you say parenthesis can be optional, and semicolons too? And whitespace is not enforced? How blasphemy!!

It's really hard to talk to a fucking trash who only know python or java thank to some intro classes in uni.

>lack of decent programming introductional material
>shit tier implementations only, apart from CL that is almost used nowhere
>unusable to learn/teach basic hardware and software engineering aspects
>quite a lot of shit tier dialects - CL, the only one of which a certain subset is ok is the least used
>no guidelines, no useful conventions and no notion that software can be developed in teams, and as result the most known lisp programs are gayms by autistic manchildren and hacked together webscripts by fraudster one-trick ponies that got replace at the first chance.
>the compiler does almost know nothing about the language

this

Semicolons don't add any value to properly formatted code.

a = b

Is b a function or a variable in Ruby?

There is a differernce between using syntactic sugar and consistent syntax.

a(b(c.d)).e

..is what I call inconsistent syntax.

a.b.c.d.e
a().b().c().d().e()


..is consistent, but allows you to use syntactic sugar.


I don't even want to bash Python. Generally python has the approach to wrap most things in a function, similar to JavaScript. It's not a bad approach, it's just a little more incosistent, since they weren't that consequent with their syntax, that's all.

doesn't matter

you will appreciate the missing parenthesis when refactoring your code, or using memoization technique:

e.g.
def b
@b ||= do_some_time_consuming_stuff
end

#somewhere else
a = b

Very useful when use inside a class.

>a = b
>Is b a function or a variable in Ruby?
who knows?
not that it matters

It doesn't really matter.

In Ruby everything is an object.
So if we want to know we can just ask what is is - or what it does:

42.is_a? Numeric # true
42.is_a? Method # false

42.respond_to? :length # false
Time.now.respond_to? :length # false
Time.now.to_s.respond_to? :length # true

Cool thanks for explaining

anytime, user

Between those two, Python. Of all languages to start on, C. It will teach you about memory allocation, pointers and forking.

str.join(seq) makes more sense to me than seq.join(str).
In Ruby, isn't it tedious to have to implement your own join method for every sequence type you create?

Similiarly, I get why people complain about len(object) calling object.__len__(), but don't you think it makes sense to keep the object's namespace as free as possible? Consider how ugly it would be if all the magic methods (__bool__, __str__, __hash__, __iter__ etc) had to be called directly, underscores or not.

Python

len("; ".join("1,2,3".split(",")))


Ruby

"1,2,3"
.split(",")
.join("; ")
.length
ruby too better than python fuck elegance this easy and do the work

>In Ruby, isn't it tedious to have to implement your own join method for every sequence type you create?
No, that's what modules are for, for the unlikely case you'd do this for anything else than arrays.
Apart from that who cares, it's not like you'd do that more than two times in life.

>Consider how ugly it would be if all the magic methods (__bool__, __str__, __hash__, __iter__ etc) had to be called directly, underscores or not.
>operators are special stuff, not simple overwritable functions
>length is an operator
That was the mistake in the first place.

math should be your first programming lang

You don't compare

You do right away

Go find a project or an idea to work with the language.

Eg. Youtube to Mp3 converter

>Eg. Youtube to Mp3 converter
this is stupid.

I can't believe this thing I wrote on one line is not as simple to read as this thing split into four lines!

>I have IQ of 50.

>length is an operator
What?

Is that a quote from your doctor?

Nah, I think you don't get how Ruby works.
In Ruby, every object takes care of itself..

I don't want to throw my object in a function, because the functions are parts of objects - not the other way arround. So I say: "dear list, please join yourself with this parameter here!"

It's up to the object to decide what it does.

Here, this is some advanced Ruby:

class PI_DIGITS

def as_array(accuracy)
accuracy.times.inject([]) do |a, i|
a

G-guys, I never see C# on this board. Is there something wrong with it?

this. learn ruby first. thank me later

still better than python, which isn't even backwards compatible

It's not a good idea to force backwards compatibility when it doesn't make sense.

ITT :, programming autists who hate on python as a skid language

Protip autists, some of us use programming to automate menial and trivial tasks at work, not to become linus or terry.

Fucking chill out.

Get the job done, move on.

>I'm just a piece of shit but you have to respect me.
You are so worthless that your mom even forgot about your existence.

Who are you quoting?

Perl

Because it's interpreted and those are compiled.

I hope you're kidding

Ruby and Python are both interpreted.

Russian

What book i am genuinely interested, i really want a break from java and c++

Either dude. But I'd go python since muh libraries.

C# is fine.

The only problem is that it's much better for the windows environment, whereas Java has an edge on multi-plattform (inb4 xamarin meme).

See: