This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Char | |
r = flip mod | |
b [l] = l | |
b l = b $ map (\x -> read [x]) $ show $ sum l | |
s = b . map ((+1) . r 9 . r 97 . ord . toLower) . filter isAlpha | |
main = do | |
x <- getLine | |
putStr $ show $ s x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Text.ParserCombinators.Parsec | |
runop :: Char -> Integer -> Integer -> Integer | |
runop '+' n1 n2 = n1 + n2 | |
runop '-' n1 n2 = n1 - n2 | |
runop '*' n1 n2 = n1 * n2 | |
runop '^' n1 n2 = n1 ^ n2 | |
operation :: Parser Integer | |
operation = do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Mongo where | |
import Database.MongoDB | |
import Database.MongoDB.BSON | |
import Network | |
import Data.ByteString.Lazy.UTF8 | |
fS = fromString | |
db = fS "yourdb" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ChameleonBass where | |
import Haskore.Music | |
import Haskore.Melody | |
import Haskore.Basic.Pitch | |
import Haskore.Basic.Duration | |
import Haskore.Music.GeneralMIDI | |
import Haskore.Interface.MIDI.Render | |
pitch_line = map (\(x,y,z) -> x (y :: Octave) z () ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module FrereJacques where | |
import Haskore.Music | |
import Haskore.Melody | |
import Haskore.Basic.Pitch | |
import Haskore.Basic.Duration | |
import Haskore.Music.GeneralMIDI as MidiMusic | |
import Haskore.Interface.MIDI.Render as Render | |
render_to f m = Render.fileFromGeneralMIDIMusic f song where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- relational.hs | |
import Database.HDBC | |
import Database.HDBC.PostgreSQL | |
import Data.List | |
printTuples conn rel = quickQuery' conn ("SELECT DISTINCT * FROM " ++ rel) [] | |
(⋈) = intercalate " NATURAL JOIN " | |
(π) fields rel1 = "(SELECT " ++ (intercalate "," fields) ++ " FROM " ++ rel1 ++ ") a" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
format: markdown+lhs | |
title: A simple pasteboard app | |
... | |
We're going to write a simple "pasteboard" web application in Haskell, | |
using `happstack-server` and `HDBC`. Here's the basic interface: | |
`GET /` | |
: show a form for entering some code, a title, and a syntax |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Identity Monad for Ruby taken from | |
# http://moonbase.rydia.net/mental/writings/programming/monads-in-ruby/00introduction.html | |
# ... but without the typos and with complete functions | |
## | |
class Identity | |
attr_reader :value | |
def initialize( value ) | |
@value = value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Processing UsersController#create (for 127.0.0.1 at 2010-05-14 16:59:59) [POST] | |
Parameters: {"commit"=>"Create", "action"=>"create", "authenticity_token"=>"XFJroHBsMoFLCJRqYC3Z15c7U3hooDDiqZW09pWAH6U=", "controller"=>"users", "user"=>{"password_confirmation"=>"[FILTERED]", "openid_identifier"=>"", "password"=>"[FILTERED]", "email"=>"wittgenstein@tractatus.org"}} | |
AppConfiguration Load (1.0ms) SELECT * FROM "configurations" WHERE ("configurations"."name" = E'Default configuration') AND ( ("configurations"."type" = 'AppConfiguration' ) ) LIMIT 1 | |
Cache hit: Spree::Config ({}) | |
Cache hit: Spree::Config ({}) | |
SQL (0.3ms) BEGIN | |
User Load (1.5ms) SELECT "users".id FROM "users" WHERE (LOWER("users"."email") = E'wittgenstein@tractatus.org') LIMIT 1 | |
User Load (1.0ms) SELECT "users".id FROM "users" WHERE (LOWER("users"."login") = E'wittgenstein@tractatus.org') LIMIT 1 | |
User Load (0.3ms) SELECT "users".id FROM "users" WHERE ("users"."persistence_token" = E'8b2211023b79864659e7ac4ebb1f51362a4d35e7ca1bcb7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> rake mailee:send | |
(in /home/maiz/projetos/my_store) | |
Enviando | |
.............. (segue) |
NewerOlder