Live data from Hacker News

Reworder – A tale of learning Python and launching an app in five days.

sahillavingia.com

31–37 of 37 posts

Re: Reworder – A tale of learning Python and launching an app in five days.

#32

Earlier quoted context omitted.

Could not agree more!!!! If you're a vimmy, be sure to add this friendly helper into your .vimrc :set tabstop=4 :set shiftwidth=4 :set expandtab

Or, if you only want to use these settings for python files, create a ~/.vim/ftplugin/python.vim file. Mine looks like this: setlocal tabstop=4 setlocal softtabstop=4 setlocal shiftwidth=4 setlocal textwidth=80 setlocal smarttab setlocal expandtab setlocal smartindent

Today I learned...

Thanks.

It looks like ftplugin is a native vim extension - is that correct?

Re: Reworder – A tale of learning Python and launching an app in five days.

#33

"I was already pretty dead set on learning a functional language (either Python or Ruby)" Did I see something strange here?

He meant javscript. A common typo.

Eh? How is Javascript any more functional than Python or Ruby?

Re: Reworder – A tale of learning Python and launching an app in five days.

#34
post #29

Earlier quoted context omitted.

Python and Ruby aren't functional languages. You can write code in them in a functional manner, but for anything more than toy programs you _likely_ wouldn't. They're heavily Object-Oriented, but could probably safely be called multi-paradigm. Not just "functional", though. Functional languages are Haskell, ML, others, where you express computation by composing functions (in the mathematical sense). You make lots of…

I remember it took me a dozen times of carefully reading explanations like this before I finally got what "functional" meant... I'll try to provide an explanation my former self would have easily got. lambda x: x+1 If you only program with lambda's like these, your program is functional. def dosomething(x): y = x + 3 # y is a global variable return x + 1 As soon as you have a function like this, your program is no lo…

Even more simply - are you writing code for a von Neumann architecture (http://en.wikipedia.org/wiki/Von_Neumann_architecture ), or something more abstract?

To my understanding the issue is not whether "state" has side effects (e.g. your global vs. local example), but rather whether there is any concept of "state" (e.g. shuffling stuff from one memory slot to another).

My experience is from Prolog, where the statement "X is X + 1" results in an error, because once unified, the variable X cannot be modified - X is not a memory slot. Once you try to let go of the idea of a machine with memory slots, alternative-paradigm programming gets a little bit easier. Of course in practice state is often needed, so it often gets added through some mechanism.

Re: Reworder – A tale of learning Python and launching an app in five days.

#35
post #34
post #29

Earlier quoted context omitted.

I remember it took me a dozen times of carefully reading explanations like this before I finally got what "functional" meant... I'll try to provide an explanation my former self would have easily got. lambda x: x+1 If you only program with lambda's like these, your program is functional. def dosomething(x): y = x + 3 # y is a global variable return x + 1 As soon as you have a function like this, your program is no lo…

Even more simply - are you writing code for a von Neumann architecture ( http://en.wikipedia.org/wiki/Von_Neumann_architecture ), or something more abstract? To my understanding the issue is not whether "state" has side effects (e.g. your global vs. local example), but rather whether there is any concept of "state" (e.g. shuffling stuff from one memory slot to another). My experience is from Prolog, where the stateme…

That's a good explanation.

My explanation is catered to people accustomed to the von Neumann architecture, however. :)

Re: Reworder – A tale of learning Python and launching an app in five days.

#37
post #32

Earlier quoted context omitted.

Or, if you only want to use these settings for python files, create a ~/.vim/ftplugin/python.vim file. Mine looks like this: setlocal tabstop=4 setlocal softtabstop=4 setlocal shiftwidth=4 setlocal textwidth=80 setlocal smarttab setlocal expandtab setlocal smartindent

Today I learned... Thanks. It looks like ftplugin is a native vim extension - is that correct?

I'm a bit late in responding, but yes, it's a native vim extension. To make sure your plugins are loaded automatically, put

  filetype plugin on
in your .vimrc.
Post reply on HN