Cheers,
Dan
On Thu, Jul 7, 2011 at 3:02 PM, Joel Crisp <joel.a...@googlemail.com> wrote:
> There were some interesting conversations ...
>
> Joel
>
> --
> You received this message because you are subscribed to the Google Groups
> "Austin Functional Programmers" group.
> To post to this group, send email to aust...@googlegroups.com.
> To unsubscribe from this group, send email to
> austin-fp+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/austin-fp?hl=en.
>
Duke
--
Sean
Thanks.
--
Donnie
Hi everyone,
Admin Stuff
-----------
This thread reached a critical mass and I shouldn't continue to put off a
reply. I was involved in the previous reboot of this meetup, and have probably
all the access anyone can want to the Google Apps site, which has the calendar.
I /just/ tried to set up the Calendar to allow members of this mailing list
write access to the calendar using the sneaky "aust...@googlegroups.com" as a
member. That works on some other Google products like Google Code. Let's see
if that works for the calendar. Give it a shot and reply back.
Also, I thought I set it up the AFP Google Sites page the same way, so everyone
should be able to edit that page too.
The only rub is that you need to have subscribed to this mailing list with the
same Gmail email address that you use to authenticate with to get to Google
Calendar and Google Site.
I know it's a little confusing. Just reply back if you're still stuck.
Reading I'm Interested In
-------------------------
Have you guys been keeping up with Robert Harper's blog [1]? I'm enjoying his
write-ups and trying not to get caught up in some of his inflammatory
assertions. I get/agree with his position on object-orientation. But I'm not
sure where I stand with respect to his aversion to lazy evaluation.
Also, stumbled onto a recent 70-page PDF by Simon Marlow titled "Parallel and
Concurrent Programming in Haskell" [2]. I really haven't touched parallel
programming in Haskell, so it would be great of the group had some interest in
this. The write-up is much more pragmatic than academic, so I could see us
playing around with some of the example code code in a REPL.
I have a projector if you guys are interested in that. I'm more or less fine
with most of the suggested times/locations for a meetup, but won't know for
sure until there's a proposed date. Mondays can be bad for me.
[1] http://existentialtype.wordpress.com/
[2] http://community.haskell.org/~simonmar/par-tutorial.pdf
Functional Stuff
----------------
I actually started using the Functional Java library here at work because some
of our algorithms really benefited from persistent immutable data structures.
I didn't want to code them from scratch, wasn't happy with some of the other
half-baked implementations out there, and wasn't ready to fight the
introduction of Scala or Clojure just yet. Functional Java is really just a
tidy proof-of-concept. It works, is more or less cleanly implemented, but is
far from full-featured.
It feels weird to have witnessed this much of the functional style in pure
Java. But it's actually worked out pretty well, because the mutable version of
the algorithm would have had some tedious correctness hurdles with observers
and deep copies.
I think the strongest observation I had was that the binding of methods to
objects is extremely premature. So I ended up with a barrage of first class
static variants of the methods I'd put on objects just for the flexibility of
map, join, and compose.
Still, though, it's pretty ghetto. I call this "the assembly language of
functional programming." But it was kind of worth it; I ended up with a parser
combinator to define a kind of regex grammar to search one of our trees for
subtrees. The embedded DSL in Java turned out pretty clean, and it gives our
team some needed flexibility.
That said, my opinion is that I really should be using Scala. The code I've
laid down illustrates what this style looks like in Java. I think my next step
is to do the same in Scala, to demonstrate the improvements (syntax,
performance, etc.). But also, there will be the build/integration/social
problems too, so I'll have to see how those compare to the gains.
-Sukant
The anti-OO theme is kind of laced throughout a few blogs. I guess the one
that caught my attention first was his advocacy to make OO a more senior,
elective course at CMU [1].
Harper is almost in full-tilt rant with gems like
"Object-oriented programming is eliminated entirely from the introductory
curriculum, because it is both anti-modular and anti-parallel by its very
nature, and hence unsuitable for a modern CS curriculum."
Some of us had read Cook's "On Understanding Data Abstraction, Revisited" paper
[2] for a previous meetup. I think Cook makes a nice defense for the value of
objects. The problem, I think, is that Cook's definition of objects are not
the common view of objects.
More recently [3], Harper had other ranty comments like
"We have for decades struggled with using object-oriented languages, such
as Java or C++, to explain these simple ideas, and have consistently
failed. And I can tell those of you who are not plugged into academics at
the moment, many of my colleagues world-wide are in the same situation, and
are desperate to find a way out. The awkward methodology, the “design
patterns”, the “style guidelines”, all get in the way of teaching the
principles. And even setting that aside, you’re still doing imperative
programming on ephemeral data structures. It just does not work, because
it is fundamentally the wrong thing. Just try to teach, say, binary search
tree delete; it’s a horrific mess! You wind up with absurd “null pointer”
nonsense, and a complex mess caused by the methodology, not the problem
itself. Pretty soon you have to resort to “frameworks” and “tools” just to
give the students a fighting chance to get anything done at all, distancing
them from the essential ideas and giving the impression that programming is
painful and ugly, an enormous tragedy."
It's kind of disappointing, because Harper clearly knows a ton about
programming language theory, but he's completely ignoring Cook's thesis (I
can't help but think he's at least aware of it). Cook flatly dispenses the
entanglement of object-orientation with mutable state or even subtype
polymorphism. That leaves a definition of OO that's more about implementation
hiding.
[1] http://existentialtype.wordpress.com/2011/03/15/teaching-fp-to-freshmen/
[2] http://www.cs.utexas.edu/~wcook/Drafts/2009/essay.pdf
[3] http://existentialtype.wordpress.com/2011/04/16/modules-matter-most/
> I mostly agree with him about laziness, but the important question is
> what features you replace it with. If you just made Haskell strict
> without any other modifications, you would make it worse, I think. I
> haven't tried Disciple, though.
Cool, I didn't know about the Disciple project till just now (Googling it).
I'm clearly not plugged into the Haskell community enough. From what I
understand, arguments against laziness involve:
- non-intuitive space leaks
- difficulties reasoning about performance
Those make sense to me in the abstract. I think I've encountered these
problems a little in pedagogical examples, but I'm interested in more
structured arguments.
-Sukant
-Sukant
Hmm, not to split hairs, but I don't think Cook is trying to advocate OOP
blanketly -- that wasn't my read of the paper at least. I think he's more
saying that objects have some benefits of abstraction (implementation hiding
mostly) that ADTs don't have. So in the instances we can use them, it makes
sense. Furthermore, he goes on to describe what he calls "complex" methods,
which inhibit object-orientation, because collaborating components have to
reach into the implementation of each other. Within the context of "simple"
methods, the transformation between ADTs and objects is facile.
So my read of the paper is an advocacy for objects, but only in the simple
cases, which may or may not be the norm, given the context. That's my read, at
least.
> My preference for strictness over laziness isn't just about performance. In
> a strict language, with code like this:
>
> foo :: (Int, Int) -> (Int, Int)
> foo (x,y) = (1, x)
>
> You can think of 'foo' as taking a pair of honest-to-goodness integers and
> constructing another pair. On the other hand in a lazy language you could
> use foo like this:
>
> bar :: (Int, Int)
> bar = foo bar
>
> So in a lazy language, your functions must deal with terms (expressions for
> values) rather than simple minded values. That's a problem for performance
> (which strictness analysis can maybe largely fix), but also I just don't like
> it conceptually.
I'm thinking of your example, and I think this is less about performance, and
more about halting. For instance, I can do this in both a lazy language like
Haskell
Prelude> let foo = (\(x, y) -> (1, x)) :: (Int, Int) -> (Int, Int)
Prelude> let bar = foo bar
Prelude> bar
(doesn't halt)
and also a strict language like Scala.
scala> def foo = {tuple:(Int, Int) => (1, tuple._1)}
foo: ((Int, Int)) => (Int, Int)
scala> def bar: (Int, Int) = foo(bar)
bar: (Int, Int)
scala> bar
java.lang.StackOverflowError
at $anonfun$foo$1.<init>(<console>:7)
at .foo(<console>:7)
at .bar(<console>:11)
at .bar(<console>:11)
...
Maybe I'm missing something subtle about the difference between the two. Or
maybe there's another example that better illustrates your point?
I'm seeing a number of discussion points here between laziness and strictness:
- true limitations of performance
- ease of reasoning about performance
- ease of reasoning about halting
- ease of reasoning about space leaks
- stylistic preferences
-Sukant
At home and a little restless, so I thought I'd play around a little more with
this simple example. By the way, my Haskell is pretty weak, so someone who
knows more, please step in and let me know if I'm convincing myself of a
non-truth.
Here's a variant of the example in a properly compiled Haskell program (just in
case GHCi injects some unconventional behavior):
foo :: (Int, Int) -> (Int, Int)
foo (x, y) = (1, 2)
bar :: (Int, Int)
bar = foo bar
main :: IO ()
main = do print "this will print"
_ <- return $ fst bar
print "this will print"
x <- return $ fst bar
print "this will print"
print x
print "but this won't"
What I've done is even less tricky than what you did before. Mathematically,
it should be clear that bar converges to (1, 2). But Haskell isn't that smart:
$ ./a.out
"this will print"
"this will print"
"this will print"
a.out: <<loop>>
The laziness averts a little disaster the first time around because we never
use the _ binding. But it ultimately isn't much different from a strict
version in Scala. Haskell has a little more clever detection of the loop at
runtime (doesn't actually do the infinite recurse), but otherwise, it's more or
less the same effect -- a nasty runtime error.
So if the endless regress is what you prefer, then I think Haskell is doing
more-or-less what you want/expect. I wonder if there's a way to disable the
loop detection. It would be interesting the see the convergence happen, even
if there's the risk of the CPU spinning if it doesn't.
> So what day are we meeting? I'd prefer not Friday night.
I think someone's waiting for someone to make a decision. I think I lobbied
against Monday, and you're not into Friday. The previous meetup was on
Saturday -- I'm guessing no one's a fan of that.
So that leaves Tuesday, Wednesday, or Thursday after work hours?
-Sukant
By the way, ASM (the mentorship group I work with) just met up at Cherrywood
Coffeeshop [1] on East 38th for our last meetup. I highly recommend that
place. Good food, good-enough coffee, several beer options (on tap, I think),
and plenty of seating, with a side room we might be able to reserve. It's kind
of central, near the Feista off I-35.
So here's a summary of the options I've heard mentioned thus far:
- Chance's office
- Cherrywood
- Genuine Joe's
- Monkey's Nest
- Spiderhouse
Personally, I'm fine with anything, but prefer Spiderhouse the least.
Spiderhouse is a great place socially, but the way they've laid out the tables,
chairs, and outlets isn't as conducive for breaking out a bunch of laptops or a
projector.
--
I'd be interested.
I'm more of a Clojure person, but I've done stuff in Haskell and Ocaml
and generally liked both of them.
--
Savanni
On Tue, 2011-07-12 at 05:27 -0700, Matt M wrote:
> Joel,
>
> Sounds good. I'm more on the Haskell side of things as well.
>
> Someone toss out a date and time. Next week?
>
> Matt
>
Next Monday around 7pm?
Monkey Nest Coffee?
I'll second this motion.
I would also like to second the suggestion of Cherrywood as the venue
to keep things moving forward.
(Though any of the other suggestions would be fine with me except Spiderhouse)
--
Sean
Awesome. Thanks for the clarification. I was playing around with that
example, trying to figure out why it didn't converge when I thought that
Haskell was capable of more.
> Try to imagine stepping through 'foo' in a debugger. What value does 'p'
> have when you first enter 'foo'?
This is a very interesting statement. Most debuggers have a lot to do with
exposing the state of the system. When I last played around with Hat, I was
kind of blown away, because I wasn't really ready for a debugger that was like
that. It was useful. . . but it got me thinking that when the functional style
is taken to an extreme, we may find that we get more understanding from tests
than from debugging. When I did the work I was alluding to earlier using
Functional Java, I definitely felt this way. Debugging was far more tedious,
because a lot of the execution was delayed and control was shuttling around
between tiny functions (anonymous classes in Java) a lot.
I wonder if the larger Haskell community feels this way -- that because pure
functions are often nicely decoupled and easy to compose, setting up unit tests
is pretty trivial and easy (or playing around in a REPL) to the point that
diving into a debugger isn't as common of an exercise. And I guess with pure
functions, it's a lot easier to do both instance-based testing and
property-based testing.
By the way, here's my short list of things I'm interested in that I haven't dug
deep enough into:
- More deeply understanding how monads generalize to applicative functors.
I understand loosely that it's all about "join," which you lose with
applicatives. There's the whole "monads don't compose, but applicatives
do" thing, but I'd like to see more practical observations in the
discussion. I know LYAH has some wonderful chapters on the topic; I need
to read them again (I'm dense and sometimes it takes a second reading for
things to really sink in).
- The parallel Haskell paper from Marlowe I mentioned before
- Edward Kmett has what appears to be a wonderful 5-part Vimeo [1] on
lenses that I'm interested in. I got through about half of it. I'm not
good about carving out time to watch videos. But having worked with
immutable data structures some, I feel it's important to have a stronger
arsenal of functions to manipulate them.
- On that note, I haven't gotten to Iteratees.
- Also, I haven't gotten to Arrows yet either.
- And on a practical note, I haven't really pushed myself to explore
testing with ScalaCheck or QuickCheck.
By the way, the last time we were meeting up, I mentioned that I really like
learning by staying in the REPL on a projector, and keeping to small
pedagogical examples. That's just how I learn well personally. I don't know
if that resonates with you guys as well. But I also like reading papers.
[1] http://www.youtube.com/watch?v=efv0SQNde5Q
-Sukant
I can make my projector available. I should be available next Thursday.
Whoever's doing the booking (I know I did it last time. . . but I'm
apprehensive to take it on again), I guess it might be good to see if there's a
wall we can project on. Genuine Joe's was /awesome/ in this regard. But I can
bring something ghetto like a whiteboard and an easel.
-Sukant
--
To keep costs down, I'd normally book it for an hour, with the possibility of
being kicked out by another group. I just lucked out that that happened pretty
rarely for the time I'd book the room. We can try that for next Thursday and
see how it goes.
-Sukant
I'm having a hard time keeping up with the discussion of time and
location. I hope to make the next meeting, once a final decision is
made I would appreciate someone sending out a notification email with
the details.
Thank you.
--
Donnie
Hi Matt
I'm a little busy so as you've already looked into it would you mind making the reservation?
Thanks
Joel