Consider the following two Standard ML functions for computing the sum of a list of integers:
fun nsum n =
if n=0 then 0
else n + nsum (n-1);
fun summing (n,total) =
if n=0 then total
else summing (n-1, n + total);Consider the following two Standard ML functions for computing the sum of a list of integers:
fun nsum n =
if n=0 then 0
else n + nsum (n-1);
fun summing (n,total) =
if n=0 then total
else summing (n-1, n + total);| module BasicGates where | |
| open import Level | |
| open import Algebra.FunctionProperties.Core using (Op₁; Op₂) | |
| import Data.Bool as B | |
| open B using (Bool; true; false) | |
| open import Data.Product using (_×_) | |
| open import Data.String |
| #!/usr/bin/env python | |
| from bs4 import BeautifulSoup | |
| from pocket import Pocket | |
| import requests | |
| from urllib.parse import urljoin | |
| consumer_key = '44711-81de59a4a614b97a4b76dc9a' | |
| access_token = 'XXX' # put your access token here |
| // scramble.cc | |
| // Leonhard Markert | |
| // | |
| // This program finds words in a character matrix. The words are read from a | |
| // `dictionary` file and the character matrix from a `scramble` file. | |
| // | |
| // Compile with | |
| // $ clang++ -std=c++11 -DNDEBUG -O3 -Wall -W -Werror -o scramble scramble.cc | |
| // | |
| // Run as |
| Haskell L1 Interpreter | |
| ====================== | |
| This is a simple interpreter for L1, with two little twists: It uses | |
| monad transformers to represent state and erroneous computations, and | |
| generalised algebraic datatypes (GADTs) for implicit type checking. | |
| Extensions and Imports | |
| ---------------------- |
| type atom = char | |
| type interpretation = atom -> bool | |
| datatype literal = Yes of atom | No of atom | |
| datatype proposition = Literal of literal | |
| | Not of proposition | |
| | And of proposition * proposition | |
| | Or of proposition * proposition |
| #!/bin/bash | |
| # Copyright (c) 2011 Josh Schreuder | |
| # http://www.postteenageliving.com | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy | |
| # of this software and associated documentation files (the "Software"), to deal | |
| # in the Software without restriction, including without limitation the rights | |
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| # copies of the Software, and to permit persons to whom the Software is | |
| # furnished to do so, subject to the following conditions: |