Skip to content

Instantly share code, notes, and snippets.

@ghoseb
ghoseb / ns-cheatsheet.clj
Last active May 20, 2024 13:01 — forked from alandipert/ns-cheatsheet.clj
Clojure ns syntax cheat-sheet
;;
;; NS CHEATSHEET
;;
;; * :require makes functions available with a namespace prefix
;; and optionally can refer functions to the current ns.
;;
;; * :import refers Java classes to the current namespace.
;;
;; * :refer-clojure affects availability of built-in (clojure.core)
;; functions.
@Gab-km
Gab-km / smugnessProblem.rst
Created April 19, 2012 08:01
コードウォッチ:関数型プログラミングの自惚れ問題

コードウォッチ:関数型プログラミングの自惚れ問題

原文:http://www.sdtimes.com/link/36534
著者:Larry O'Brien

僕は関数型プログラミングが好きだ。次の10年にかけてコードの革命を起こしていくだろうと考えている:言語はより関数型の機能を採用していくだろうし、開発者はより関数型の技術を導入していくだろうし、いくつかの点では、関数型プログラミングの原則はコードを組み立てていく上で「自然で」もっとも明確なやり方だとみんな考えるようになっていくだろう。

だけど、僕はもうこのシナリオを本気にしちゃいない。関数型プログラミングは、ワクワクするものを学ぶことに興味があると言っている主流のプログラマにとって明白な、大きな問題を抱えている:関数型プログラマーは自惚れ野郎どもだってことだ。

@uduki
uduki / corecursion.hs
Created November 7, 2012 08:49
余再帰あれこれ
{--- 余再帰とその利用例 ---}
{- 末尾再帰と再帰と余再帰
-
- 参考: http://d.hatena.ne.jp/kazu-yamamoto/20091122/1258899591
-
- 末尾再帰 : 引数に結果を蓄積し、自身へgotoして処理の流れが戻ってこないようにする。正格なデータを処理する時に用いるとスタックやヒープの節約になる。
- foldl f a [] = a
- foldl f a (x:xs) = foldl f (f a x) xs
-
@railwaycat
railwaycat / Emacs_starter.pl
Last active March 12, 2023 01:26
Start Emacs.app from CLI
#!/usr/bin/perl
# Emacs starter for Emacs mac port
# Thanks to Aquamacs Project and David Reitter
my $args = "";
my $tmpfiles = "";
for my $f (@ARGV) {
@keigoi
keigoi / coroutine.ml
Last active June 6, 2020 02:01
Coroutine implementation in OCaml, with Oleg's delimited continuation. see http://okmij.org/ftp/continuations/implementations.html#caml-shift
(* Coroutine implementation in OCaml, with Oleg's delimited continuation *)
(* see http://okmij.org/ftp/continuations/implementations.html#caml-shift *)
module D = Delimcc
(* Coroutine yielded a value of type 'a, and will resume with some value of type 'b *)
type ('a, 'b) suspend =
| Cont of 'a * ('b, ('a,'b) suspend) D.subcont
| Finish
let start_coroutine f =
@komamitsu
komamitsu / trie.ml
Last active April 11, 2020 19:58
Trie in OCaml
module Trie : sig
type t
val empty : t
val update : string -> int -> t -> t
val find : t -> string -> int list option
val create_from_text : string -> t
end =
struct
type node = {c:char; poslist:int list; children:t}
and t = node list
@yujiod
yujiod / DefaultKeyBinding.dict
Last active April 16, 2023 04:08
Macの英数入力で円記号とバックスラッシュを入れ替える(ATOKにも対応) ~/Library/KeyBindings/DefaultKeyBinding.dict
{
"¥" = ("insertText:", "\\");
"~\\" = ("insertText:", "¥");
}
@faithandbrave
faithandbrave / apply.md
Last active June 1, 2017 04:48
apply review

Library Fundamentals TS v1 apply関数のレビュー

レビュアー:高橋 晶(Akira Takahashi, faithandbrave@longgate.co.jp)

概要

apply()関数は、タプルを引数として関数を呼び出すユーティリティ関数です。しかしこの関数には、標準アルゴリズムと組み合わせて使用できないという問題があります。このレビューでは、apply()のユースケースを整理し、いくつかの有用なケースでapply()を適用できないことを示します。その後、その改善のために、関数オブジェクトをタプルを引数として受け取れるよう変換する機能と、その引数適用という2段階化の提案を行います。

@JeffBelgum
JeffBelgum / list_comprehensions.rs
Created September 26, 2014 00:03
Python list comprehensions in Rust
#![feature(macro_rules)]
/// MIT license etc. etc.
///
/// Experimenting with Python-like list comprehensions.
///
/// An attempt to explore the possibility space for ergonomic improvements
/// in Rust that can come post v1.0. Notice that there are not type declerations.
/// Aside from the "c!" macro invocation, Rust allows for an exact copy of the
/// Python comprehension syntax.
@unhammer
unhammer / merlin-init.sh
Last active February 12, 2023 05:40
Create .merlin file for a project with all your ocamlfind packages and .opam sources in there
#!/bin/sh
if test -f .merlin; then
echo ".merlin already exists, bailing out ..." >&2
exit 1
else
# You could add your default EXT's and such to this list: