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 / caesar.sml
Created February 20, 2012 03:38
simple caesar cipher module implemented with SML
(* see. http://d.hatena.ne.jp/a-hisame/20120217/1329499672 *)
(* ===========================================================
* for using
* > sml
* > use "caesar.sml";
* > Caesar.encode "hoge";
* val it = "mtlj" : string
* > _
@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)
ログ
====
(**
* 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
@eldesh
eldesh / fix_fact.sml
Last active December 19, 2015 17:18
圏論勉強会#9 関数 fact の最小不動点を調べる例をSMLで実装 http://nineties.github.io/category-seminar/9.html#/45
(**
* 圏論勉強会#9
*
* 関数 fact の最小不動点を調べる 例をSMLで実装
* http://nineties.github.io/category-seminar/9.html#/45
*
*)
structure Fact =
struct
infixr 1 $
@eldesh
eldesh / banana.sml
Last active December 19, 2015 14:39
圏論勉強会 @ ワークスアプリケーションズ#8 http://nineties.github.io/category-seminar/8.html#/55 練習問題 回答
(**
* 圏論勉強会 @ ワークスアプリケーションズ#8
* http://nineties.github.io/category-seminar/8.html#/55
* 練習問題 回答
*
* 実行方法(for SML/NJ)
* $ cat banana.cm
* group
* is
* $/basis.cm
@eldesh
eldesh / sendmoremoney.sml
Created June 29, 2013 20:59
https://gist.github.com/yonta/5851577#file-sendmoremoney2-sml に触発されて書いてみた。力ずくで解く例。
(**
* SEND
* + MORE
* ------
* MONEY
*
* S,E,N,D,M,O,R,Y
*
* run:
* - Option.app (print o pp) (search ())
@eldesh
eldesh / gist:5714388
Last active December 18, 2015 02:58
De Bruijn変換をStandardMLで実装
(*
* (* debruijn.cm *)
* Group
* is
* $/basis.cm
* debrujn.sml
*)
(**
* De Bruijn変換