Last night's SML code.

13 views
Skip to first unread message

ja...@ioctl.org

unread,
Feb 27, 2013, 4:12:01 AM2/27/13
to brisfun...@googlegroups.com
To summarise:

- cursor-based navigation
- we explicitly "freeze" the stack or path
(can use continuations to do this as an alternative)
- the result is fast local editing and structure sharing,
but it feels quite imperative, so pick problems to apply
this to carefully.

Here's the binary tree version from the talk:

https://gist.github.com/jan-g/e96b54456bf0f4a190bf

The order we wrote things in when we had a bash at a second tree (with a
list of child nodes) -

- defined the "location" as [left right cur path]
- wrote 'left' and 'right'
- wrote 'down' (we descended to the leftmost child and stored the previous
[left right] at the head of the new path)
- wrote 'up', 'top' and 'out'
- wrote something to produce a location from a tree
(our top/out would have been more convenient if this had been written
[left=nil right = nil cur=tree path=nil])
- wrote an update function


I think the remarkable thing about that second experience for me was that,
given a plan of attack, we could write the navigation functions really
simply without having to think _too_ hard about the problem as a whole.

Cheers,
jan

--
Leverage that synergy! Ooh yeah, looking good! Now stretch - and relax.

Joe Littlejohn

unread,
Feb 27, 2013, 5:31:27 AM2/27/13
to brisfun...@googlegroups.com

Thanks for a really informative and engaging evening Jan.

Here's the Clojure zipper:

https://gist.github.com/joelittlejohn/5042641

--
You received this message because you are subscribed to the Google Groups "BrisFunctional" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brisfunctiona...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Matthew Gilliard

unread,
Feb 27, 2013, 5:50:23 AM2/27/13
to BrisFunctional
Thanks guys.

  Next BF (our second birthday) will be in 4 weeks, on 2013-03-27.  We're looking for a theme for a dojo-style evening, perhaps something using some real dataset?  Or making a rouge-like?  Roman numeral parser?  or ___________ (insert your suggestion here).

  Also, thinking further ahead, we'd like to have more in-depth nights like last night's (excellent) zippers talk+hack.  I'd love to look at quick-check in more depth, and can prepare something for the April meetup - can we have more suggestions and topics for these nights as well, please?  Lets adopt an alternating dojo/talk 2-monthly schedule to put some structure into our third year:

March:  Dojo (TBD, suggestions please)
April: Talk/hack on QuickCheck
May: Dojo (keep those suggestions coming!)
June: Talk/hack on _______
etc etc

  Look forward to seeing you all (+ new faces too!)

Matthew

Matthew Gilliard

unread,
Feb 27, 2013, 8:52:13 AM2/27/13
to BrisFunctional
Sorry - should have said 2013-03-26 for the next one...  Tuesday as usual - 7pm start at Nokia HQ on Wine St.


ja...@ioctl.org

unread,
Feb 28, 2013, 10:07:24 AM2/28/13
to BrisFunctional
On Wed, 27 Feb 2013, Matthew Gilliard wrote:

> Thanks guys.
>
> Next BF (our second birthday) will be in 4 weeks, on 2013-03-27. We're
> looking for a theme for a dojo-style evening, perhaps something using some
> real dataset? Or making a rouge-like? Roman numeral parser? or
> ___________ (insert your suggestion here).
>
> Also, thinking further ahead, we'd like to have more in-depth nights like
> last night's (excellent) zippers talk+hack. I'd love to look at
> quick-check in more depth, and can prepare something for the April meetup -
> can we have more suggestions and topics for these nights as well, please?
> Lets adopt an alternating dojo/talk 2-monthly schedule to put some
> structure into our third year:
>
> March: Dojo (TBD, suggestions please)
> April: Talk/hack on QuickCheck
> May: Dojo (keep those suggestions coming!)
> June: Talk/hack on _______
> etc etc
>
> Look forward to seeing you all (+ new faces too!)


Although I'm very interested in _applying_ FP, I keep on getting
side-tracked by the low-level stuff. So I can offer similar 30-45-minute
whistle-stop talks (with code!), in particular if any of these grab your
fancy -

- other functional data structures (if you wondered where things like
persistent queues come from; although unless your language has an
impoverished set of stock libraries* you can probably just import these
and use 'em without thinking about it much)

- parser combinators (in anger) - note, I'm still not sure that the way
I've decomposed the functionality in my toy ML compiler is actually the
best approach, so this one might want to wait a few months

- I'm happy to have my own attempt at explaining monads (using one I built
for examining a randomised algorithm), but bear in mind what Doug
Crockford says about that**

* I'm using SML at the mo
** "Monads are cursed: once you understand them, you immediately lose the
ability to explain them to others"


I think the harder question is about Dojoing, particularly if someone's
going to lead a more in-depth evening's hacking - there is up-front work
to produce something achievable in an evening, which we might have to
thrash out on the mailing list beforehand.

--
jan grant http://ioctl.org/jan/
Every program is a part of some other program and rarely fits.
Reply all
Reply to author
Forward
0 new messages