Skip to content

Instantly share code, notes, and snippets.

View lmdexpr's full-sized avatar

yuki lmdexpr

View GitHub Profile
@lmdexpr
lmdexpr / ioscc.scala
Last active December 2, 2020 18:48
ScalaMatsuri2020 Scalaひどいコード選手権用 JSON parser だったもの
type S=Seq[_]
def o(a:Seq[(_,_)],? :S):(Map[_,_],S)= ?match{case'}'+:r=>a.toMap->r
case','+:r=>o(a,r)case? =>val m=""""(.+?)":(.+)""".r
val m(k,t)= ?mkString
val(v,r)=p()(t.toSeq)
o(a:+(k->v),r)}
def y(a:S):S=>(S,S)={case']'+:r=>a->r
case','+:r=>y(a)(r)case s=>val(v,r)=p()(s)
y(a:+v)(r)}
def u(a:S,b:S):(S,S)=b match{case c+:r=>c match{case'}'|']'=>a->b
@lmdexpr
lmdexpr / Main.scala
Last active October 31, 2015 14:59
CODE RUNNER B
package coderunner.b
import scala.util._
import scala.concurrent._
import scala.concurrent.duration.Duration
import dispatch._, Defaults._
import spray.json._
object Main extends App {
-- Original Brain F*ck code
++++++++[>+++++++++<-]>.<+++++[>++++++<-]>-.<++[>+++<-]>+..+++.<++++++[>----<-]>.<++++++[>++++<-]>.+++.------.--------.
-- Solis_mb-lang code
llllllllmSllllllllloibSsolllllmSlllllloibSisollmSllloibSlsslllsollllllmSiiiioibSsollllllmSlllloibSslllsiiiiiisiiiiiiiis
#define CMD(x) "\033[" x
#define F_COL(x) CMD("3" x "m")
#define B_COL(x) CMD("4" x "m")
#define R "1"
#define G "2"
#define Y "3"
#define B "4"
#define M "5"
#define C "6"
#define W "7"
@lmdexpr
lmdexpr / assign_is_target.h
Last active August 29, 2015 14:11
がっこうかだいってやつ
#if __INCLUDE_LEVEL__ <= LIMIT + 1
TARGET[__INCLUDE_LEVEL__ - 1].istarget = is(OP_CODES[__INCLUDE_LEVEL__ - 1]);
#include __FILE__
#endif
@lmdexpr
lmdexpr / typelevel.hs
Created August 9, 2014 10:35
かたれべるのやつ
{-# LANGUAGE FunctionalDependencies, FlexibleInstances, UndecidableInstances,
ScopedTypeVariables #-}
data Z
data S a
data P a
class ToNum a where
num :: Num b => a -> b
instance ToNum Z where
@lmdexpr
lmdexpr / ttt.cabal
Last active September 2, 2015 23:05
-- Initial ttt.cabal generated by cabal init. For further documentation,
-- see http://haskell.org/cabal/users-guide/
name: ttt
version: 0.1.0.0
-- synopsis:
-- description:
license: GPL-3
-- license-file: LICENSE
author: lmdexpr
@lmdexpr
lmdexpr / numhit.c
Last active August 29, 2015 14:02
そこそこ頑張った課題なのでup
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define N_MENU 3
#define M 20
#define STR_LEN 64
#define DIFs 3
//#define PLAYERS 1
main :: IO()
main =
putStrLn $ "The answer to the Ultimate Question of Life, "
++ "the Universe, and Everything is "
++ show answer
where
answer = 42