Skip to content

Instantly share code, notes, and snippets.

@sebfisch
sebfisch / AoC2021Day01Roc.md
Last active December 8, 2021 22:12
Advent of Code 2021, Day 1 in Roc
app "AoC2021Day01"
    packages { base: "hello-world-platform" }
    imports []
    provides [ main ] to base

main : Str
main =
    largeInput
        |> windowsOf 3
@sebfisch
sebfisch / exploring-function-calls-in-roc.md
Last active November 26, 2021 11:03
Exploring function calls in Roc

Exploring function calls in Roc

This is a systematic in-depth exploration of different ways of calling functions in Roc.

Lambda expressions and function calls

In Roc, functions are values that are defined using lambda-expressions. Here are two single-argument functions on integers, one that increments a given number and another that doubles it.

inc : I64 -> I64
@sebfisch
sebfisch / jobs.markdown
Last active August 29, 2015 14:14
Implementation of the Jobs Puzzle in Curry

Implementation of the Jobs Puzzle in Curry

by Sebastian Fischer, January 2015

Verbal problem description

There are four people: Roberta, Thelma, Steve, and Pete.

@sebfisch
sebfisch / rubykara-kiel.txt
Last active December 14, 2015 20:19
Hilfsprogramm zur Vereinfachung und Erweiterung von Ruby Kara: http://www.swisseduc.ch/informatik/karatojava/rubykara/
Die RubyKara Erweiterung aus Kiel gibt es jetzt hier: https://github.com/sebfisch/rubykara-kiel
@sebfisch
sebfisch / DarcsDialog.markdown
Last active December 14, 2015 19:29
A dialog on how to manage patches with Darcs.

A Dialog on How to Manage Patches with Darcs

Fred: So, you know Darcs?

Lisa: Sure.

Fred: I heard it is quite flexible in managing patches. Wanna show me?

Lisa: Ok, let's make a new repository for some imaginary project.

@sebfisch
sebfisch / Mappers.hs
Last active December 14, 2015 08:48
{-
A German blog post translating Java code for the build tool Ant to Scala
http://funktionale-programmierung.de/2013/02/26/scala-java-ant.html
made me translate the Scala code to Haskell. I added combinators for binary
composition of mappers as well as a unit mapper for one of them. The code is
still shorter. I find the Haskell version more readable because expressions
and their types are separate rather than interleaved as in Scala.
@sebfisch
sebfisch / gist:3757918
Created September 20, 2012 19:43
Comparing Snap's and Yesod's Template Languages Heist and Hamlet

Comparing Snap's and Yesod's Template Languages Heist and Hamlet - and HSP

Currently, Snap and Yesod are the two most active web frameworks for Haskell. In this document, I compare the template languages used by those frameworks for generating HTML.

Both template languages let programmers write markup directly in a markup language rather than generating it from within Haskell. Compared with static HMTL, template languages support substitution to dynamically determine parts of the content of the generated page.

[Heist] and [Hamlet] support different constructs to generate content dynamically. They also differ regarding their syntax for static content.

@sebfisch
sebfisch / replace-classes-in-apk.sh
Created May 22, 2012 08:58
Replaces classes in Android Package Files
#!/bin/bash
# Replaces classes in Android Package Files
# (c) Sebastian Fischer, CC-BY
# Can be used to rebuild an App with a modified version of a used library,
# as required for closed works that link to an LGPL library.
# Depends on: https://code.google.com/p/dex2jar/
@sebfisch
sebfisch / gist:2235780
Created March 29, 2012 10:47
Laymans explanation of delimited continuations with examples of using them for exception handling and nondeterministic programming.

Delimited Continuations

Delimited continuations manipulate the control flow of programs. Similar to control structures like conditionals or loops they allow to deviate from a sequential flow of control.

We use exception handling as another example for control flow manipulation and later show how to implement it using delimited continuations. Finally, we show that nondeterminism can also be expressed using delimited continuations.

Exception Handling

@sebfisch
sebfisch / ListTransformer.hs
Created December 26, 2011 15:50
Lazy functions on lists with parallel and sequential composition using standard type classes.
module ListTransformer where
import Control.Applicative
import Control.Arrow
import Control.Category
import Prelude hiding ( id, (.) )
data ListConsumer a b
= Done b