"I was already pretty dead set on learning a functional language (either Python or Ruby)" Did I see something strange here?
Reworder – A tale of learning Python and launching an app in five days.
31–37 of 37 posts
Re: Reworder – A tale of learning Python and launching an app in five days.
#32Earlier 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
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.
#33Re: Reworder – A tale of learning Python and launching an app in five days.
#34Earlier 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…
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.
#35Earlier 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…
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.
#36Re: Reworder – A tale of learning Python and launching an app in five days.
#37Earlier 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?
filetype plugin on
in your .vimrc.