Skip to content

Instantly share code, notes, and snippets.

View nattybear's full-sized avatar

준규 nattybear

View GitHub Profile
@nattybear
nattybear / quickcheck.md
Last active November 13, 2023 06:49
퀵체크(QuickCheck): 하스켈 자동 점검 도구 번역

원문 : QuickCheck: An Automatic Testing Tool for Haskell

퀵체크(QuickCheck)란 무엇인가?

퀵체크는 하스켈 프로그램을 자동으로 점검하는 도구이다. 개발자가 프로그램의 명세(specification) 를 입력하면 퀵체크는 무작위로 만들어진 수많은 경우에서 함수가 만족해야 하는 속성(property)이 유지되는지 점검한다. 명세는 퀵체크 라이브러리에 정의되어 있는 콤비네이터(combinator)를 이용해서 하스켈 문법으로 적는다. 퀵체크는 속성을 정의하고, 점검 데이터의 분포를 관찰하고, 점검 데이터 생성기를 정의할 수 있는 콤비네이터를 제공한다.

왜 퀵체크를 사용해야 하나?

간단한 예제

print("Hello World1")
module Robot where
import Control.Concurrent.MVar
import Control.Monad.State
import System.Random.Stateful
type Robot = MVar String
type RunState = [String]
initialState :: RunState
Red [Needs: 'View]
view [
title "Replace Hex Data"
button "Binary Data" [
file: request-file
t1/text: form file
]
t1: text 400
return
button "Hex Table" [
@nattybear
nattybear / main.py
Created September 22, 2022 11:38
백준 캡틴 이다솜
def cycleA(x):
n = 2
while True:
yield x
x = x + n
n += 1
def cycleB(x):
ys = cycleA(1)
next(ys)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int[] trees = new int[n];
for (int i = 0; i < n; i++)
import java.util.*;
class ListOfInteger extends ArrayList<Integer> {}
class Graph extends HashMap<Integer,ListOfInteger> {}
public class Main {
static List discovered = new ListOfInteger();
static List explored = new ListOfInteger();
module Tree where
data Tree a = Leaf a
| Node (Tree a) (Tree a)
deriving Show
type WithCounter a = Int -> (a, Int)
numberOfLeaves :: Tree a -> Integer
numberOfLeaves (Leaf _) = 1
{-# LANGUAGE GADTs #-}
module Operational where
import Control.Monad
data Program instr a where
Then :: instr a -> (a -> Program instr b) -> Program instr b
Return :: a -> Program instr a