This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
betaC(L, R) :- var(L), !, L=R. | |
betaC(app(X, Y), R) :- !, betaC(X, XX), betaC(Y, YY), app(XX,YY,R). | |
/* for head normal form: betaC(lam(X, Y), R) :- !, R = lam(X, Y).*/ | |
betaC(lam(X, Y), R) :- !, betaC(Y, YY), R = lam(X, YY). | |
betaC(L, R) :- L =.. [H|A], maplist(betaC, A, AA), R =.. [H|AA]. | |
app(I, Y, R) :- nonvar(I), I = lam(X, F), !, alphaConvert(Y, X), betaC(F, R). | |
app(X, Y, app(X,Y)). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Predicate = Predicate Pred [Argument] | |
data Argument = Qualified Qualified | ProperNoun ProperNoun | |
data Qualified = Qual Quant Var NounClass | |
data Quant = Exists | All | The | None | |
data ProperNoun = PN String | |
data NounClass = Adjective Adj NounClass | NC String (Maybe RelativeClause) | |
data RelativeClause = Predicate | |
type O a = NonDetT (Cont Expr) a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# Language OverloadedStrings #-} | |
{-# Language FlexibleContexts #-} | |
module Foo where | |
import Control.Monad.Cont | |
import qualified Control.Monad.State as S | |
import Text.Megaparsec | |
import Text.Megaparsec.Char | |
import Data.Text (Text, pack) | |
import Data.Void | |
import Control.Applicative |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Abgabesystem Informatik <https://auas.cs.uni-duesseldorf.de/> | |
* Startseite <https://auas.cs.uni-duesseldorf.de/student/index> | |
* Vorlesungsverzeichnis <https://auas.cs.uni-duesseldorf.de/course/list> | |
* Profil <https://auas.cs.uni-duesseldorf.de/profile/index> | |
* Logout <https://auas.cs.uni-duesseldorf.de/student/logout> | |
Abgabe ansehen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(\let. | |
let (\n s z. s (n s z)) \succ. | |
let (\n s z. n (\applySuccNMinus1Times succFun. succFun (applySuccNMinus1Times s)) (\_. z) (\x. x)) \pred. | |
let (\n m. m succ n) \add. | |
let (\n m s z. m (n s) z) \mult. | |
let (\n m. m pred n) \sub. | |
let (\t f. t) \true. | |
let (\t f. f) \false. | |
let (\b ift iff. b _then ift _else iff) \if. | |
let (\x. x) \then. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE TypeFamilies #-} | |
module Foo where | |
import GHC.Types | |
import Control.Monad.Reader | |
import Control.Monad.State | |
import Data.Functor.Identity | |
import qualified Control.Concurrent.Async as A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- unleash the zoo | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE TypeInType #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE DefaultSignatures #-} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE BangPatterns #-} | |
module Test where | |
import Data.Vector.Unboxed as U | |
import GHC.Word | |
data State = A | B | |
process :: U.Vector Word8 -> Bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Weapon { | |
void* head; | |
void* tail; | |
}; | |
int getweaponname(lua_State* L) { | |
int*** userdata = (int***)lua_touserdata(L, 1); | |
luaL_argcheck(L, userdata != NULL, 1, "`pawn' expected"); | |
size_t idx = luaL_checkint(L, 2); | |
// we go userdata -> luabind data -> pawn struct -> weapon vec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int getweaponname(lua_State* L) { | |
int** userdata = (int**)lua_touserdata(L, 1); | |
int idx = luaL_checkint(L, 2); | |
luaL_argcheck(L, userdata != NULL, 1, "`pawn' expected"); | |
int* pawn = (int*)userdata[0][2]; | |
int* weapon_arr_start = (int*)pawn[1]; | |
int* weapon_arr_end = (int*)pawn[2]; | |
int* weapon_addr = weapon_arr_start + 2 * idx; |