Thoughts on session format

8 views
Skip to first unread message

Julian Blake Kongslie

unread,
Nov 10, 2009, 2:48:30 AM11/10/09
to pdxfunc
Several of us were talking about the format of pdxfunc after this
session, and we came to the decision that slightly modifying it may make
a better group. Therefore, I propose:

Every session to begin with perhaps 2 or 3 short (5 minute)
introductions to some useful library available on Hackage (or, if
Haskell is not your language of choice, the equivalent for some other
functional language). These introductions are just to be of the format
"here is this thing, you can use it to do foo, here is a neat short
example".

The idea is that people can get exposure to libraries and styles of
functional programming they may not be used to or have seen before.

This also has the advantage of giving us something easy and quick to
chat about while stragglers are still filling in to the meeting, and
while equipment and such is being found and setup.

To this end, I'll offer right off the bat to do a 5-minute introduction
to Control.Monad.Random from the MonadRandom package on Hackage, a much
simpler way to generate random values in a monad than the "normal" way.

Thoughts? Comments? Is it a good idea?

--
-Julian Blake Kongslie
If this is a mailing list, please CC me on replies.

vim: set ft=text :

signature.asc

Igal Koshevoy

unread,
Nov 10, 2009, 5:10:07 AM11/10/09
to pdx...@googlegroups.com
Julian Blake Kongslie wrote:
> Several of us were talking about the format of pdxfunc after this
> session, and we came to the decision that slightly modifying it may make
> a better group. Therefore, I propose:
>
Excellent, thank you for discussing this and suggesting a improvement.
Just because meetings have run a certain way in the past does not mean
that's THE way they ought to be run, and I welcome discussions of how to
do things better and experiments to try. :)

> Every session to begin with perhaps 2 or 3 short (5 minute)
> introductions to some useful library available on Hackage (or, if
> Haskell is not your language of choice, the equivalent for some other
> functional language). These introductions are just to be of the format
> "here is this thing, you can use it to do foo, here is a neat short
> example".
>
> The idea is that people can get exposure to libraries and styles of
> functional programming they may not be used to or have seen before.

> [...]


> To this end, I'll offer right off the bat to do a 5-minute introduction
> to Control.Monad.Random from the MonadRandom package on Hackage, a much
> simpler way to generate random values in a monad than the "normal" way.

This is a good idea and I'd like us to try this, and thanks for
volunteering to do this. It'd be great if others can prepare such talks
for other libraries. I'll try to make a note of bugging folks a week in
advance about declaring interest in giving these mini talks. At pdxruby,
we've done more of these sorts of short talks introducing a library and
they have been very useful.

> This also has the advantage of giving us something easy and quick to
> chat about while stragglers are still filling in to the meeting, and
> while equipment and such is being found and setup.
>

I like the idea of having a warm-up activity for us to do as folks walk
in, but am not sure that I want to use these talks for it. I'd frankly
prefer these talks to be part of the core meeting and have them use the
projector to demo code.

For example, at pdxruby, we've allowed folks to use the pre-meeting time
to demo their apps and then Markus has been kicking off meetings by
presenting code puzzles on the whiteboard and moderating the group as
they try to solve them -- this has been a great way to fill the setup
time, while providing a fun and educational activity that can be easily
scaled to match the available time and gets people interacting. It'd be
great if we can come up with an activity that provides similar benefits,
and include these short talks in the core meeting.

Also, I'm sorry for how much time was spent at last night's meeting
getting things setup. This was the first time we'd used this new space
this way and this will run much more smoothly next time.

-igal

Travis Brooks

unread,
Nov 10, 2009, 5:37:35 AM11/10/09
to pdxfunc newsgroup
I talked to a couple people on the list at Bailey's and claimed c# could do a lazy "infinite" fibonacci sequence.  The linq functions in c# for the most part mirror the prelude in haskell, but there is no zipWith built in so fib can't be done quite as elegantly as haskell does it if you stick to just the built in functions.  Using just the built in functions here is a way:

public IEnumerable<int> Fib()
{
    yield return 0;
    yield return 1;
    IEnumerator<int> aNumerator = Fib().Tail().GetEnumerator();
    IEnumerator<int> bNumerator = Fib().GetEnumerator();
    while (aNumerator.MoveNext() && bNumerator.MoveNext())
    {
        yield return aNumerator.Current + bNumerator.Current;
    }
}

There are a few definitions of fib, this one follows this test:

[Test]
public void fibTest()
{
    var fibs = Fib().Take(12).ToArray();
    var expected = new [] { 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 }; //etc
    Assert.AreEqual(expected, fibs);
}

-travis

Matt Youell

unread,
Nov 10, 2009, 9:31:02 AM11/10/09
to pdxfunc
On Nov 10, 2:37 am, Travis Brooks <travis_bro...@hotmail.com> wrote:
> I talked to a couple people on the list at Bailey's and claimed c# could do a lazy "infinite" fibonacci sequence. The linq functions in c# for the most part mirror the prelude in haskell

Cool example Travis. I like Linq a lot, although switching between
Haskell and Linq gets kind of depressing in notation/syntax alone. :)

I hit a snag though. I had to change this:

>     IEnumerator<int> aNumerator = Fib().Tail().GetEnumerator();

to this:

IEnumerator<int> aNumerator = Fib().Skip(1).GetEnumerator();

in order to compile and run. It works, but the docs don't make the
semantics clear. Is Skip(1) the way to Tail with LINQ? I wasn't
finding a Tail() method on IEnumerable.

http://msdn.microsoft.com/en-us/library/system.linq.enumerable.aspx


--
-/matt/-
http://youell.com/matt


Travis Brooks

unread,
Nov 10, 2009, 1:25:57 PM11/10/09
to pdxfunc newsgroup
d'oh!  I'd been using my version of Tail as an extension method for so long i forgot that it wasn't built in, if you add these methods IEnumerable will magically have Head and Tail functions...

public static T Head<T>(this IEnumerable<T> seq)
{
    return seq.First();
}

public static IEnumerable<T> Tail<T>(this IEnumerable<T> seq)
{
    return seq.Skip(1);
}

-travis

> Date: Tue, 10 Nov 2009 06:31:02 -0800
> Subject: [pdxfunc] Re: lazy fibonacci in c#
> From: softb...@gmail.com
> To: pdx...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages