Skip to content

Instantly share code, notes, and snippets.

View etrepum's full-sized avatar
😎
Currently retired

Bob Ippolito etrepum

😎
Currently retired
View GitHub Profile
diff -rN -u old-ThreadScope/GUI/SaveAs.hs new-ThreadScope/GUI/SaveAs.hs
--- old-ThreadScope/GUI/SaveAs.hs 2014-01-09 10:55:58.000000000 -0800
+++ new-ThreadScope/GUI/SaveAs.hs 2014-01-09 10:55:58.000000000 -0800
@@ -10,6 +10,20 @@
-- Imports for GTK
import Graphics.UI.Gtk
import Graphics.Rendering.Cairo
+ ( Render
+ , Operator(..)
+ , Format(..)
@etrepum
etrepum / .gitignore
Last active January 2, 2016 13:48
Haskell Control.Concurrent client
.cabal-sandbox
dist
cabal.sandbox.config
client
server
*.hi
*.o
$ cabal sandbox init
$ ghci
h> import Control.Lens
<no location info>:
Could not find module `Control.Lens'
Perhaps you meant Control.Seq (from parallel-3.2.0.3)
$ cabal install lens
Resolving dependencies...
{-# LANGUAGE TupleSections #-}
module DNA (count, nucleotideCounts) where
import Data.Map.Strict (Map, fromListWith)
count :: Char -> String -> Int
count x
| x `elem` "GACTU" = sum . map (fromEnum . (==x))
| otherwise = error $ "invalid nucleotide " ++ show x
{-# LANGUAGE BangPatterns #-}
import Data.Time (DiffTime, utctDayTime, getCurrentTime)
import Foreign (ForeignPtr, Int64, Ptr, mallocForeignPtr, withForeignPtr)
import Foreign.Storable (sizeOf, peek, poke)
import GHC.IO.Handle ( Handle, BufferMode(NoBuffering)
, hClose, hGetBuf, hSetBuffering, hPutBuf)
import Network ( Socket, HostName, PortID(PortNumber), PortNumber, accept
, connectTo, listenOn, withSocketsDo)
import System.Console.GetOpt ( ArgOrder(Permute), ArgDescr(..), OptDescr(..)
, getOpt, usageInfo)
word_count.rs:7:8: 9:9 error: mismatched types: expected `char` but found `()` (expected char but found ())
word_count.rs:7 unsafe {
word_count.rs:8 u_tolower(c);
word_count.rs:9 }
error: aborting due to previous error
check failed
FAILURES: word-count
[bob@res exercism.io (rust-exercises)]$ cat assignments/rust/word-count/example.rs
use std::hashmap::HashMap;
module Main where
import Control.Concurrent
import System.Posix.Signals
signalsDebugFile :: String
signalsDebugFile = "signals.out"
handleUSR1 :: IO ()
@etrepum
etrepum / merge_sort.erl
Created September 24, 2013 18:26
Bottom-up Merge Sort in Erlang and Python
-module(merge_sort).
-export([merge_sort/1]).
% bottom-up merge sort
merge_sort([]) ->
[];
merge_sort(L) ->
iterate([[X] || X <- L]).
iterate([Xs]) ->
$ ghc -Wall -fforce-recomp ReadTill.hs
[1 of 1] Compiling ReadTill ( ReadTill.hs, ReadTill.o )
ReadTill.hs:3:1: Warning:
Pattern match(es) are non-exhaustive
In an equation for `readTill': Patterns not matched: _ (_ : _)
ReadTill.hs:3:10: Warning: Defined but not used: `c'
ReadTill.hs:4:1: Warning:
module WordCount
( wordCount
)
where
import Data.Char
import Data.Function
import qualified Data.Map as M
import Control.Monad.Writer