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);| #!/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: |
| 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 |
| 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 | |
| ---------------------- |
| // 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 |
| #!/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 |
| 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 |
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);| #include <netdb.h> | |
| #include <sys/socket.h> | |
| #include <unistd.h> | |
| #include <algorithm> | |
| #include <cerrno> | |
| #include <cstring> | |
| #include <iostream> | |
| #include <sstream> | |
| #include <string> | |
| #include <string_view> |
| import urllib.error | |
| import urllib.parse | |
| import urllib.request | |
| SMILES_URL_TEMPLATE = 'http://cactus.nci.nih.gov/chemical/structure/{}/smiles' | |
| IUPAC_URL_TEMPLATE = 'http://cactus.nci.nih.gov/chemical/structure/{}/iupac_name' | |
| def retrieve(url): | |
| with urllib.request.urlopen(url) as f: | |
| return f.read() |
| { config, lib, pkgs, ... }: | |
| with lib; | |
| let | |
| kibanaPort = 5601; | |
| netdataPort = 19999; | |
| oauthProxyPort = 4180; | |
| innerNginxPort = 8080; | |
| in |