Haskell as a useful practical 'tool' for intelligent non-programmers

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
29 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Haskell as a useful practical 'tool' for intelligent non-programmers

Nicholas Kormanik

I am not a programmer, and have no intention of becoming one. I'm a stock
and options trader. MetaStock is one of the primary programs I use. Other
statistical and mathematical programs as well.

Very often when some small need arises, I Google-search for a solution.
There seems to be any number of freeware utilities out there in cyberland --
and more all the time -- that do pretty much whatever is needed.

Additionally, Mathematica (as one example) has a powerful programming
language built in.

So, my question is: Does it make practical sense to spend time learning
Haskell for the purpose of adding it to my assortment of 'tools' -- to
quickly do this or that, as the need arises?

Is there any better general practical 'tool' (or, if you want, 'programming
language') to add to my arsenal.

Thanks for your comments and suggestions.

Nicholas Kormanik





Reply | Threaded
Open this post in threaded view
|

Haskell as a useful practical 'tool' for intelligent non-programmers

jfredett
It seems to me that what you're looking for is a way to build tools suited
to particular tasks, subject to particular performance constraints. If
you're goal is to be able to build these tools yourself, I would say that,
by definition, you are intending to be a programmer; inasmuch as a
programmer is a person who's job is to build tools using a tool-building
tool.

To that end, I recommend Haskell as a good language to use to build
performant tools, especially for stuff like data-analysis, where speed is a
factor. Branching out from there, you may want to look at and learn about
Hadoop and similar technologies, MapReduce is a very powerful tool for
large-scale data analytics.

Along those lines, languages like R are optimized for datacrunching and
data visualization, and are certainly worth learning about.

So, in essence, I guess I'd say that if you're intention is to learn about
practical, generic tools; then by definition your intention _is_ to be a
programmer, and therefore you may want to consider approaching the problem
from that point of view.

If your goal is merely to consume tools -- perhaps writing a small amount
of code, you (I think) still have intention (if unseen) to be a programmer,
but you might find it easier to use languages like Perl, Python, or Ruby --
which have large standard libraries, good ability to function as "glue" and
low syntactic and semantic overhead (that is to say, they're a bit easier
to write) than some languages (eg, Erlang, Haskell, R, etc.)

That's not to say it's hard to write good code in the latter set of
languages, merely that it requires (I think) more understanding of a
potentially more complicated model (especially true with haskell).

I don't know if that answers your question, I hope it helps.

/Joe



On Fri, Apr 27, 2012 at 4:16 PM, Nicholas Kormanik <nkormanik at gmail.com>wrote:

>
> I am not a programmer, and have no intention of becoming one. I'm a stock
> and options trader. MetaStock is one of the primary programs I use. Other
> statistical and mathematical programs as well.
>
> Very often when some small need arises, I Google-search for a solution.
> There seems to be any number of freeware utilities out there in cyberland
> --
> and more all the time -- that do pretty much whatever is needed.
>
> Additionally, Mathematica (as one example) has a powerful programming
> language built in.
>
> So, my question is: Does it make practical sense to spend time learning
> Haskell for the purpose of adding it to my assortment of 'tools' -- to
> quickly do this or that, as the need arises?
>
> Is there any better general practical 'tool' (or, if you want, 'programming
> language') to add to my arsenal.
>
> Thanks for your comments and suggestions.
>
> Nicholas Kormanik
>
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120427/e6350499/attachment.htm>

Reply | Threaded
Open this post in threaded view
|

Haskell as a useful practical 'tool' for intelligent non-programmers

Nicholas Kormanik
 

?You might find it easier to use languages like Perl, Python, or Ruby??

 

In a nutshell, which of these to start with?  I?m totally clueless.  And it all seems so daunting.

 

Yes, I?m a big user of little nifty tools/utilities you programmers put out, free to the world.  It?s simply amazing what you programmers accomplish.  I?m always searching the web to find new ones.

 

But it would be terrific to be able to do some of that myself ? if I could find a good practical ?tool? to make my own little tools, to extemporaneously cobble together as needed.

 

Nicholas

 

 

From: Joseph Fredette [mailto:jfredett at gmail.com]
Sent: Friday, April 27, 2012 3:06 PM
To: nkormanik at gmail.com
Cc: beginners at haskell.org
Subject: Re: [Haskell-beginners] Haskell as a useful practical 'tool' for intelligent non-programmers

 

It seems to me that what you're looking for is a way to build tools suited to particular tasks, subject to particular performance constraints. If you're goal is to be able to build these tools yourself, I would say that, by definition, you are intending to be a programmer; inasmuch as a programmer is a person who's job is to build tools using a tool-building tool.

 

To that end, I recommend Haskell as a good language to use to build performant tools, especially for stuff like data-analysis, where speed is a factor. Branching out from there, you may want to look at and learn about Hadoop and similar technologies, MapReduce is a very powerful tool for large-scale data analytics.

 

Along those lines, languages like R are optimized for datacrunching and data visualization, and are certainly worth learning about.

 

So, in essence, I guess I'd say that if you're intention is to learn about practical, generic tools; then by definition your intention _is_ to be a programmer, and therefore you may want to consider approaching the problem from that point of view.

 

If your goal is merely to consume tools -- perhaps writing a small amount of code, you (I think) still have intention (if unseen) to be a programmer, but you might find it easier to use languages like Perl, Python, or Ruby -- which have large standard libraries, good ability to function as "glue" and low syntactic and semantic overhead (that is to say, they're a bit easier to write) than some languages (eg, Erlang, Haskell, R, etc.)

 

That's not to say it's hard to write good code in the latter set of languages, merely that it requires (I think) more understanding of a potentially more complicated model (especially true with haskell).

 

I don't know if that answers your question, I hope it helps.

 

/Joe

 

 

On Fri, Apr 27, 2012 at 4:16 PM, Nicholas Kormanik <nkormanik at gmail.com> wrote:


I am not a programmer, and have no intention of becoming one. I'm a stock
and options trader. MetaStock is one of the primary programs I use. Other
statistical and mathematical programs as well.

Very often when some small need arises, I Google-search for a solution.
There seems to be any number of freeware utilities out there in cyberland --
and more all the time -- that do pretty much whatever is needed.

Additionally, Mathematica (as one example) has a powerful programming
language built in.

So, my question is: Does it make practical sense to spend time learning
Haskell for the purpose of adding it to my assortment of 'tools' -- to
quickly do this or that, as the need arises?

Is there any better general practical 'tool' (or, if you want, 'programming
language') to add to my arsenal.

Thanks for your comments and suggestions.

Nicholas Kormanik




_______________________________________________
Beginners mailing list
Beginners at haskell.org
http://www.haskell.org/mailman/listinfo/beginners

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120427/cf010c1f/attachment-0001.htm>

Reply | Threaded
Open this post in threaded view
|

Haskell as a useful practical 'tool' for intelligent non-programmers

Michael Orlitzky
On 04/27/2012 05:59 PM, Nicholas Kormanik wrote:

>  
>
> ?You might find it easier to use languages like Perl, Python, or Ruby??
>
>  
>
> In a nutshell, which of these to start with?  I?m totally clueless.  And
> it all seems so daunting.
>
>  
>
> Yes, I?m a big user of little nifty tools/utilities you programmers put
> out, free to the world.  It?s simply amazing what you programmers
> accomplish.  I?m always searching the web to find new ones.
>
>  
>
> But it would be terrific to be able to do some of that myself ? if I
> could find a good practical ?tool? to make my own little tools, to
> extemporaneously cobble together as needed.

Give Sage (http://www.sagemath.org/) a try. It combines several open
source libraries into a cohesive system, something like Mathematica.
Version 5.0 will be released Real Soon Now.


Reply | Threaded
Open this post in threaded view
|

Haskell as a useful practical 'tool' for intelligent non-programmers

Lorenzo Bolla
In reply to this post by Nicholas Kormanik
On Fri, Apr 27, 2012 at 02:16:38PM -0600, Nicholas Kormanik wrote:

>
> I am not a programmer, and have no intention of becoming one. I'm a stock
> and options trader. MetaStock is one of the primary programs I use. Other
> statistical and mathematical programs as well.
>
> Very often when some small need arises, I Google-search for a solution.
> There seems to be any number of freeware utilities out there in cyberland --
> and more all the time -- that do pretty much whatever is needed.
>
> Additionally, Mathematica (as one example) has a powerful programming
> language built in.
>
> So, my question is: Does it make practical sense to spend time learning
> Haskell for the purpose of adding it to my assortment of 'tools' -- to
> quickly do this or that, as the need arises?
>
> Is there any better general practical 'tool' (or, if you want, 'programming
> language') to add to my arsenal.
>
> Thanks for your comments and suggestions.
>
> Nicholas Kormanik

I think the choice of which language really depends on the problems you
want to solve. But rest assured: once you've learned the first language,
learning more is simpler...

As a first language, I would definitely go (as I did, in the past) for
Python. The basics are easy to learn, it's great as general purpose
language, it's well supported and has a massive user base.
The standard library is very complete and there are additional high
quality libraries to do mathematical and statistical analysis (google
for numpy, scipy, pandas, pytables, ...). I would choose Python 2.7, and
avoid 3.x to be able to choose from more libraries (just a small subset
have been ported to 3.x).

If you find programming interesting (as we all here do, I believe),
than, once you've familiarized with Python, you should definitely give
Haskell a try: I'm a beginner in Haskell, but I can say it's been the
most enjoyable language to learn so far.

hth,
L.


--
Lorenzo Bolla
http://lbolla.info
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120428/8086aff0/attachment.pgp>

Reply | Threaded
Open this post in threaded view
|

Haskell as a useful practical 'tool' for intelligent non-programmers

umptious
In reply to this post by Nicholas Kormanik
On 27 April 2012 21:16, Nicholas Kormanik <nkormanik at gmail.com> wrote:

>
>
> So, my question is: Does it make practical sense to spend time learning
> Haskell for the purpose of adding it to my assortment of 'tools' -- to
> quickly do this or that, as the need arises?
>
> Is there any better general practical 'tool' (or, if you want, 'programming
> language') to add to my arsenal.
>

No one can give you advice on what tool to use without knowing what the
task or who you are in more detail than you provided. And you're often
better with several tools than "general" one - trying to saw with a hammer
isn't easy.

Unless you're unusually smart in the IQ sense and/or have a maths or formal
logic background, then I'd say that Haskell would be a miserable choice for
a first programming language.

As for tools you might look at for tasks that I ***guess*** that a trader
is likely to want to do:

- For web scraping and text mining, Groovy, Clojure, Ruby, Python and
(maybe) Perl are reasonable choices

- For both number crunching and symbolic maths, look at sagemaths (which is
scripted in Python) - it's a reasonable free alternative to both Matlab
(number crunching) and Mathematic (symbolics)

..Which I suppose makes Python the no-brainer choice. Python is easy to
learn, the community is supportive, there are lots of reasonable books and
tutorials. I think it also has stuff around for working with Excel
spreadsheets, which I'd imagine you might want to do.

Haskell is actually a better language than any of the above (leaving aside
learnability and without defining "better") but for real world use
libraries count more than language features. It would take you years to
write the equivalent of sagemaths in Haskell, which rather negates
Haskell's advantages if you need that functionality.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120428/9607a4d2/attachment.htm>

Reply | Threaded
Open this post in threaded view
|

Haskell as a useful practical 'tool' for intelligent non-programmers

Nicholas Kormanik
 

Greatly appreciate your sharing these thoughts.

 

A bit frustrating that you mention four as candidates: "Groovy, Clojure,
Ruby, Python."

 

But it sounds like you are leaning toward recommending Python as the best
way to start.

 

Nicholas

 

 

From: umptious [mailto:umptious at gmail.com]
Sent: Saturday, April 28, 2012 9:39 AM
To: nkormanik at gmail.com
Cc: beginners at haskell.org
Subject: Re: [Haskell-beginners] Haskell as a useful practical 'tool' for
intelligent non-programmers

 

 

On 27 April 2012 21:16, Nicholas Kormanik <nkormanik at gmail.com> wrote:



So, my question is: Does it make practical sense to spend time learning
Haskell for the purpose of adding it to my assortment of 'tools' -- to
quickly do this or that, as the need arises?

Is there any better general practical 'tool' (or, if you want, 'programming
language') to add to my arsenal.


No one can give you advice on what tool to use without knowing what the task
or who you are in more detail than you provided. And you're often better
with several tools than "general" one - trying to saw with a hammer isn't
easy.

Unless you're unusually smart in the IQ sense and/or have a maths or formal
logic background, then I'd say that Haskell would be a miserable choice for
a first programming language.

As for tools you might look at for tasks that I ***guess*** that a trader is
likely to want to do:

- For web scraping and text mining, Groovy, Clojure, Ruby, Python and
(maybe) Perl are reasonable choices

- For both number crunching and symbolic maths, look at sagemaths (which is
scripted in Python) - it's a reasonable free alternative to both Matlab
(number crunching) and Mathematic (symbolics)

..Which I suppose makes Python the no-brainer choice. Python is easy to
learn, the community is supportive, there are lots of reasonable books and
tutorials. I think it also has stuff around for working with Excel
spreadsheets, which I'd imagine you might want to do.

Haskell is actually a better language than any of the above (leaving aside
learnability and without defining "better") but for real world use libraries
count more than language features. It would take you years to write the
equivalent of sagemaths in Haskell, which rather negates Haskell's
advantages if you need that functionality.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120428/82bb460c/attachment-0001.htm>

Reply | Threaded
Open this post in threaded view
|

Haskell as a useful practical 'tool' for intelligent non-programmers

Mike Meyer
On Sat, 28 Apr 2012 15:50:36 -0600
"Nicholas Kormanik" <nkormanik at gmail.com> wrote:

> A bit frustrating that you mention four as candidates: "Groovy, Clojure,
> Ruby, Python."

I'd not recommend starting with Groovy or Clojure. While Clojure is a
great language, the most popular implementation is hooked into the
JVM, and you wind up needing to deal with a lot Java infrastructure
fairly quickly. Being able to use that infrastructure is a design
goal, but adds to the learning curve. I haven't looked into Groovy,
but suspect some of the same issues will arise (and hope a Groovy
programmer will correct me if I'm wrong).

Ruby makes a bad fit if Haskell is a goal (and that's a good
goal). Ruby functions aren't first-class objects, and can't simply be
passed to other functions as arguments. Last time I looked, there were
a half-dozen workarounds for that, none of them really very
elegant. That ability is a critical feature in Haskell. Python at
least allows it, though it's not as nicely integrated as in Haskell,
or even Clojure.

> But it sounds like you are leaning toward recommending Python as the best
> way to start.

Given those for, and that this is a Haskell list, I'd certainly agree
with that.

     <mike
--
Mike Meyer <mwm at mired.org> http://www.mired.org/
Independent Software developer/SCM consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org


Reply | Threaded
Open this post in threaded view
|

Haskell as a useful practical 'tool' for intelligent non-programmers

Michael Orlitzky
On 04/28/2012 08:47 PM, Mike Meyer wrote:
>
> Ruby makes a bad fit if Haskell is a goal (and that's a good
> goal). Ruby functions aren't first-class objects, and can't simply be
> passed to other functions as arguments.

That's like, the least true thing you can say about Ruby =)

A simple test program:

  $ cat fcf.rb
  def foo
    puts "foo"
  end

  def call_arg(f)
    f
  end

  call_arg(foo)


Running it:

  $ ruby fcf.rb
  foo


Moreover, every function and method implicitly accepts a function as an
argument:

  $ cat yield.rb
  def call_block
    yield
  end

  call_block { puts "foo" }

This allows you some nice do-block syntactic sugar instead of lambdas
which can get ugly.

  $ ruby yield.rb
  foo


Reply | Threaded
Open this post in threaded view
|

Haskell as a useful practical 'tool' for intelligent non-programmers

Lyndon Maydwell
Your first example is not behaving how you think it is...


ruby-1.9.2-p0 :012 > def foo
ruby-1.9.2-p0 :013?>   puts "foo"
ruby-1.9.2-p0 :014?> end
 => nil
ruby-1.9.2-p0 :015 > def call_arg(f)
ruby-1.9.2-p0 :016?>   puts "calling"
ruby-1.9.2-p0 :017?>   f
ruby-1.9.2-p0 :018?> end
 => nil
ruby-1.9.2-p0 :019 > call_arg(foo)
foo
calling
 => nil

Note that "foo" is printed before "calling".


On Sun, Apr 29, 2012 at 10:22 AM, Michael Orlitzky <michael at orlitzky.com> wrote:

> On 04/28/2012 08:47 PM, Mike Meyer wrote:
>>
>> Ruby makes a bad fit if Haskell is a goal (and that's a good
>> goal). Ruby functions aren't first-class objects, and can't simply be
>> passed to other functions as arguments.
>
> That's like, the least true thing you can say about Ruby =)
>
> A simple test program:
>
> ?$ cat fcf.rb
> ?def foo
> ? ?puts "foo"
> ?end
>
> ?def call_arg(f)
> ? ?f
> ?end
>
> ?call_arg(foo)
>
>
> Running it:
>
> ?$ ruby fcf.rb
> ?foo
>
>
> Moreover, every function and method implicitly accepts a function as an
> argument:
>
> ?$ cat yield.rb
> ?def call_block
> ? ?yield
> ?end
>
> ?call_block { puts "foo" }
>
> This allows you some nice do-block syntactic sugar instead of lambdas
> which can get ugly.
>
> ?$ ruby yield.rb
> ?foo
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners


Reply | Threaded
Open this post in threaded view
|

Haskell as a useful practical 'tool' for intelligent non-programmers

Michael Orlitzky
On 04/28/2012 10:37 PM, Lyndon Maydwell wrote:

> Your first example is not behaving how you think it is...
>
>
> ruby-1.9.2-p0 :012 > def foo
> ruby-1.9.2-p0 :013?>   puts "foo"
> ruby-1.9.2-p0 :014?> end
>  => nil
> ruby-1.9.2-p0 :015 > def call_arg(f)
> ruby-1.9.2-p0 :016?>   puts "calling"
> ruby-1.9.2-p0 :017?>   f
> ruby-1.9.2-p0 :018?> end
>  => nil
> ruby-1.9.2-p0 :019 > call_arg(foo)
> foo
> calling
>  => nil
>
> Note that "foo" is printed before "calling".
>

Indeed, I tried to make the example cute and botched it. This should be
less screwupy (you have to desugar the 'def...' to make it work properly).

  foo = Proc.new { puts "foo" }
  bar = lambda { puts "bar" }

  def baz
    puts "baz"
  end

  def call_arg(f)
    puts "before call"
    f.call()
    puts "after call"
  end

  call_arg(foo)
  puts ""
  call_arg(bar)
  puts ""
  call_arg(method(:baz))


Reply | Threaded
Open this post in threaded view
|

Haskell as a useful practical 'tool' for intelligent non-programmers

Mike Meyer
In reply to this post by Michael Orlitzky
On Sat, 28 Apr 2012 22:22:34 -0400
Michael Orlitzky <michael at orlitzky.com> wrote:

> On 04/28/2012 08:47 PM, Mike Meyer wrote:
> > Ruby makes a bad fit if Haskell is a goal (and that's a good
> > goal). Ruby functions aren't first-class objects, and can't simply be
> > passed to other functions as arguments.
>
> That's like, the least true thing you can say about Ruby =)

I respectfully disagree. For instance, I could have said that it uses
indentation to delimit blocks like ABC does. That's much less true.

But I believe the statement about functions not being first class
objects is true. Of course, I don't use ruby on a regular basis
because that turns out to be the case every time I go look at it. If
the language has changed so this can be done in a manner that's as
straightforward as Python, I'd be interested in hearing about it.

For the record, the Python version of your example is:

def foo():
   print("foo")

call_arg = apply

call_arg(foo)

> A simple test program:
>
>   $ cat fcf.rb
>   def foo
>     puts "foo"
>   end
>
>   def call_arg(f)
>     f
>   end
>
>   call_arg(foo)

And that would do it, except, as Lyndon explained, it's not doing the
right thing. You provided one of the workarounds (using Proc) when you
corrected it.

> Moreover, every function and method implicitly accepts a function as an
> argument:

Doesn't quite seem that way to me.

>   $ cat yield.rb
>   def call_block
>     yield
>   end
>
>   call_block { puts "foo" }
>
> This allows you some nice do-block syntactic sugar instead of lambdas
> which can get ugly.

They are accepting a *block* as an argument. And you're right - blocks
are cleaner than lambdas. It's also more powerful than Python's
lambdas, which are restricted to being expressions. A lot of people
(me among them) would like Python to have something like Ruby's block
construct for anonymous code, and there are regular proposals on how
to do it (including from me).  If someone ever comes up with a way
that both reads well in an indent-delimited language and doesn't
invite incredible abuse, it'll probably make it into the language.

But that doesn't make a function a first class object. It doesn't even
make a block a first class object (can I give a block a name?).

There are other ways to work around this limitation (I think I found 6
last time I looked). IIRC, the Proc version was about the cleanest.

Note that I *didn't* say that this limitation makes Ruby a bad
language. I don't like it, because I find that languages that don't
make functions first-class objects grate on me. If it doesn't bother
you, you're a better person than I am.

That's why I added the proviso "if Haskell is a goal". Trying to go
from a language where functions can't be treated as first class
objects, requiring wrapper objects and similar things in order to
write in a functional style to one where a functional style is de
rigueur just seems like a bad idea.

    <mike
--
Mike Meyer <mwm at mired.org> http://www.mired.org/
Independent Software developer/SCM consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org


Reply | Threaded
Open this post in threaded view
|

Haskell as a useful practical 'tool' for intelligent non-programmers

Michael Orlitzky
On 04/29/2012 12:15 AM, Mike Meyer wrote:

> On Sat, 28 Apr 2012 22:22:34 -0400
> Michael Orlitzky <michael at orlitzky.com> wrote:
>
>> On 04/28/2012 08:47 PM, Mike Meyer wrote:
>>> Ruby makes a bad fit if Haskell is a goal (and that's a good
>>> goal). Ruby functions aren't first-class objects, and can't simply be
>>> passed to other functions as arguments.
>>
>> That's like, the least true thing you can say about Ruby =)
>
> I respectfully disagree. For instance, I could have said that it uses
> indentation to delimit blocks like ABC does. That's much less true.
>
> But I believe the statement about functions not being first class
> objects is true. Of course, I don't use ruby on a regular basis
> because that turns out to be the case every time I go look at it. If
> the language has changed so this can be done in a manner that's as
> straightforward as Python, I'd be interested in hearing about it.

They're wrapped in Proc objects, but those objects can be treated like
any other in the language. Everything else is just syntactic sugar on
top of Procs.

This is not conceptually any different to me than in Haskell or C; you
have a name for the thing, distinct from the thing itself, and you have
to ask for function application via (f x), f(x), f.call(x), or whatever.

(The Proc/def syntax disconnect is annoying, and apparently error-prone.
You can call a Proc with p[x] but not if you def'd it!)


> And that would do it, except, as Lyndon explained, it's not doing the
> right thing. You provided one of the workarounds (using Proc) when you
> corrected it.
>

Hey, it passed all the unit tests =P


Reply | Threaded
Open this post in threaded view
|

Haskell as a useful practical 'tool' for intelligent non-programmers

Mike Meyer
On Sun, 29 Apr 2012 01:20:22 -0400
Michael Orlitzky <michael at orlitzky.com> wrote:

> On 04/29/2012 12:15 AM, Mike Meyer wrote:
> > On Sat, 28 Apr 2012 22:22:34 -0400
> > Michael Orlitzky <michael at orlitzky.com> wrote:
> >
> >> On 04/28/2012 08:47 PM, Mike Meyer wrote:
> >>> Ruby makes a bad fit if Haskell is a goal (and that's a good
> >>> goal). Ruby functions aren't first-class objects, and can't simply be
> >>> passed to other functions as arguments.
> >>
> >> That's like, the least true thing you can say about Ruby =)
> >
> > I respectfully disagree. For instance, I could have said that it uses
> > indentation to delimit blocks like ABC does. That's much less true.
> >
> > But I believe the statement about functions not being first class
> > objects is true. Of course, I don't use ruby on a regular basis
> > because that turns out to be the case every time I go look at it. If
> > the language has changed so this can be done in a manner that's as
> > straightforward as Python, I'd be interested in hearing about it.
>
> They're wrapped in Proc objects, but those objects can be treated like
> any other in the language. Everything else is just syntactic sugar on
> top of Procs.

That makes *Procs* first class object, not functions.

> This is not conceptually any different to me than in Haskell or C; you
> have a name for the thing, distinct from the thing itself, and you have
> to ask for function application via (f x), f(x), f.call(x), or whatever.

And if having the same set of concepts were all that mattered, we'd
still PERFORMing blocks of code.  The syntax of a language makes some
things easier to do, and some things harder - that's why there's more
than one of them. Writing HOFs is harder in ruby than in a language
with first-class functions, because you can't pass a function to a
function.  You have to decide which of the workarounds you want to use
(blocks or lambdas or Methods or Procs or ...). If you want to use a
function from the standard library - you have to wrap it in order to
pass it to your HOF. Since "all of the above" isn't a valid choice, if
you're trying to use a library of HOFs (assuming such exist in Ruby -
and if they don't, that's yet another reason Ruby isn't a good way to
get to Haskell), you may wind up wrapping some things multiple times,
or wrap the results of your HOFs, or ... well, you get the idea.

None of this makes Ruby any better or worse for anything other than
writing code in a functional style. There are perfectly usable
languages that can't do HOFs at all. That you can do it at all makes
Ruby a better choice than them for writing functional code. But it
requires a lot of code that's nothing more than boilerplate, which
makes it worse than languages that don't require such.

Of course, if you don't think boilerplate makes things harder, and all
that matters is having the same concepts, then I expect you won't
argue if I claim that there's no reason to pick Ruby over Java for
writing OO code. After all, they have the same concepts, just with
different syntactic sugar and more or less boilerplate.

        <mike
--
Mike Meyer <mwm at mired.org> http://www.mired.org/
Independent Software developer/SCM consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org


Reply | Threaded
Open this post in threaded view
|

Haskell as a useful practical 'tool' for intelligent non-programmers

Michael Orlitzky
On 04/29/2012 02:35 AM, Mike Meyer wrote:

> On Sun, 29 Apr 2012 01:20:22 -0400
> Michael Orlitzky <michael at orlitzky.com> wrote:
>
>>
>> They're wrapped in Proc objects, but those objects can be treated like
>> any other in the language. Everything else is just syntactic sugar on
>> top of Procs.
>
> That makes *Procs* first class object, not functions.
>

What's the difference? You're not passing around the actual function, in
any language.


>> This is not conceptually any different to me than in Haskell or C; you
>> have a name for the thing, distinct from the thing itself, and you have
>> to ask for function application via (f x), f(x), f.call(x), or whatever.
>
> And if having the same set of concepts were all that mattered, we'd
> still PERFORMing blocks of code.  The syntax of a language makes some
> things easier to do, and some things harder - that's why there's more
> than one of them. Writing HOFs is harder in ruby than in a language
> with first-class functions, because you can't pass a function to a
> function.  You have to decide which of the workarounds you want to use
> (blocks or lambdas or Methods or Procs or ...). If you want to use a
> function from the standard library - you have to wrap it in order to
> pass it to your HOF. Since "all of the above" isn't a valid choice, if
> you're trying to use a library of HOFs (assuming such exist in Ruby -
> and if they don't, that's yet another reason Ruby isn't a good way to
> get to Haskell), you may wind up wrapping some things multiple times,
> or wrap the results of your HOFs, or ... well, you get the idea.
>
> None of this makes Ruby any better or worse for anything other than
> writing code in a functional style. There are perfectly usable
> languages that can't do HOFs at all. That you can do it at all makes
> Ruby a better choice than them for writing functional code. But it
> requires a lot of code that's nothing more than boilerplate, which
> makes it worse than languages that don't require such.
>
> Of course, if you don't think boilerplate makes things harder, and all
> that matters is having the same concepts, then I expect you won't
> argue if I claim that there's no reason to pick Ruby over Java for
> writing OO code. After all, they have the same concepts, just with
> different syntactic sugar and more or less boilerplate.

We were never talking about easy, only possible. I can pass around
functions just fine if I declare them with Proc.new and call them with
p[x]. Nobody actually does this in practice because classes provide
implicit state, and that combined with blocks solves almost all real use
cases.


Reply | Threaded
Open this post in threaded view
|

Haskell as a useful practical 'tool' for intelligent non-programmers

Lorenzo Bolla
On Sun, Apr 29, 2012 at 03:32:48AM -0400, Michael Orlitzky wrote:

> On 04/29/2012 02:35 AM, Mike Meyer wrote:
> > On Sun, 29 Apr 2012 01:20:22 -0400
> > Michael Orlitzky <michael at orlitzky.com> wrote:
> >
> >>
> >> They're wrapped in Proc objects, but those objects can be treated like
> >> any other in the language. Everything else is just syntactic sugar on
> >> top of Procs.
> >
> > That makes *Procs* first class object, not functions.
> >
>
> What's the difference? You're not passing around the actual function, in
> any language.

$ python
Python 2.7.3 (default, Apr 14 2012, 23:17:33)
[GCC 4.7.0 20120407 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> def f():
...     print 'foo'
...
>>> def g(f):
...     print 'bar'
...     f()
...
>>> g(f)
bar
foo

Also: http://en.wikipedia.org/wiki/First-class_function#Language_support

L.


--
Lorenzo Bolla
http://lbolla.info
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120429/e0219afe/attachment.pgp>

Reply | Threaded
Open this post in threaded view
|

Haskell as a useful practical 'tool' for intelligent non-programmers

Michael Orlitzky
On 04/29/2012 10:28 AM, Lorenzo Bolla wrote:

>>
>> What's the difference? You're not passing around the actual function, in
>> any language.
>
> $ python
> Python 2.7.3 (default, Apr 14 2012, 23:17:33)
> [GCC 4.7.0 20120407 (prerelease)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> def f():
> ...     print 'foo'
> ...
>>>> def g(f):
> ...     print 'bar'
> ...     f()
> ...
>>>> g(f)
> bar
> foo
>
> Also: http://en.wikipedia.org/wiki/First-class_function#Language_support
>

You're not passing around the function, you're passing around the name
of the function or a pointer. Python happens to know that when you write
f(), you want to evaluate the function named f, much like when you say
f.call() in Ruby.

Ruby doesn't even have functions, only methods, so you have to entertain
the idea that the same thing can have two different names to even have
this discussion. Passing functions to other functions is so fundamental
to Ruby that it's baked into the language:

  irb(main):001:0> [1, 2, 3].map { |x| 2*x }
  => [2, 4, 6]

They're not called functions, but the distinction is imaginary. For an
imperative language, the culture pretty strongly encourages you to use
map, filter, fold etc. which are all passed functions (Procs) using the
block syntax.


Reply | Threaded
Open this post in threaded view
|

Haskell as a useful practical 'tool' for intelligent non-programmers

Lyndon Maydwell
If you're interested in OS integration, it may be worth learning C# if
you're on windows. It's certainly quite amenable to 'glue', and it's
gaining more functional features all the time. Also, you have the
option of branching out to F# if you enjoy the .Net environment, but
crave a purer language.

I'd probably consider some combination of .Net and Mathematica if I
were doing trading on Windows and didn't mind paying for the software,
but it might not be a popular opinion :-)

Disclaimer -  I don't really know how trading works in practice.

On Sun, Apr 29, 2012 at 10:56 PM, Michael Orlitzky <michael at orlitzky.com> wrote:

> On 04/29/2012 10:28 AM, Lorenzo Bolla wrote:
>>>
>>> What's the difference? You're not passing around the actual function, in
>>> any language.
>>
>> $ python
>> Python 2.7.3 (default, Apr 14 2012, 23:17:33)
>> [GCC 4.7.0 20120407 (prerelease)] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>>>>> def f():
>> ... ? ? print 'foo'
>> ...
>>>>> def g(f):
>> ... ? ? print 'bar'
>> ... ? ? f()
>> ...
>>>>> g(f)
>> bar
>> foo
>>
>> Also: http://en.wikipedia.org/wiki/First-class_function#Language_support
>>
>
> You're not passing around the function, you're passing around the name
> of the function or a pointer. Python happens to know that when you write
> f(), you want to evaluate the function named f, much like when you say
> f.call() in Ruby.
>
> Ruby doesn't even have functions, only methods, so you have to entertain
> the idea that the same thing can have two different names to even have
> this discussion. Passing functions to other functions is so fundamental
> to Ruby that it's baked into the language:
>
> ?irb(main):001:0> [1, 2, 3].map { |x| 2*x }
> ?=> [2, 4, 6]
>
> They're not called functions, but the distinction is imaginary. For an
> imperative language, the culture pretty strongly encourages you to use
> map, filter, fold etc. which are all passed functions (Procs) using the
> block syntax.
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners


Reply | Threaded
Open this post in threaded view
|

Haskell as a useful practical 'tool' for intelligent non-programmers

umptious
In reply to this post by Nicholas Kormanik
On 28 April 2012 22:50, Nicholas Kormanik <nkormanik at gmail.com> wrote:

> ** **
>
> Greatly appreciate your sharing these thoughts.****
>
> ** **
>
> A bit frustrating that you mention four as candidates: ?Groovy, Clojure,
> Ruby, Python.?****
>
> ** **
>
> But it sounds like you are leaning toward recommending Python as the best
> way to start. ****
>
> ** **
>
> Nicholas****
>
> **
>

No. I'm the person who mentioned all four of those as examples of languages
that are good for web scraping. I then went on to say that given what I
**guess** you might need to do that Python is the "no-brainer" best. You
really don't say enough for anyone to be sure though - if you want to
implement some very time consuming numerical algorithms and have them run
fast then CUDA might be the only option. (In which case you're probably out
of luck, because CUDA programming isn't for amateurs.) Or for less
demanding numerics centred around stats and matrix ops, the R could be a
better choice than Python and Sagemaths:

http://en.wikipedia.org/wiki/R_%28programming_language%29

..and R will webscrape too:

http://www.programmingr.com/content/webscraping-using-readlines-and-rcurl

If you want to do stuff like time series analysis then you'll probably find
more books and papers using R:

http://www.stat.pitt.edu/stoffer/tsa2/R_time_series_quick_fix.htm


>> Mike Meyer: Ruby makes a bad fit if Haskell is a goal (and that's a good
goal)

I don't see it as being a goal for this guy! He just wants to be able to
write utilities he needs without bogging down in "becoming a programmer."

>> While Clojure is a
great language, the most popular implementation is hooked into the
JVM, and you wind up needing to deal with a lot Java infrastructure
fairly quickly. Being able to use that infrastructure is a design
goal, but adds to the learning curve. I haven't looked into Groovy,
but suspect some of the same issues will arise (and hope a Groovy
programmer will correct me if I'm wrong).<<

I played around with Groovy for a weekend to write some utilities and a
music generation program. I can't remember having to put any effort into
"needing to deal with a lot Java infrastructure," even though I was using a
midi library written for pure Java. But I'm not really sure what you mean
(installing a Java compiler?? doesn't seem like a lot) and it doesn't
matter - Python/Sagemaths and R seem like the most reasonable tools without
spending big money.

Re. the OP's needs: learning a programming language isn't enough to write
programs that work correctly. You will need to learn how to design and
debug code if you're writing more than very trivial apps. Take a look at
something like Kernighan and Pike's "The Practice Of Programming." There is
no magic language that let's you write code "without becoming a
programmer." Some are easier to learn than others or offer more
functionality in particular areas, but writing even moderately complex
programs that really work - rather than just seeming to - requires
reasonable practice, some book knowledge, and lots of discipline. Programs
are treacherous and deceptive and it requires skill just to verify that
they are working reliably.




> **
>
> ** **
>
> *From:* umptious [mailto:umptious at gmail.com]
> *Sent:* Saturday, April 28, 2012 9:39 AM
>
> *To:* nkormanik at gmail.com
> *Cc:* beginners at haskell.org
> *Subject:* Re: [Haskell-beginners] Haskell as a useful practical 'tool'
> for intelligent non-programmers****
>
> ** **
>
> ** **
>
> On 27 April 2012 21:16, Nicholas Kormanik <nkormanik at gmail.com> wrote:****
>
>
>
> So, my question is: Does it make practical sense to spend time learning
> Haskell for the purpose of adding it to my assortment of 'tools' -- to
> quickly do this or that, as the need arises?
>
> Is there any better general practical 'tool' (or, if you want, 'programming
> language') to add to my arsenal.****
>
>
> No one can give you advice on what tool to use without knowing what the
> task or who you are in more detail than you provided. And you're often
> better with several tools than "general" one - trying to saw with a hammer
> isn't easy.
>
> Unless you're unusually smart in the IQ sense and/or have a maths or
> formal logic background, then I'd say that Haskell would be a miserable
> choice for a first programming language.
>
> As for tools you might look at for tasks that I ***guess*** that a trader
> is likely to want to do:
>
> - For web scraping and text mining, Groovy, Clojure, Ruby, Python and
> (maybe) Perl are reasonable choices
>
> - For both number crunching and symbolic maths, look at sagemaths (which
> is scripted in Python) - it's a reasonable free alternative to both Matlab
> (number crunching) and Mathematic (symbolics)
>
> ..Which I suppose makes Python the no-brainer choice. Python is easy to
> learn, the community is supportive, there are lots of reasonable books and
> tutorials. I think it also has stuff around for working with Excel
> spreadsheets, which I'd imagine you might want to do.
>
> Haskell is actually a better language than any of the above (leaving aside
> learnability and without defining "better") but for real world use
> libraries count more than language features. It would take you years to
> write the equivalent of sagemaths in Haskell, which rather negates
> Haskell's advantages if you need that functionality.****
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120429/b8bcf930/attachment-0001.htm>

Reply | Threaded
Open this post in threaded view
|

Haskell as a useful practical 'tool' for intelligent non-programmers

Kyle Murphy-2
In reply to this post by Lyndon Maydwell
As you can see this is a highly contentious subject. What you naively asked
(what's the best language for me) is a really good way to start a flame war
with a bunch of programmers. To understand why, imagine you went to the
American Kennel Club, and asked a bunch of the breeders there "What's the
best dog for me?". You'd probably get a bunch of people asking for more
details like "what size is your house/apartment", "how often are you home",
"do you plan on using the dog for anything in particular or just as a pet",
etc. as well as a handful of people arguing about "<my_favorite_breed> is
better than <other_breed> because of <x>". What you've done is essentially
the same thing.

Programming is a very complex field, with a lot of theory and concepts
behind it. Fortunately you don't NEED to know all the theory and concepts
in order to write a program, but the more you know, the better you will be
able to write programs. Haskell because it has a very strong academic
background tends to attract a lot of people with VERY strong backgrounds in
CS theory, as well as handfuls of programmers that only know some of the
theory but see a lot of potential in the language and are trying to brush
up on it (like me). Unfortunately because it has such a strong academic
backing a lot of the documentation available for Haskell is written for at
a minimum experienced programmers, and a lot of it assumes a pretty strong
CS background (E.G. any page talking about arrows), so it can be pretty
rough for someone with absolutely no background in programming to get into.

Programming languages can usually be divided up into smaller groups on
rather arbitrary axis, some of which are stylistic (E.G. white space vs.
brace delimited blocks), and some of which are fundamental to the way
programs are reasoned about and constructed (E.G. functional vs. object
oriented). Each language is a unique blend of these various axis. Certain
problems tend to be easier to solve along certain points on these axis, and
so languages that are closer to those points will tend to be "easier" to
use for that particular set of problems. That said, any programming
language can, for the most part, be used to solve any problem given enough
time and effort, and a programmers relative experience with a particular
language goes a long way in determining how long a given task will take.

Some languages, for a variety of reasons, tend to be easier for novices to
pick up. Python as others have indicated would probably be one of the best
choices mentioned so far, but other options include javascript (it's
ubiquitous, but learning the scope rules can be a bit tough, and there is a
LOT of REALLY bad javascript code out there so pick your examples
carefully), Assembly (this one is often frowned on, but understanding at
its most basic exactly what a computer is doing can be a huge boost in
understanding more advanced concepts), or even something like Go.
Importantly, learning a language that exists at a particular point in the
theory axis (functional, object oriented, procedural, logic) will make
learning other languages on that same point easier, which is why a lot of
people on here (Haskell is functional) are recommending other functional
languages.

As for your original statement about "I am not a programmer, and have no
intention of becoming one", that would be a bit like a programmer coming to
you and saying "I'm not a stock and options trader and have no intention of
becoming one, but can you tell me a simple way to make money on the stock
market without having to learn anything about economics or finance?". By
learning to use a programming language, you are in effect becoming a
programmer, just not a very good one (that takes years and years of
study/work to accomplish, and even then there's always someone better or
more you can learn).

My recommendation is to pick a language, any language, and start
experimenting. Don't worry about all the details right away, just find some
tutorials and work through them until you understand how to do basic input
and output, and then start working towards goals. Start simple (write a
program that takes a series of numbers as input terminated with a newline,
and then outputs the mean, median, and mode averages), and move on to more
complex (program that reads a JSON formatted input file and outputs some
sort of analysis of the data). Eventually you'll reach the point with
whatever language you've chosen where you can do almost anything you want
with it, and somewhere along the way you'll probably be ready to start
learning/experimenting with other languages, maybe ones from completely
different design paradigms.

-R. Kyle Murphy
--
Curiosity was framed, Ignorance killed the cat.


On Sun, Apr 29, 2012 at 11:08, Lyndon Maydwell <maydwell at gmail.com> wrote:

> If you're interested in OS integration, it may be worth learning C# if
> you're on windows. It's certainly quite amenable to 'glue', and it's
> gaining more functional features all the time. Also, you have the
> option of branching out to F# if you enjoy the .Net environment, but
> crave a purer language.
>
> I'd probably consider some combination of .Net and Mathematica if I
> were doing trading on Windows and didn't mind paying for the software,
> but it might not be a popular opinion :-)
>
> Disclaimer -  I don't really know how trading works in practice.
>
> On Sun, Apr 29, 2012 at 10:56 PM, Michael Orlitzky <michael at orlitzky.com>
> wrote:
> > On 04/29/2012 10:28 AM, Lorenzo Bolla wrote:
> >>>
> >>> What's the difference? You're not passing around the actual function,
> in
> >>> any language.
> >>
> >> $ python
> >> Python 2.7.3 (default, Apr 14 2012, 23:17:33)
> >> [GCC 4.7.0 20120407 (prerelease)] on linux2
> >> Type "help", "copyright", "credits" or "license" for more information.
> >>>>> def f():
> >> ...     print 'foo'
> >> ...
> >>>>> def g(f):
> >> ...     print 'bar'
> >> ...     f()
> >> ...
> >>>>> g(f)
> >> bar
> >> foo
> >>
> >> Also:
> http://en.wikipedia.org/wiki/First-class_function#Language_support
> >>
> >
> > You're not passing around the function, you're passing around the name
> > of the function or a pointer. Python happens to know that when you write
> > f(), you want to evaluate the function named f, much like when you say
> > f.call() in Ruby.
> >
> > Ruby doesn't even have functions, only methods, so you have to entertain
> > the idea that the same thing can have two different names to even have
> > this discussion. Passing functions to other functions is so fundamental
> > to Ruby that it's baked into the language:
> >
> >  irb(main):001:0> [1, 2, 3].map { |x| 2*x }
> >  => [2, 4, 6]
> >
> > They're not called functions, but the distinction is imaginary. For an
> > imperative language, the culture pretty strongly encourages you to use
> > map, filter, fold etc. which are all passed functions (Procs) using the
> > block syntax.
> >
> > _______________________________________________
> > Beginners mailing list
> > Beginners at haskell.org
> > http://www.haskell.org/mailman/listinfo/beginners
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120429/edbc3803/attachment.htm>

12