Jeremy Singer

Jeremy Singer

I am a lecturer in Computing Science at the University of Glasgow. I am moderately fluent in the following languages: Haskell, Java, C, Scouse and New Testament Greek.


Location Glasgow, Scotland


  • This is a scheduled activity, since there are distinct phases.
    Phase 1 is ‘write and upload your own code’ - this phase ends on 25 October 2022
    Phase 2 is ‘come back and look at other people’s code’ - this phase runs 25 Oct - 30 Nov 2022.
    After that, this exercise step will be closed.

  • now fixed … my fault - sorry everyone

  • fixed … apologies for this bug

  • that’s a bit annoying … I think the dataset is the same as

  • hi @JulietChristopher you are very good at finding bugs! I hope this scipy problem is fixed now - please try again if you like…

  • hi @GarrettOHanlon this sounds great. Feel free to drop me a line on email if you want any help or advice!

  • you could use Jupyter notebooks - check out the link above for how to install Jupyter. Then you can download the notebooks in each exercise step.

  • hi @JulietChristopher I am very sorry - you are finding all the bugs in our course! Please try again - it should be fixed up now. Thanks for alerting me to the problem.

  • e.g. do richer households live in more urbanised areas?

  • hi @ShonaMcAlpine I confirm the graph you report is correct. Can you think of any reasons why this is not what we might expect?

  • it sounds like you were mildly adventurous :-)

    I agree with you that minor syntax errors (misspelling -> doom) are very annoying. There are block-based languages (like Scratch) that do data analytics … these might be more convenient for school-age learners since they also run in browsers and they remove some of the syntax error risk.

  • should all be fixed now - sorry about this hiccup

  • sorry @JulietChristopher please try this practical activity again

  • sorry @NikeLo I think it is fixed now

  • please try again

  • @LucaCampobasso it is now! Sorry for delay. The way this works is in two phases: first phase - you submit some code. 2nd phase - you review other people's submissions.

  • hi @EvgenyLeviant this activity is time-dependent (I know, a bit messy in a MOOC ... sorry). It will 'go live' next week.

  • oh dear ... sorry to hear about this problem. Which browser and OS are you using?

  • @IacopoMeladoro

    > nice if Markdown were enabled for comments

    I fully agree. Please submit this feature request at

  • hi @ChloeLewis precedence rules often make brackets unnecessary, but many people don't carry round the precedence table in their heads ... see table in so maybe brackets are helpful. $ is a Haskell-specific thing ... can reduce ()s but only makes sense to people familiar with Haskell -...

  • I think the Haskell syntax is more concise, which might make it quicker to write sequences of code. But developers must bear in mind the need for code readability.

  • @FleurHardman well done for being persistent. I am guessing you have done the appropriate initialization code:

    import pandas as pd
    sunshine = pd.read_csv('sunshinehours.csv')

    Then you can extract the Year and WIN columns with something like:


    Note the double square brackets - we are supplying a list of interesting...

  • @FleurHardman sorry - the constraints of our system have limited your data analysis :-(

  • hi @FleurHardman if you stick with our online Python environment then you can only use the hardcoded data sets. However if you are feeling adventurous then download the Notebook ipynb file (see first attachment above) and then load it at

  • this looks like a fantastic resource! I just generated a sample dataset - the questions are brilliant - ideal for high school engagement.

  • love this idea!

  • yes the NumPy and Pandas libraries in Python are fairly similar to the R style of programming

  • hi @MrEvans great to hear about NPA Data Science takeup. Peter and I played a (small) part in the curriculum scoping of this award - hopefully it's a nice engaging set of learning activities with valuable outcomes.

  • and do you think they would be suitable for school-age learners in your educational setting?

  • good - this is exactly the kind of graph you might see in Strava or other sports/fitness apps. Probably with week number on x axis, distance on y axis. Because the data is a time series, a line graph might also be appropriate.

  • thanks! you have uncovered a bug in the exercise ... I have fixed it now :-)

  • thanks for this detailed and engaging description of a practical classroom activity

  • thanks @RosemaryMcGuinness pandas is a common library used in the 'real world' by professional data scientists so it is good to get an insight into how it works ... e.g. see

  • hi @kelvinGokumkitgak it should work ok on phones - what problem are you seeing with the code?

  • I strongly endorse this ambition of yours to introduce data science in schools across Scotland. Feel free to get in touch (via email?) if we can support you at the University of Glasgow

  • classical languages! You should get on just fine!

  • @NicolaTrafford hi and thanks for getting involved! I hope the coding exercises work ok on iPad devices. Note that there are simpler, more graphical data science tools suitable for primary age learners

  • hi @FavourNnagbo please can you be more specific? We want to help you, if we can understand the problem.

  • do feel free to change the code! You can always click the 'reset' button to put it back to the original code.

  • hi @JessicaGalliver please can you try again - sorry for earlier problem

  • hi @MaryMora this sounds interesting. Do you have links to any more info?

  • hi @MarcRodriguez 'import qualified' allows you to use names from the module, but you need to refer to them with their fully qualified name (including the module prefix). Sometimes this helps if there are name clashes. See the very complicated table at for full details :-)

  • @AlastairLeith sorry to hear this. I guess brew doesn't work for M1 mac yet either?

  • hi @BurakUslu you might need to install the random library - are you using Stack?

  • SimonPJ mentioned that Excel is his 'second favourite programming language.' More info in a recent Microsoft podcast at really interesting stuff!

  • @JW this is an interesting question. the problem is that `div` produces integer results whereas `/` expects floating-point inputs. You need to do an explicit conversion between them like this ...

    ( (/10) . fromIntegral . (`div` 10) )

  • @TomNiesytto
    > GHCi expects 3 spaces
    this is because the putStrLn should line up with the getLine, which is 3 chars in (after do plus single space char)

  • aha - some unicode space chars do work ...
        this line is indented with 4x 1em spaces U+2003

  • oh dear, the non-breaking space doesn't work either!!!
                 how annoying!

  • @TomNiesytto yes, please make a feature suggestion to FutureLearn for source code markup support in comments - email them at

    for now, the workarounds are:
    1) to post code on github gist and put a link in the comment
    or (2) use non-breaking space char U+00A0

  • hi @TomNiesytto try

    $ sudo apt-install haskell-stack

    and see how you get on...

  • hi @BurakUslu I think you want to run `ghci` for the interactive interpreter, rather than `ghc` for the ahead-of-time compiler.

  • hi @BurakUslu `load` is not a Haskell function, instead it is a GHCi command so you need to put a ':' in front - i.e.

    :load factorial.hs

    Does that work?

  • hi @RichManderino I contacted Graham and he sent me this link, to use directly for a discounted price -

  • aargh, FutureLearn comments don't allow leading spaces in comments :-( my putStrLn should have spaces in front of it! sorry.

  • Did you set multi-line support for GHCi with
    :set +m

    If you did this, then did you indent the putStrLn line with spaces so it is lined up 'inside' the do block?
    do x<- getLine
    putStrLn ("hello " ++ x)

  • *sigh* it could (and probably should) have been :-)

  • the problem is that `-` gets parsed in different ways. Sometimes it means unary `negate` but other times it means binary `subtract`. See for more details.

  • hi @MarcRodriguez the keyword is typeclasses - we will cover these later on in the course :-)

  • hi @AlastairLeith the :doc GHCi command was added in version 8.6 - which ghci --version are you running?

  • hi @RichManderino Sorry about this, I will get in touch with Graham Hutton and see if we can fix this problem.

  • hi @BurakUslu you need to explicitly import the sort function, it's in the Data.List module.

    In your ghci prompt, type

    ghci> import Data.List (sort)

    then you should be able to use the sort function, e.g.

    ghci> sort "hello world"
    --> " dehllloorw"

  • great question! you can use the ghci terminal to discover some info - if you know the fully qualified name of a function, you can ask for :info, e.g.

    ghci> :info Data.String.words

    For more detail about a function, try using the :doc command instead.

    ghci> :doc Data.String.words

    Online, you can look up documentation at

  • hi @GarethErskine-Jones if you access or directly then `n=1` won't work. We hacked the JavaScript in our embedded tutorials to allow name-binding with `=`.

    In general, you can use names in expressions with a `let ... in ...` block like:

    let n=1 in n+n

    On the other hand, if `n=1` doesn't work in the...

  • at step 16 for I can advance to the next step by typing in

    min (max 3 4) 5

    What happens if you type this in?

  • hi @PatrickRamsammy sorry to hear about this issue - I'll look into it right away.

  • nice! thanks for sharing! To all learners - please feel free to share your code via github gist or similar sites.

  • skip ahead to week 5 if you like ... ... although for more in-depth detail you will need to look beyond this course.

  • Jeremy Singer replied to [Learner left FutureLearn]

    @DarcyHarding not at all - we really appreciate your input!

  • hi @BennyPowers I guess this section is just giving a flavour of Haskell syntax and semantics. We'll dive into more detail for particular language elements in later parts of the course.

    I acknowledge your issue with the transcript. The text of the transcript only captures what Wim actually says - and he writes down the Perl code snippet without saying it...

  • Jeremy Singer replied to [Learner left FutureLearn]

    hello @YeuChaiGwee - in theory, any Turing-powerful language is able to express any computable program. I guess the difference comes with the elegance of the language in terms of its expressivity. As you go through the course, I encourage you to spend some time thinking about similarities and differences between Haskell and more mainstream languages.

  • hi @RobertKafka so sorry for the issues with the interactive exercises. Everything should be working again now - thanks for alerting us to the problem.

  • hi @LanceHolland sorry the external web server was down - please try again. Apologies for inconvenience

  • fixed - sorry you had this problem

  • sincere apologies - it is working again now after a server reboot. Thanks for your patience - I hope you can try this again.

  • dear learners, please accept my apologies - I was unaware that this exercise was 'broken' - I have now fixed it so it should be working properly in your browsers. Please test it and get back to me if there are any issues. Sorry for the inconvenience.

  • fantastic! I think Arm code generation for Haskell is not as good as for Intel, but I'm really glad to hear it is working! Good for you!

  • @MatiasLopez looks good - remember space indents inside do block in main - but FutureLearn comments format might take these out :-)

    Not sure you need a show inside a print - print should invoke show itself -

  • sure, good point. I guess we elide types for tiny helper functions like inc, but specify types as documentation for more involved functions.

    properly, we could say:
    let inc = (1+)::Num a=>a->a
    in ...

  • @PaulFoster oh dear, that sounds suspicious. Disclaimer - I am not a Windows user... can you delete the following directories: c:\ghc and C:\ProgramData\chocolatey\lib\ghc to remove GHC from your system?

  • hi @JulianOng thanks for your question. I guess the issue is - how do you represent an empty Tree if Leaves have values? You would need a third value then, called Empty - but then there are multiple and inconsistent ways to have one-element trees :-)

  • did you follow instructions at ?

  • ... and how did you get on with Atom and Haskell @HelenaB ?

  • thanks @EwanSpence this is an exact analogy!

  • > online exercise environment isn't very practical
    > when defining recursive functions

    agreed, GHCi is the preferred (and easier) option from now on with this course.

    There are online Haskell evaluators that allow multi-line definitions - e.g. - have you seen this?

  • yes, good idea - we are starting to outgrow the interactive repl now...

  • hi @SophieF maybe something like:

    mylen lst = if lst == [] then 0 else let (x:xs) = lst in 1 + mylen xs

    but this is quite ugly :-)

    Alternatively you could use a fold function, have you seen these list reduction operations yet?

    mylen lst = foldl (\x y -> x+1) 0 lst

  • hi @MichaelTunstall I guess this section is trying to show that Haskell function definitions _are_ mathematically valid. At the same time, please be assured that a degree in Maths is _not_ essential for a Haskell coder (no, I don't have a Maths degree either :-)

  • So far (11 October) 50 people have submitted code for this exercise. Keep on going folks :-)
    Next week, please revisit the exercise when you can review other learners' code in the interactive tool. Thank you.

  • @DimaKurilo to quote the developer ... "That's the quick and dirty fix in" - hopefully it should work for Chrome users now

  • > We'll fix the type-setting issue

    This was a MathJax problem - I replaced -> with \to
    which looks nicer, but might be less copy-and-pasteable

  • yes, so I would pronounce x' as "x prime" - if I wanted to be mathematical :-)

  • grrr, sorry to hear this folks. I will report it to the developer right away.

  • I have a theory that he might own several identical jumpers, but I have not confirmed this with him directly :-)

  • typo fixed - thanks for spotting this!

  • hi @PaulA thanks for your enthusiasm. I was asleep when you started refreshing the exercise page at the beginning of week 3. Please try again now - hopefully everything is configured ok :-)

  • @RolfSpeer @YeongShengTan sorry for delay - please submit your code now! Thanks for being patient :-)