Skip to content

Instantly share code, notes, and snippets.

@deech
deech / indexed-natural-numbers.shen
Created February 28, 2013 13:11
Indexed natural numbers
(datatype natnum
if (integer? X)
if (> X -1)
________________
X : (natnum X);
(let A (+ X 1));
X : (natnum X);
__________
name: fltkhs
version: 0.1.0.0
synopsis: FLTK bindings
description:
Low level bindings for the FLTK GUI toolkit.
license: MIT
license-file: LICENSEmc
category: UI
build-type: Configure
cabal-version: >=1.8
@deech
deech / gist:6395316
Created August 30, 2013 23:46
Extra libs not statically linked ...
$cabal build -v2
creating dist/setup
./dist/setup/setup build --verbose=2
PackageDescription {package = PackageIdentifier {pkgName = PackageName "fltkhs", pkgVersion = Version {versionBranch = [0,1,0,0], versionTags = []}}, license = MIT, licenseFile = "LICENSE", copyright = "", maintainer = "aditya.siram@gmail.com", author = "Aditya Siram", stability = "", testedWith = [], homepage = "http://github.com/deech/fltkc", pkgUrl = "", bugReports = "", sourceRepos = [], synopsis = "FLTK bindings", description = "Low level bindings for the FLTK GUI toolkit.", category = "UI", customFieldsPD = [], buildDepends = [Dependency (PackageName "base") (IntersectVersionRanges AnyVersion (ThisVersion (Version {versionBranch = [4,6,0,1], versionTags = []})))], specVersionRaw = Right (UnionVersionRanges (ThisVersion (Version {versionBranch = [1,8], versionTags = []})) (LaterVersion (Version {versionBranch = [1,8], versionTags = []}))), buildType = Just Custom, library = Just (Library {exposedModules = [ModuleName ["Graphics","U
@deech
deech / gist:6485616
Last active December 22, 2015 14:28
Array inside a struct ....
{-# LANGUAGE CPP #-}
module CHSTest where
import Control.Monad
import Foreign
import Foreign.C
import Foreign.Ptr
#c
typedef struct {
int x;
} A;
@deech
deech / gist:7697521
Created November 28, 2013 20:12
Haskell Unicode String Test
Prelude> let noel = "noël"
Prelude> reverse noel
"l\235on"
Prelude> take 3 noel
"no\235"
Prelude> length noel
4
@deech
deech / gist:7697831
Created November 28, 2013 20:39
SBCL String Test
* (defparameter *noel* "noël")
*NOEL*
* (subseq *noel* 0 3)
"noë"
* (reverse *noel*)
"lëon"
@deech
deech / gist:7697936
Created November 28, 2013 20:49
Elisp String Test
ELISP> (setq *noel* "noël")
"noël"
ELISP> (subseq *noel* 0 3)
"noë"
ELISP> (length *noel*)
4
ELISP> (apply #'string (reverse (string-to-list *noel*)))
"lëon"
@deech
deech / gist:7697971
Created November 28, 2013 20:54
JavaScript String Test
> var noel = "noël"
> noel
"noël"
> noel.substring(0,3)
"noë"
> noel.split("").reverse().join("")
"lëon"
> noel.length
4
@deech
deech / gist:7697998
Created November 28, 2013 20:57
Spidermonkey Test
>>> var noel = "noël";
undefined
>>> noel.substring(0,3)
"noë"
>>> noel.split("").reverse().join("")
"lëon"
>>> noel.length
4
>>> noel
"noël"
--- StackTraced.hs
module StackTraced
(StackTraced.head)
where
import Debug.Trace
import Control.Exception
import System.IO.Unsafe
stackTrace ::SomeException -> IO a
stackTrace e = traceStack (show e) $ error "empty head"
head :: [a] -> a