Elektrine
EN
Log in Register
Paige Chat Timeline Communities Gallery Videos Email DNS VPN Uptime Kairo
Back to Timeline
Remote

Jeremy Gibbons

@jer_gib@functional.cafe
  • Open on functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib@types.pl.

878 Followers
135 Following
30 Posts
Joined August 08, 2023
Web:
https://www.cs.ox.ac.uk/people/jeremy.gibbons/
Twitter:
@jer_gib
Blog:
https://patternsinfp.wordpress.com/
Youtube:
https://www.youtube.com/playlist?list=PLqFG9BDHUhiA1k3YXFb9U8HktruQ1tG97

Posts

Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · Jun 29, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @jer_gib@functional.cafe
I should declare that the cover image is my mockup, using "Kekub" by Victor Vasarely: https://en.vasarely.hu/artworks/15371/
4
0
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · Jun 28, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @jaror@social.edu.nl
@jaror@social.edu.nl These are excellent questions! To which I don't really have a good answer. I do think the theory is well enough developed for this kind of application. I think sudoku has been well covered, in particular by Richard Bird. I actually have no experience in writing things like web servers: I couldn't take that approach with confidence without a lot of preparation. Someone else will have to write the different book you have in mind.
2
0
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · Jun 27, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @jer_gib@functional.cafe
RE: https://functional.cafe/@jer_gib/116817784747796292 Now also mentioned on my blog, with a link to a provisional table of contents: https://patternsinfp.wordpress.com/2026/06/27/progress-on-the-book/
Quoting
Jeremy Gibbons @jer_gib@functional.cafe
Sent off to the publisher today. At last! Still got the index, the solutions to exercises, and a proofread to go. But the end is in sight.
Open quoted post
27
2
12
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · Jun 26, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Sent off to the publisher today. At last! Still got the index, the solutions to exercises, and a proofread to go. But the end is in sight.
179
13
65
1
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · May 12, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @jer_gib@functional.cafe
@oantolin@mathstodon.xyz I believe you are right to be suspicious. And it's not because it has to extract the last element each time (so I don't think arrays would help). Consider a "triangular" partition such as 10=4+3+2+1. My program splits off a unit-width rectangle at each step, so assembles the conjugate partition (which happens to be the same) one by one. @byorgey@mathstodon.xyz @das_g@chaos.social
0
0
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · May 11, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @oantolin@mathstodon.xyz
@oantolin@mathstodon.xyz @byorgey@mathstodon.xyz @das_g@chaos.social I didn't think about it very carefully... will have to ponder further.
0
1
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · May 11, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @jer_gib@functional.cafe

@byorgey@mathstodon.xyz @oantolin@mathstodon.xyz @das_g@chaos.social In fact, this recursion is a concat after an unfold. So it's also a list futumorphism:

futu :: (b -> Maybe ([a],b)) -> b -> [a]
futu g z = case g z of
  Nothing       -> []
  Just (ys, z') -> ys ++ futu g z'

(Not stated is the requirement that the generated chunk ys should be nonempty, in order to guarantee progress. Alternatively one can make the body return Maybe (a,[a],b), enforcing the requirement structurally.) Then we have:

conjugate :: [Int] -> [Int]
conjugate = futu strip where
  strip [] = Nothing
  strip ns = Just (replicate m (length ns), takeWhile (>0) [ n - m | n <- ns ])
    where m = minimum ns
2
1
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · May 11, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @jer_gib@functional.cafe

@byorgey@mathstodon.xyz @oantolin@mathstodon.xyz @das_g@chaos.social This still takes time proportional to the sum of the partition, because we're only stripping off 1 at a time. You can improve that by stripping off minimum ns in one go:

conjugate :: [Int] -> [Int]
conjugate [] = []
conjugate ns = replicate m (length ns) ++ conjugate (takeWhile (>0) [ n - m | n <- ns ])
    where m = minimum ns

We are effectively snipping off the largest leftmost rectangle from the Ferrers diagram, rather than a single column. I would guess that this achieves the desired complexity.

1
5
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · May 11, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @byorgey@mathstodon.xyz

@byorgey@mathstodon.xyz @oantolin@mathstodon.xyz @das_g@chaos.social Here's another go, I think getting to your desired running time of O(length p + maximum p). Start off by observing that it's an unfold:

conjugate :: [Int] -> [Int]
conjugate = unfoldr strip where
  strip [] = Nothing
  strip ns = Just (length ns, takeWhile (>0) [ n - 1 | n <- ns ])

This assumes that the input is a non-increasing list of positive naturals, and returns a result similarly.

0
6
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · May 11, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @ltchen@mathstodon.xyz
@ltchen@mathstodon.xyz "Some textbooks include selected solutions to exercises, but does it make solving those exercises fruitless? Certainly not." I'm going to remember that line!
7
0
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · May 11, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @jer_gib@functional.cafe

@byorgey@mathstodon.xyz I guess lzw3 is the more natural one. Given

data OneOrBoth a b = This a | That b | Those a b

then it is equivalently

lzw3 :: (OneOrBoth a b -> c) -> [a] -> [b] -> [c]
1
0
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · May 11, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @jer_gib@functional.cafe

@byorgey@mathstodon.xyz I'm in two minds about whether I prefer lzw2 above or lzw3 below:

lzw3 :: (a->b->c) -> (b->c) -> (a->c) -> [a] -> [b] -> [c]
lzw3 f g h (x:xs) (y:ys) = f x y : lzw3 f g h xs ys
lzw3 f g h xs []         = map h xs
lzw3 f g h [] ys         = map g ys

lzw3 is more general (you can implement lzw2 using it, and I think not vice versa), but at least in this case a bit clunkier to use:

conjugate' :: [Int] -> [Int]
conjugate' = foldr incr []
  where incr n ms = lzw3 ($) id ($0) (replicate n succ) ms
0
1
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · May 11, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @jer_gib@functional.cafe

@byorgey@mathstodon.xyz For this you want the heterogeneous big brother of lzw:

lzw2 :: (a->b->c) -> a -> b -> [a] -> [b] -> [c]
lzw2 f u v (x:xs) (y:ys) = f x y : lzw2 f u v xs ys
lzw2 f u v xs []         = [ f x v | x <- xs ]
lzw2 f u v [] ys         = [ f u y | y <- ys ]

then you can write

conjugate' :: [Int] -> [Int]
conjugate' = foldr incr []
  where incr n ms = lzw2 ($) id 0 (replicate n succ) ms
1
2
1
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · May 11, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @jer_gib@functional.cafe

@byorgey@mathstodon.xyz There should also be a way to write that using replicate n succ directly, but now I have to rush off and do something less interesting.

0
3
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · May 11, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @jer_gib@functional.cafe

@byorgey@mathstodon.xyz Given lzw, I think you have

conjugate :: [Int] -> [Int]
conjugate = foldr incr []
  where incr n ms = lzw (+) (replicate n 1) ms
2
4
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · May 11, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @jer_gib@functional.cafe

@byorgey@mathstodon.xyz What's more, lzw is another unfold. To be more precise, uncurry (lzw f) is an instance of unfoldr.

1
5
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · May 11, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @jer_gib@functional.cafe

@byorgey@mathstodon.xyz Like this:

transpose :: [[a]] -> [[a]]
transpose = unfoldr next where
  next xss = case takeWhile (not . null) xss of
    [] ->  Nothing
    yss -> Just (map head yss, map tail yss)
1
0
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · May 11, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @jer_gib@functional.cafe

@byorgey@mathstodon.xyz Your way is a fold. There's also (of course!) an unfold:

transpose :: [[a]] -> [[a]]
transpose = unfoldr next where
  next xss
    | any null xss = Nothing
    | otherwise    = Just (map head xss, map tail xss)

That works for rectangular arrays. Coping also with upper left triangular ones needs a bit more work.

2
7
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · May 11, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @byorgey@mathstodon.xyz

@byorgey@mathstodon.xyz I call that operator "long zip with", or lzw for short. It's in my Underappreciated Unfold paper (1998), but also in my dissertation (1991).

4
8
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · May 10, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @mjd@mathstodon.xyz
@mjd@mathstodon.xyz @byorgey@mathstodon.xyz Thanks - I'll have to meditate on that!
1
10
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · May 10, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @byorgey@mathstodon.xyz
@byorgey@mathstodon.xyz What's the conjugate of an integer partition?
0
12
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · May 09, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @mc@mathstodon.xyz
@mc@mathstodon.xyz I wouldn't count it an additional "contribution". It's one aspect of validation of the contribution. If the formalization does not itself introduce new techniques or insights, it's comparable to some performance evaluation or user acceptance testing.
1
0
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · May 04, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe

@pigworker@types.pl You'll enjoy this month's Guardian Genius crossword

1
0
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · May 01, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @pigworker@types.pl
@pigworker @MartinEscardo @jonmsterling ...and Simon Thompson
2
0
1
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · Apr 25, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @jer_gib@functional.cafe
@lindsey Perhaps it is productive to take an event-based as opposed to state-based perspective?
0
4
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · Apr 25, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @lindsey@recurse.social
@lindsey Point taken about "entire state". As for termination, I was fumbling towards the characteristic of eventual consistency: were there to be no further updates, eventually the replicas will catch up.
0
5
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · Apr 24, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @lindsey@recurse.social
@lindsey Without having seen your definitions, wouldn't something like "eventually captures the entire state" be a necessary part of correctness?
0
10
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · Apr 23, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @jonmsterling@mathstodon.xyz
@jonmsterling Surely you need some qualifier such as "comfortably" in the conclusion? Many (perhaps most) people are living close to the edge, and can afford to pay one electricity bill or buy one new pair of kid's shoes but not two. They can afford it, but not comfortably.
0
2
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · Apr 02, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @liamoc@types.pl
@liamoc Not just programming. We give students writing exercises to help them learn to write. If they appeal to a machine as soon as it gets tricky, they'll never learn to do it themselves. Similarly for going to the gym.
8
0
0
0
Open post
jer_gib
Jeremy Gibbons @jer_gib@functional.cafe · Mar 16, 2026
Jeremy Gibbons
@jer_gib@functional.cafe

Professor of Computing at University of Oxford: functional programming, types, program construction, verification. Formerly @jer_gib.

functional.cafe
Replying to @jfdm@discuss.systems
@jfdm Presumably both anglophone?
0
2
0
0

Remote instance

functional.cafe
Open on original server

Media

313k7r1n3
Elektrine

Tor hidden service

elekhj7afj4qnrr4yd3bkzslsyo5jgfxw3orgjkhlcxifueodybyiiad.onion

Platform

  • Email
  • Chat
  • Timeline
  • Communities
  • VPN
  • DNS

Company

  • About
  • Contact
  • FAQ

Legal

  • Terms of Service
  • Privacy Policy
  • Warrant Canary
  • Lite (no JS)
  • VPN Policy
  • Source code

Support

  • support@elektrine.com
  • Report Security Issue
Mail client setup IMAP mail.elektrine.com:993 POP3 mail.elektrine.com:995 SMTP mail.elektrine.com:465
© 2026 Elektrine. All rights reserved. Server: 14:03:22 UTC