Skip to content

Instantly share code, notes, and snippets.

@eldesh
eldesh / Hornor.sml
Created March 14, 2020 16:30
計算機数学I (2019) 第5回:Horner法,数の10進・2進変換 のメモ
(**
* Computer Mathematics 2019 / Lecture 5, Part 1: The Horner's rule
* https://atelieraterui.page.link/NqaR
*
* 講義を読んで書いたコード断片。
* - 整数の 10 <-> 2進数変換
* - 実数の小数部の 10 -> 2進数変換
*)
structure Main =
@eldesh
eldesh / hello_gtk.smi
Created February 27, 2019 15:33
Gtk+3 binding sample with SML# 3.4.0
_require "basis.smi"
_require "ffi.smi"
@eldesh
eldesh / Setup.hs
Last active October 26, 2017 02:10
入門 LiquidHaskell p.22 drop の注釈付き実装の検査
環境
====
- CentOS Linux release 7.4.1708 (Core)
- https://github.com/ucsd-progsys/liquidhaskell.git (commit:16307c7403ba1aeeef9205b414785d36e93a402b)
- stack setup && stack install (GHC 8.2.1)
ログ
====
@eldesh
eldesh / sopath.c
Created November 18, 2015 11:19
実行した環境で、指定された名前で共有ライブラリがリンクされるとどのパスのライブラリがリンクされるかを標準出力に書き出す。
/**
* 動的リンクされたライブラリのパスを表示する
*
* **Linux specific program**
*
* build:
* $ gcc -Wall -pedantic-errors -std=c99 -DNDEBUG -o sopath sopath.c -ldl
*/
#define _GNU_SOURCE
#include <stdio.h>
@eldesh
eldesh / dynlink.sml
Last active August 29, 2015 14:10
use Win32 API with MLton FFI
@eldesh
eldesh / body.smi
Created May 1, 2014 04:35
SML#1.2.0 でウソのシグネチャ(型注釈)がコンパイルを通るバグ。(SML#2.0.0では修正済み)
_require "basis.smi"
structure B =
struct
val g : {dir:string, name:string} -> unit
end
@eldesh
eldesh / cygwin-fault.c
Created March 3, 2014 01:39
SML/NJ110.76 を cygwin1.7.28-2 でビルドするために書いた怪しげなヘッダ(cygwin-fault.h)とパッチ
/* base/runtime/mach-dep/cygwin-fault.c */
$ diff base/runtime/mach-dep/cygwin-fault.c base/runtime/mach-dep/cygwin-fault.new.c
20,21c20
< #include <windows.h>
< #include <exceptions.h> /* Cygwin stuff */
---
> #include "cygwin-fault.h" /* Cygwin stuff */
@eldesh
eldesh / dup_structure
Created February 26, 2014 14:43
[ (name evaluation CP-600) Provide check fails (structure replication): Top.S ] is occured from SML#1.2.0
(* .smi *)
_require "basis.smi"
structure S =
struct
val id : 'a -> 'a
end
structure Top =
struct
(**
* SML# <-> PCRE(http://www.pcre.org/) binding sample
*)
(*
* ~/work/pcre_sharp$ rlwrap -c smlsharp -L/usr/lib -lpcre
* SML# version 1.2.0 (2012-11-14 18:25:26 JST) for x86-linux
* # use "pcre.sml";
* match!(314)
* structure Pcre = ...
@eldesh
eldesh / tree.sml
Created July 24, 2013 15:58
圏論勉強会#10 練習問題 回答(1問目) http://nineties.github.io/category-seminar/10.html#/38
(**
* 圏論勉強会#10 練習問題 回答
* http://nineties.github.io/category-seminar/10.html#/38
*
*
* 実行方法:
* $ cat tree.cm
* group
* is
* $/basis.cm