Removed lorem ipsum testing posts
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
This commit is contained in:
parent
ecc75e6375
commit
ac168aa1af
@ -1,425 +0,0 @@
|
|||||||
---
|
|
||||||
title: A New Post
|
|
||||||
author: Collin J. Doering
|
|
||||||
date: 2013-12-18
|
|
||||||
description: An Article about nothing really
|
|
||||||
updated: 2013-12-07
|
|
||||||
tags: general, programming, linux
|
|
||||||
---
|
|
||||||
|
|
||||||
Run a manual sweep of anomalous airborne or electromagnetic readings. Radiation levels in our atmosphere have increased by 3,000 percent. Electromagnetic and subspace wave fronts approaching synchronization. What is the strength of the ship's deflector shields at maximum output? The wormhole's size and short period would make this a local phenomenon. Do you have sufficient data to compile a holographic simulation?
|
|
||||||
|
|
||||||
<!--more-->
|
|
||||||
Exceeding reaction chamber thermal limit. We have begun power-supply calibration. Force fields have been established on all turbo lifts and crawlways. Computer, run a level-two diagnostic on warp-drive systems. Antimatter containment positive. Warp drive within normal parameters. I read an ion trail characteristic of a freighter escape pod. The bomb had a molecular-decay detonator. Detecting some unusual fluctuations in subspace frequencies.
|
|
||||||
|
|
||||||
``` {.haskell .code-term .numberLines}
|
|
||||||
{-# LANGUAGE ExistentialQuantification #-}
|
|
||||||
|
|
||||||
-- File: rdm.hs
|
|
||||||
-- Date: 02/10/2010
|
|
||||||
-- Author: Collin J. Doering <rekahsoft@gmail.com>
|
|
||||||
-- Description: Random source file to experiment while learning haskell
|
|
||||||
|
|
||||||
import System.IO
|
|
||||||
import Data.List
|
|
||||||
import Data.Foldable (foldr')
|
|
||||||
import Data.Function
|
|
||||||
import System.Posix.User
|
|
||||||
import Control.Monad
|
|
||||||
|
|
||||||
nameSpam :: IO ()
|
|
||||||
nameSpam s = putStrLn $ fst $ foldr (\x (a, i) -> (take i (repeat x) ++ a, i - 1)) ("", length s) s
|
|
||||||
|
|
||||||
printTriangle :: Char -> Int -> IO ()
|
|
||||||
printTriangle c i = pTriangle c 1
|
|
||||||
where pTriangle c j
|
|
||||||
| j > i = return ()
|
|
||||||
| otherwise = putStrLn (take j (repeat c)) >>
|
|
||||||
pTriangle c (j + 1)
|
|
||||||
|
|
||||||
printTriangle' :: Char -> Int -> IO ()
|
|
||||||
printTriangle' _ 0 = return ()
|
|
||||||
printTriangle' c i = putStrLn (take i (repeat c)) >> printTriangle' c (i - 1)
|
|
||||||
|
|
||||||
printTriangle'' :: Char -> Integer -> IO ()
|
|
||||||
printTriangle'' c n = putStrLn $ foldr' (\i a -> (take i $ repeat c) ++ "\n" ++ a) "" [1..n]
|
|
||||||
|
|
||||||
factorial :: Integer -> Integer
|
|
||||||
factorial x = if x <= 1 then 1
|
|
||||||
else x * factorial (x - 1)
|
|
||||||
|
|
||||||
-- The factorial function using fix points
|
|
||||||
factorial' = fix (\f x -> if x <= 1 then 1 else x * f(x - 1))
|
|
||||||
|
|
||||||
factorial'' = fix (\f acc x -> if x <= 1 then acc else f (acc * x) (x - 1)) 1
|
|
||||||
|
|
||||||
factorial1 :: Integer -> Integer
|
|
||||||
factorial1 0 = 1
|
|
||||||
factorial1 xs = xs * factorial1 (xs - 1)
|
|
||||||
|
|
||||||
squareList :: [Double] -> [Double]
|
|
||||||
squareList lst = if null lst then []
|
|
||||||
else (square (head lst)):(squareList (tail lst))
|
|
||||||
where square x = x * x
|
|
||||||
|
|
||||||
squareList1 :: [Double] -> [Double]
|
|
||||||
squareList1 [] = []
|
|
||||||
squareList1 (x:xs) = (square x):(squareList1 xs)
|
|
||||||
where square x = x * x
|
|
||||||
|
|
||||||
squareList2 = map (\x -> x * x)
|
|
||||||
|
|
||||||
fib :: Integer -> Integer
|
|
||||||
fib 0 = 0
|
|
||||||
fib 1 = 1
|
|
||||||
fib x = fib (x-1) + fib (x-2)
|
|
||||||
|
|
||||||
-- Playing with datatypes
|
|
||||||
data Posn = Posn2D { x :: Int, y :: Int }
|
|
||||||
| Posn3D { x :: Int, y :: Int, z :: Int }
|
|
||||||
deriving (Show, Eq, Ord)
|
|
||||||
|
|
||||||
-- Real World Haskell Exercises
|
|
||||||
data List a = Cons a (List a)
|
|
||||||
| Nil
|
|
||||||
deriving (Show)
|
|
||||||
|
|
||||||
listToBIL :: List a -> [a]
|
|
||||||
listToBIL (Cons a xs) = a:(listToBIL xs)
|
|
||||||
listToBIL Nil = []
|
|
||||||
|
|
||||||
myLength :: [a] -> Integer
|
|
||||||
myLength [] = 0
|
|
||||||
myLength x = 1 + myLength (drop 1 x)
|
|
||||||
|
|
||||||
myLength1 :: [a] -> Integer
|
|
||||||
myLength1 lst = let myLength1Help [] acc = acc
|
|
||||||
myLength1Help (_:xs) acc = myLength1Help xs (acc + 1)
|
|
||||||
in myLength1Help lst 0
|
|
||||||
|
|
||||||
myLength2 :: [a] -> Int
|
|
||||||
myLength2 lst = myLength2' lst 0
|
|
||||||
where myLength2' [] a = a
|
|
||||||
myLength2' (_:xs) a = myLength2' xs (a + 1)
|
|
||||||
|
|
||||||
meanOfList :: [Double] -> Double
|
|
||||||
meanOfList lst = meanSum lst 0 0
|
|
||||||
where meanSum [] s l
|
|
||||||
| l /= 0 = s / l
|
|
||||||
| otherwise = 0
|
|
||||||
meanSum (x:xs) s l = meanSum xs (s + x) (l + 1)
|
|
||||||
|
|
||||||
listToPalindrome :: [a] -> [a]
|
|
||||||
listToPalindrome [] = []
|
|
||||||
listToPalindrome x = x ++ reverse x
|
|
||||||
|
|
||||||
isPalindrome :: (Eq a) => [a] -> Bool
|
|
||||||
isPalindrome x
|
|
||||||
| mod len 2 == 0 && take (div len 2) x == reverse (drop (div len 2) x) = True
|
|
||||||
| otherwise = False
|
|
||||||
where len = length x
|
|
||||||
|
|
||||||
foldrmap :: (a -> b) -> [a] -> [b]
|
|
||||||
foldrmap fn = foldr (\x y -> (fn x):y) []
|
|
||||||
--foldrmap fn = foldr ((:) . fn) []
|
|
||||||
|
|
||||||
foldrcopy :: [a] -> [a]
|
|
||||||
foldrcopy = foldr (:) []
|
|
||||||
|
|
||||||
foldrappend :: [a] -> [a] -> [a]
|
|
||||||
foldrappend a b = foldr (:) b a
|
|
||||||
|
|
||||||
foldrlength :: [a] -> Int
|
|
||||||
foldrlength = foldr (\x y -> y + 1) 0
|
|
||||||
|
|
||||||
foldrsum :: (Num a) => [a] -> a
|
|
||||||
foldrsum = foldr (+) 0
|
|
||||||
|
|
||||||
--myfoldr fn init lst = myFoldrHelper ...
|
|
||||||
|
|
||||||
myMap :: (a -> b) -> [a] -> [b]
|
|
||||||
myMap f xs = [f x | x <- xs]
|
|
||||||
|
|
||||||
myMap1 :: (a -> b) -> [a] -> [b]
|
|
||||||
myMap1 _ [] = []
|
|
||||||
myMap1 f (x:xs) = f x : myMap1 f xs
|
|
||||||
|
|
||||||
mapWithFilter :: (a -> b) -> (a -> Bool) -> [a] -> [b]
|
|
||||||
mapWithFilter f p xs = [f x | x <- xs, p x]
|
|
||||||
|
|
||||||
mapWithFilter1 :: (a -> b) -> (a -> Bool) -> [a] -> [b]
|
|
||||||
mapWithFilter1 _ _ [] = []
|
|
||||||
mapWithFilter1 f p (x:xs)
|
|
||||||
| p x = f x : mapWithFilter1 f p xs
|
|
||||||
| otherwise = mapWithFilter1 f p xs
|
|
||||||
|
|
||||||
mapWithFilter2 :: (a -> b) -> (a -> Bool) -> [a] -> [b]
|
|
||||||
mapWithFilter2 f p = map f . filter p
|
|
||||||
|
|
||||||
-- A neat little closure
|
|
||||||
myFlip :: (a -> b -> c) -> b -> a -> c
|
|
||||||
myFlip f = \a b -> f b a
|
|
||||||
|
|
||||||
compose :: (a -> b) -> (c -> a) -> (c -> b)
|
|
||||||
compose f g = \x -> f(g(x))
|
|
||||||
|
|
||||||
disemvowel :: String -> String
|
|
||||||
disemvowel = unwords . filter p . words
|
|
||||||
where p = flip elem "AaEeIiOoUu" . head
|
|
||||||
|
|
||||||
-- questions from http://www.haskell.org/haskellwiki/Hitchhikers_guide_to_Haskell
|
|
||||||
greeter = do
|
|
||||||
putStrLn "Hello there! May i ask your name?"
|
|
||||||
name <- getLine
|
|
||||||
if name == "no"
|
|
||||||
then putStrLn "Well, sorry i asked..goodbye!"
|
|
||||||
else putStrLn ("Well hello there " ++ name ++ ", it's nice to meet you!")
|
|
||||||
|
|
||||||
-- The above greeter "de-sugared"
|
|
||||||
greeter2 :: IO ()
|
|
||||||
greeter2 = putStrLn "Hello there! May i ask your name?"
|
|
||||||
>> getLine
|
|
||||||
>>= \name -> if name == "no"
|
|
||||||
then putStrLn "Well, sorry i asked..goodbye!"
|
|
||||||
else putStrLn ("Well hello there " ++ name ++ ", it's nice to meet you!")
|
|
||||||
|
|
||||||
safeHead :: [a] -> Maybe a
|
|
||||||
safeHead [] = Nothing
|
|
||||||
safeHead (x:xs) = Just x
|
|
||||||
|
|
||||||
myTail :: [a] -> [a]
|
|
||||||
myTail [] = []
|
|
||||||
myTail (_:xs) = xs
|
|
||||||
|
|
||||||
-- Old version..why not make it for all monads?
|
|
||||||
-- myLiftM :: (a -> b) -> IO a -> IO b
|
|
||||||
-- myLiftM f a = a >>= \x -> return (f x)
|
|
||||||
|
|
||||||
{- Here is a generic version of myLiftM, which has the same behavior as liftM.
|
|
||||||
Though the standard library chose to use do notation rather then the monadic
|
|
||||||
bind function (>>=), they are actually the same once the do notation is
|
|
||||||
de-sugared. Finally, notice the only thing that got changed here was the type
|
|
||||||
signature.
|
|
||||||
-}
|
|
||||||
myLiftM :: Monad m => (a -> b) -> m a -> m b
|
|
||||||
myLiftM f a = a >>= \x -> return (f x)
|
|
||||||
|
|
||||||
--nthDigit :: Integer -> Integer -> Integer
|
|
||||||
--nthDigit n i = floor(10 * (f - floor(f)))
|
|
||||||
-- where f = n/10^(i+1)
|
|
||||||
|
|
||||||
-- Implementation of a Maybe like type
|
|
||||||
data Perhaps a = PNone
|
|
||||||
| PJust a
|
|
||||||
deriving (Eq,Ord,Show)
|
|
||||||
|
|
||||||
instance Functor Perhaps where
|
|
||||||
fmap _ PNone = PNone
|
|
||||||
fmap f (PJust x) = PJust (f x)
|
|
||||||
|
|
||||||
instance Monad Perhaps where
|
|
||||||
(PJust a) >>= f = f a
|
|
||||||
PNone >>= _ = PNone
|
|
||||||
|
|
||||||
return a = PJust a
|
|
||||||
|
|
||||||
instance MonadPlus Perhaps where
|
|
||||||
mzero = PNone
|
|
||||||
|
|
||||||
mplus (PJust a) _ = PJust a
|
|
||||||
mplus PNone (PJust a) = PJust a
|
|
||||||
mplus _ _ = PNone
|
|
||||||
|
|
||||||
-- Simple Binary Tree type
|
|
||||||
data Tree a = Empty
|
|
||||||
| Node a (Tree a) (Tree a)
|
|
||||||
deriving (Show, Eq)
|
|
||||||
|
|
||||||
instance Ord m => Ord (Tree m) where
|
|
||||||
_ >= Empty = True
|
|
||||||
(Node a _ _) >= (Node b _ _) = a >= b
|
|
||||||
_ >= _ = False
|
|
||||||
|
|
||||||
_ <= Empty = True
|
|
||||||
(Node a _ _) <= (Node b _ _) = a <= b
|
|
||||||
_ <= _ = False
|
|
||||||
|
|
||||||
leaf :: a -> Tree a
|
|
||||||
leaf x = Node x Empty Empty
|
|
||||||
|
|
||||||
balanced :: Ord a => Tree a -> Bool
|
|
||||||
balanced Empty = True
|
|
||||||
balanced nd@(Node _ ls rs) = nd >= ls && nd <= rs && balanced ls && balanced rs
|
|
||||||
|
|
||||||
depth :: Tree a -> Int
|
|
||||||
depth Empty = 0
|
|
||||||
depth (Node _ ls rs) = 1 + max (depth ls) (depth rs)
|
|
||||||
|
|
||||||
-- A parser type
|
|
||||||
type Parser a = String -> [(a,String)]
|
|
||||||
|
|
||||||
-- Questions from Book "Programming in Haskell"
|
|
||||||
-- Excercises 5.8
|
|
||||||
|
|
||||||
-- Given an even list returns a pair of its halves
|
|
||||||
halve :: [a] -> ([a],[a])
|
|
||||||
halve xs
|
|
||||||
| length xs `mod` 2 == 0 = (take halfLen xs, drop halfLen xs)
|
|
||||||
| otherwise = ([],[])
|
|
||||||
where halfLen = (length xs `div` 2)
|
|
||||||
|
|
||||||
safeTailA :: [a] -> [a]
|
|
||||||
safeTailA xs = if null xs then [] else tail xs
|
|
||||||
|
|
||||||
safeTailB :: [a] -> [a]
|
|
||||||
safeTailB xs
|
|
||||||
| null xs = []
|
|
||||||
| otherwise = tail xs
|
|
||||||
|
|
||||||
safeTailC :: [a] -> [a]
|
|
||||||
safeTailC [] = []
|
|
||||||
safeTailC (x:xs) = xs
|
|
||||||
|
|
||||||
-- Did a version using the Maybe type for entertainment
|
|
||||||
safeTail :: [a] -> Maybe [a]
|
|
||||||
safeTail [] = Nothing
|
|
||||||
safeTail (x:xs) = Just xs
|
|
||||||
|
|
||||||
myReplicate :: Int -> a -> [a]
|
|
||||||
myReplicate i e = [x | _ <- [1..i], x <- [e]]
|
|
||||||
|
|
||||||
pythagoreans :: Int -> [(Int,Int,Int)]
|
|
||||||
pythagoreans i = [(x,y,z) | x <- [1..i], y <- [1..i], z <- [1..i], x^2 + y^2 == z^2]
|
|
||||||
|
|
||||||
scalarProduct :: [Int] -> [Int] -> Int
|
|
||||||
scalarProduct xs ys = sum [x * y | (x,y) <- zip xs ys]
|
|
||||||
|
|
||||||
-- Excercise 7.8
|
|
||||||
toPowerOf :: Int -> Int -> Int
|
|
||||||
x `toPowerOf` 0 = 1
|
|
||||||
x `toPowerOf` n = x * (x `toPowerOf` (n-1))
|
|
||||||
|
|
||||||
myAnd :: [Bool] -> Bool
|
|
||||||
myAnd [] = True
|
|
||||||
myAnd (x:xs)
|
|
||||||
| x = myAnd xs
|
|
||||||
| otherwise = False
|
|
||||||
|
|
||||||
myAndFoldr :: [Bool] -> Bool
|
|
||||||
myAndFoldr = foldr (&&) True
|
|
||||||
|
|
||||||
myConcat :: [[a]] -> [a]
|
|
||||||
myConcat [] = []
|
|
||||||
myConcat (x:xs) = x ++ myConcat xs
|
|
||||||
|
|
||||||
myReplicateR :: Int -> a -> [a]
|
|
||||||
myReplicateR 0 _ = []
|
|
||||||
myReplicateR n e = e : myReplicateR (n-1) e
|
|
||||||
|
|
||||||
nthElem :: [a] -> Int -> a
|
|
||||||
nthElem (x:xs) 0 = x
|
|
||||||
nthElem (x:xs) n = nthElem xs (n-1)
|
|
||||||
nthElem [] _ = undefined
|
|
||||||
|
|
||||||
nthElemSafe :: [a] -> Int -> Maybe a
|
|
||||||
nthElemSafe (x:xs) 0 = Just x
|
|
||||||
nthElemSafe (x:xs) n = nthElemSafe xs (n-1)
|
|
||||||
nthElemSafe [] _ = Nothing
|
|
||||||
|
|
||||||
myElem :: Eq a => a -> [a] -> Bool
|
|
||||||
myElem _ [] = False
|
|
||||||
myElem e (x:xs)
|
|
||||||
| e == x = True
|
|
||||||
| otherwise = myElem e xs
|
|
||||||
|
|
||||||
merge :: Ord a => [a] -> [a] -> [a]
|
|
||||||
merge [] [] = []
|
|
||||||
merge [] ys = ys
|
|
||||||
merge xs [] = xs
|
|
||||||
merge (x:xs) (y:ys)
|
|
||||||
| x < y = x:merge xs (y:ys)
|
|
||||||
| x == y = x:y:merge xs ys
|
|
||||||
| otherwise = y:merge (x:xs) ys
|
|
||||||
|
|
||||||
msort :: Ord a => [a] -> [a]
|
|
||||||
msort [] = []
|
|
||||||
msort [x] = [x]
|
|
||||||
msort xs = merge (msort (take halflen xs)) (msort (drop halflen xs))
|
|
||||||
where halflen = length xs `div` 2
|
|
||||||
|
|
||||||
-- Other random functions
|
|
||||||
|
|
||||||
increasing :: Ord a => [a] -> Bool
|
|
||||||
increasing [] = False
|
|
||||||
increasing (x:xs) = inc xs x True
|
|
||||||
where inc [] _ bl = True
|
|
||||||
inc (_:_) _ False = False
|
|
||||||
inc (x:xs) a True = inc xs x (a < x)
|
|
||||||
|
|
||||||
-- Could implement the error handling for the empty list case below
|
|
||||||
-- using Maybe instead of error resulting in a type:
|
|
||||||
-- mymax :: Ord a => [a] -> Maybe a
|
|
||||||
mymax :: Ord a => [a] -> a
|
|
||||||
mymax [] = error "A empty list has no maximum"
|
|
||||||
mymax (x:xs) = aux xs x
|
|
||||||
where aux [] y = y
|
|
||||||
aux (x:xs) y
|
|
||||||
| x > y = aux xs x
|
|
||||||
| otherwise = aux xs y
|
|
||||||
|
|
||||||
-- A seemingly nicer implementation of mymax above
|
|
||||||
mymax2 :: Ord a => [a] -> Maybe a
|
|
||||||
mymax2 [] = Nothing
|
|
||||||
mymax2 (x:xs) = Just $ foldr' lrgr x xs
|
|
||||||
where lrgr a b
|
|
||||||
| a > b = a
|
|
||||||
| otherwise = b
|
|
||||||
|
|
||||||
flatten :: [[a]] -> [a]
|
|
||||||
flatten [] = []
|
|
||||||
flatten (x:xs) = x ++ flatten xs
|
|
||||||
|
|
||||||
-- Note: the definition below is the same as: flatten' = foldr (++) []
|
|
||||||
flatten' :: [[a]] -> [a]
|
|
||||||
flatten' xss = flat xss []
|
|
||||||
where flat [] acc = acc
|
|
||||||
flat (y:ys) acc = let nacc = acc ++ y
|
|
||||||
in nacc `seq` flat ys nacc
|
|
||||||
|
|
||||||
-- Implementation of the square root function using fixed points *doesn't work*
|
|
||||||
sqrt' x = fix (\f y -> if ((y * y) - x) / x <= 0.0001 then y else y / x) x
|
|
||||||
|
|
||||||
-- Learning from https://en.wikibooks.org/wiki/Haskell/Existentially_quantified_types
|
|
||||||
data ShowBox = forall s. Show s => SB s
|
|
||||||
|
|
||||||
instance Show ShowBox where
|
|
||||||
show (SB a) = show a
|
|
||||||
|
|
||||||
type HList = [ShowBox]
|
|
||||||
|
|
||||||
heterogeniusList :: HList
|
|
||||||
heterogeniusList = [SB 1, SB ['a'..'c'], SB 'd', SB 3]
|
|
||||||
|
|
||||||
-- How do i pattern match on (SB a) when a would be a list of depth n
|
|
||||||
-- Is it possible to restrict ShowBox to only hold non-list values?
|
|
||||||
-- flattenHList :: HList -> HList
|
|
||||||
-- flattenHList [] = []
|
|
||||||
-- flattenHList (x:xs) =
|
|
||||||
|
|
||||||
-- Questions from the haskell wiki
|
|
||||||
-- url: http://www.haskell.org/haskellwiki/99_questions/1_to_10
|
|
||||||
|
|
||||||
-- 1
|
|
||||||
myLast :: [a] -> a
|
|
||||||
myLast lst = lst !! (len - 1)
|
|
||||||
where len = length lst
|
|
||||||
|
|
||||||
myLast2 :: [a] -> a
|
|
||||||
myLast2 [] = error "No last element!"
|
|
||||||
myLast2 (x:[]) = x
|
|
||||||
myLast2 (x:xs) = myLast2 xs
|
|
||||||
|
|
||||||
-- Blank main function (can test things here)
|
|
||||||
main :: IO ()
|
|
||||||
main = undefined
|
|
||||||
```
|
|
@ -1,30 +0,0 @@
|
|||||||
---
|
|
||||||
title: Another Sample Item
|
|
||||||
author: Collin J. Doering
|
|
||||||
date: 2013-10-18
|
|
||||||
description: An Article about linux and such
|
|
||||||
updated: 2013-11-26
|
|
||||||
tags: general, programming, linux
|
|
||||||
---
|
|
||||||
|
|
||||||
Hi there, this is news that rekahsoft presented to University of Waterloo and is awaiting their decision. And here's
|
|
||||||
a code sample of a simple program (the classic hello world):
|
|
||||||
|
|
||||||
``` {.haskell .numberLines .code-term}
|
|
||||||
main :: IO()
|
|
||||||
main = putStrLn "Hello, World"
|
|
||||||
```
|
|
||||||
|
|
||||||
Shields up. I recommend we transfer power to phasers and arm the photon torpedoes. Something strange on the detector circuit. The weapons must have disrupted our communicators. You saw something as tasty as meat, but inorganically materialized out of patterns used by our transporters. Captain, the most elementary and valuable statement in science, the beginning of wisdom, is 'I do not know.' All transporters off.
|
|
||||||
|
|
||||||
<!--more-->
|
|
||||||
|
|
||||||
**Below is more of the news item including a lorem ipsum.**
|
|
||||||
|
|
||||||
Run a manual sweep of anomalous airborne or electromagnetic readings. Radiation levels in our atmosphere have increased by 3,000 percent. Electromagnetic and subspace wave fronts approaching synchronization. What is the strength of the ship's deflector shields at maximum output? The wormhole's size and short period would make this a local phenomenon. Do you have sufficient data to compile a holographic simulation?
|
|
||||||
|
|
||||||
Exceeding reaction chamber thermal limit. We have begun power-supply calibration. Force fields have been established on all turbo lifts and crawlways. Computer, run a level-two diagnostic on warp-drive systems. Antimatter containment positive. Warp drive within normal parameters. I read an ion trail characteristic of a freighter escape pod. The bomb had a molecular-decay detonator. Detecting some unusual fluctuations in subspace frequencies.
|
|
||||||
|
|
||||||
Unidentified vessel travelling at sub warp speed, bearing 235.7. Fluctuations in energy readings from it, Captain. All transporters off. A strange set-up, but I'd say the graviton generator is depolarized. The dark colourings of the scrapes are the leavings of natural rubber, a type of non-conductive sole used by researchers experimenting with electricity. The molecules must have been partly de-phased by the anyon beam.
|
|
||||||
|
|
||||||
Resistance is futile.
|
|
@ -1,25 +0,0 @@
|
|||||||
---
|
|
||||||
title: Deploy Command Working
|
|
||||||
author: Collin J. Doering
|
|
||||||
date: 2013-10-30
|
|
||||||
description: An Article about programming in general
|
|
||||||
updated: 2013-11-26
|
|
||||||
tags: general, programming
|
|
||||||
---
|
|
||||||
|
|
||||||
I'm happy to announce another peice of bogus news! The deploy command is now functional! Yeah! Anwyays a Loren Ipsum is below.
|
|
||||||
Sensors indicate no shuttle or other ships in this sector. According to coordinates, we have travelled 7,000 light years and are located near the system J-25. Tractor beam released, sir. Force field maintaining our hull integrity. Damage report? Sections 27, 28 and 29 on decks four, five and six destroyed. Without our shields, at this range it is probable a photon detonation could destroy the Enterprise.
|
|
||||||
|
|
||||||
<!--more-->
|
|
||||||
|
|
||||||
These are the voyages of the Starship Enterprise. Its continuing mission, to explore strange new worlds, to seek out new life and new civilizations, to boldly go where no one has gone before. We need to neutralize the homing signal. Each unit has total environmental control, gravity, temperature, atmosphere, light, in a protective field. Sensors show energy readings in your area. We had a forced chamber explosion in the resonator coil. Field strength has increased by 3,000 percent.
|
|
||||||
|
|
||||||
Communication is not possible. The shuttle has no power. Using the gravitational pull of a star to slingshot back in time? We are going to Starbase Montgomery for Engineering consultations prompted by minor read-out anomalies. Probes have recorded unusual levels of geological activity in all five planetary systems. Assemble a team. Look at records of the Drema quadrant. Would these scans detect artificial transmissions as well as natural signals?
|
|
||||||
|
|
||||||
Exceeding reaction chamber thermal limit. We have begun power-supply calibration. Force fields have been established on all turbo lifts and crawlways. Computer, run a level-two diagnostic on warp-drive systems. Antimatter containment positive. Warp drive within normal parameters. I read an ion trail characteristic of a freighter escape pod. The bomb had a molecular-decay detonator. Detecting some unusual fluctuations in subspace frequencies.
|
|
||||||
|
|
||||||
Deflector power at maximum. Energy discharge in six seconds. Warp reactor core primary coolant failure. Fluctuate phaser resonance frequencies. Resistance is futile. Recommend we adjust shield harmonics to the upper EM band when proceeding. These appear to be some kind of power-wave-guide conduits which allow them to work collectively as they perform ship functions. Increase deflector modulation to upper frequency band.
|
|
||||||
|
|
||||||
Run a manual sweep of anomalous airborne or electromagnetic readings. Radiation levels in our atmosphere have increased by 3,000 percent. Electromagnetic and subspace wave fronts approaching synchronization. What is the strength of the ship's deflector shields at maximum output? The wormhole's size and short period would make this a local phenomenon. Do you have sufficient data to compile a holographic simulation?
|
|
||||||
|
|
||||||
Resistance is futile.
|
|
@ -1,38 +0,0 @@
|
|||||||
---
|
|
||||||
title: Math
|
|
||||||
author: Collin J. Doering
|
|
||||||
date: 2013-12-08
|
|
||||||
description: An Article about math
|
|
||||||
updated: 2013-12-08
|
|
||||||
tags: math
|
|
||||||
---
|
|
||||||
Exceeding reaction chamber thermal limit. We have begun power-supply calibration. Force fields have been established on all turbo lifts and crawlways. Computer, run a level-two diagnostic on warp-drive systems. Antimatter containment positive. Warp drive within normal parameters. I read an ion trail characteristic of a freighter escape pod. The bomb had a molecular-decay detonator. Detecting some unusual fluctuations in subspace frequencies.
|
|
||||||
|
|
||||||
Unidentified vessel travelling at sub warp speed, bearing 235.7. Fluctuations in energy readings from it, Captain. All transporters off. A strange set-up, but I'd say the graviton generator is depolarized. The dark colourings of the scrapes are the leavings of natural rubber, a type of non-conductive sole used by researchers experimenting with electricity. The molecules must have been partly de-phased by the anyon beam.
|
|
||||||
|
|
||||||
And finally here is a touch of math:
|
|
||||||
$e^x = \sum_{n=0}^\infty \frac{x^n}{n!}$
|
|
||||||
|
|
||||||
<!--more-->
|
|
||||||
Below should be some math if everything worked out alright
|
|
||||||
|
|
||||||
$a^2 + b^2 = c^2$
|
|
||||||
|
|
||||||
$v(t) = v_0 + \frac{1}{2}at^2$
|
|
||||||
|
|
||||||
$\gamma = \frac{1}{\sqrt{1 - v^2/c^2}}$
|
|
||||||
|
|
||||||
$\exists x \forall y (Rxy \equiv Ryx)$
|
|
||||||
|
|
||||||
$p \wedge q \models p$
|
|
||||||
|
|
||||||
$\Box\diamond p\equiv\diamond p$
|
|
||||||
|
|
||||||
$\int_{0}^{1} x dx = \left[ \frac{1}{2}x^2 \right]_{0}^{1} = \frac{1}{2}$
|
|
||||||
|
|
||||||
$e^x = \sum_{n=0}^\infty \frac{x^n}{n!} = \lim_{n\rightarrow\infty} (1+x/n)^n$
|
|
||||||
|
|
||||||
this is some subscripted~sub~ stuff^hello^.
|
|
||||||
~~this is struck out~~
|
|
||||||
|
|
||||||
$x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}$
|
|
@ -1,26 +0,0 @@
|
|||||||
---
|
|
||||||
title: More Sample News
|
|
||||||
author: Collin J. Doering
|
|
||||||
date: 2013-10-11
|
|
||||||
description: An Article about linux
|
|
||||||
updated: 2013-11-26
|
|
||||||
tags: linux
|
|
||||||
---
|
|
||||||
|
|
||||||
This is yet again another peice of sample news. This should be removed before deployment! Hers a list just for fun
|
|
||||||
|
|
||||||
- first item
|
|
||||||
- second item
|
|
||||||
- third and final item
|
|
||||||
|
|
||||||
1. first item
|
|
||||||
2. second item
|
|
||||||
3. third item
|
|
||||||
|
|
||||||
Exceeding reaction chamber thermal limit. We have begun power-supply calibration. Force fields have been established on all turbo lifts and crawlways. Computer, run a level-two diagnostic on warp-drive systems. Antimatter containment positive. Warp drive within normal parameters. I read an ion trail characteristic of a freighter escape pod. The bomb had a molecular-decay detonator. Detecting some unusual fluctuations in subspace frequencies.
|
|
||||||
|
|
||||||
<!--more-->
|
|
||||||
|
|
||||||
Now what are the possibilities of warp drive? Cmdr Riker's nervous system has been invaded by an unknown microorganism. The organisms fuse to the nerve, intertwining at the molecular level. That's why the transporter's biofilters couldn't extract it. The vertex waves show a K-complex corresponding to an REM state. The engineering section's critical. Destruction is imminent. Their robes contain ultritium, highly explosive, virtually undetectable by your transporter.
|
|
||||||
|
|
||||||
Communication is not possible. The shuttle has no power. Using the gravitational pull of a star to slingshot back in time? We are going to Starbase Montgomery for Engineering consultations prompted by minor read-out anomalies. Probes have recorded unusual levels of geological activity in all five planetary systems. Assemble a team. Look at records of the Drema quadrant. Would these scans detect artificial transmissions as well as natural signals?
|
|
@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
title: New News Item
|
|
||||||
author: Collin J. Doering
|
|
||||||
date: 2013-10-25
|
|
||||||
description: An Article about programmign
|
|
||||||
updated: 2013-11-26
|
|
||||||
tags: programming
|
|
||||||
---
|
|
||||||
|
|
||||||
Why hello! This is some news! And a link to a [site](http://theundergroundmouthpeace.org)
|
|
||||||
|
|
||||||
Unidentified vessel travelling at sub warp speed, bearing 235.7. Fluctuations in energy readings from it, Captain. All transporters off. A strange set-up, but I'd say the graviton generator is depolarized. The dark colourings of the scrapes are the leavings of natural rubber, a type of non-conductive sole used by researchers experimenting with electricity. The molecules must have been partly de-phased by the anyon beam.
|
|
||||||
|
|
||||||
<!--more-->
|
|
||||||
|
|
||||||
Unidentified vessel travelling at sub warp speed, bearing 235.7. Fluctuations in energy readings from it, Captain. All transporters off. A strange set-up, but I'd say the graviton generator is depolarized. The dark colourings of the scrapes are the leavings of natural rubber, a type of non-conductive sole used by researchers experimenting with electricity. The molecules must have been partly de-phased by the anyon beam.
|
|
||||||
|
|
||||||
Sensors indicate human life forms 30 meters below the planet's surface. Stellar flares are increasing in magnitude and frequency. Set course for Rhomboid Dronegar 006, warp seven. There's no evidence of an advanced communication network. Total guidance system failure, with less than 24 hours' reserve power. Shield effectiveness has been reduced 12 percent. We have covered the area in a spherical pattern which a ship without warp drive could cross in the given time.
|
|
||||||
|
|
||||||
Deflector power at maximum. Energy discharge in six seconds. Warp reactor core primary coolant failure. Fluctuate phaser resonance frequencies. Resistance is futile. Recommend we adjust shield harmonics to the upper EM band when proceeding. These appear to be some kind of power-wave-guide conduits which allow them to work collectively as they perform ship functions. Increase deflector modulation to upper frequency band.
|
|
@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: Post With No Teaser!
|
|
||||||
author: Collin J. Doering
|
|
||||||
date: 2013-12-10
|
|
||||||
description: An Article about nothing really
|
|
||||||
updated: 2013-12-10
|
|
||||||
tags: general, programming, linux
|
|
||||||
---
|
|
||||||
|
|
||||||
Run a manual sweep of anomalous airborne or electromagnetic readings. Radiation levels in our atmosphere have increased by 3,000 percent. Electromagnetic and subspace wave fronts approaching synchronization. What is the strength of the ship's deflector shields at maximum output? The wormhole's size and short period would make this a local phenomenon. Do you have sufficient data to compile a holographic simulation?
|
|
||||||
|
|
||||||
Exceeding reaction chamber thermal limit. We have begun power-supply calibration. Force fields have been established on all turbo lifts and crawlways. Computer, run a level-two diagnostic on warp-drive systems. Antimatter containment positive. Warp drive within normal parameters. I read an ion trail characteristic of a freighter escape pod. The bomb had a molecular-decay detonator. Detecting some unusual fluctuations in subspace frequencies.
|
|
@ -1,18 +0,0 @@
|
|||||||
---
|
|
||||||
title: Sample News
|
|
||||||
author: Collin J. Doering
|
|
||||||
date: 2013-10-11
|
|
||||||
description: An Article about general
|
|
||||||
updated: 2013-11-26
|
|
||||||
tags: general
|
|
||||||
---
|
|
||||||
|
|
||||||
This is some sample news with a link to the new [homepage](http://blog.rekahsoft.ca)
|
|
||||||
|
|
||||||
Communication is not possible. The shuttle has no power. Using the gravitational pull of a star to slingshot back in time? We are going to Starbase Montgomery for Engineering consultations prompted by minor read-out anomalies. Probes have recorded unusual levels of geological activity in all five planetary systems. Assemble a team. Look at records of the Drema quadrant. Would these scans detect artificial transmissions as well as natural signals?
|
|
||||||
|
|
||||||
Now what are the possibilities of warp drive? Cmdr Riker's nervous system has been invaded by an unknown microorganism. The organisms fuse to the nerve, intertwining at the molecular level. That's why the transporter's biofilters couldn't extract it. The vertex waves show a K-complex corresponding to an REM state. The engineering section's critical. Destruction is imminent. Their robes contain ultritium, highly explosive, virtually undetectable by your transporter.
|
|
||||||
|
|
||||||
<!--more-->
|
|
||||||
|
|
||||||
Exceeding reaction chamber thermal limit. We have begun power-supply calibration. Force fields have been established on all turbo lifts and crawlways. Computer, run a level-two diagnostic on warp-drive systems. Antimatter containment positive. Warp drive within normal parameters. I read an ion trail characteristic of a freighter escape pod. The bomb had a molecular-decay detonator. Detecting some unusual fluctuations in subspace frequencies.
|
|
@ -1,357 +0,0 @@
|
|||||||
---
|
|
||||||
title: Some Scheming
|
|
||||||
author: Collin J. Doering
|
|
||||||
date: 2013-12-08
|
|
||||||
description: An Article about scheme
|
|
||||||
updated: 2013-12-08
|
|
||||||
tags: programming, scheme
|
|
||||||
---
|
|
||||||
|
|
||||||
Unidentified vessel travelling at sub warp speed, bearing 235.7. Fluctuations in energy readings from it, Captain. All transporters off. A strange set-up, but I'd say the graviton generator is depolarized. The dark colourings of the scrapes are the leavings of natural rubber, a type of non-conductive sole used by researchers experimenting with electricity. The molecules must have been partly de-phased by the anyon beam.
|
|
||||||
|
|
||||||
``` {.scheme .code-term .numberLines}
|
|
||||||
;; fibinocci sequences
|
|
||||||
;; Very slow...big-O anaylsis of O(2^n) (not 100% sure tho)
|
|
||||||
(define (fib n)
|
|
||||||
(cond [(<= n 0) 0]
|
|
||||||
[(= n 1) 1]
|
|
||||||
[else (+ (fib (- n 1)) (fib (- n 2)))]))
|
|
||||||
|
|
||||||
;; fibinocci sequence...but implemented smart ;) haven't looked at the big-O analysis yet
|
|
||||||
(define (fast-fib n)
|
|
||||||
(letrec ([fib-lst empty]
|
|
||||||
[gen-fib (lambda (n x)
|
|
||||||
(cond [(> x n) (first fib-lst)]
|
|
||||||
[(= x 0) (set! fib-lst (cons 0 empty))
|
|
||||||
(gen-fib n (+ x 1))]
|
|
||||||
[(= x 1) (set! fib-lst (cons 1 fib-lst))
|
|
||||||
(gen-fib n (+ x 1))]
|
|
||||||
[else (let ([fibx (+ (first fib-lst) (second fib-lst))])
|
|
||||||
(set! fib-lst (cons fibx fib-lst))
|
|
||||||
(gen-fib n (+ x 1)))]))])
|
|
||||||
(gen-fib n 0)))
|
|
||||||
|
|
||||||
;; another fibinocci sequence function but with significantly improved memory performance :D (TODO: big-O analysis)
|
|
||||||
(define (fast-mem-fib n)
|
|
||||||
(letrec ([fib-dot-lst empty]
|
|
||||||
[gen-fib (lambda (n x)
|
|
||||||
(cond [(> x n) (car fib-dot-lst)]
|
|
||||||
[(= x 0) (set! fib-dot-lst (cons 0 empty))
|
|
||||||
(gen-fib n (+ x 1))]
|
|
||||||
[(= x 1) (set! fib-dot-lst (cons 1 0))
|
|
||||||
(gen-fib n (+ x 1))]
|
|
||||||
[else (let* ([fst (car fib-dot-lst)]
|
|
||||||
[scd (cdr fib-dot-lst)]
|
|
||||||
[fibx (+ fst scd)])
|
|
||||||
(set! fib-dot-lst (cons fibx fst))
|
|
||||||
(gen-fib n (+ x 1)))]))])
|
|
||||||
(gen-fib n 0)))
|
|
||||||
```
|
|
||||||
|
|
||||||
<!--more-->
|
|
||||||
Sensors indicate human life forms 30 meters below the planet's surface. Stellar flares are increasing in magnitude and frequency. Set course for Rhomboid Dronegar 006, warp seven. There's no evidence of an advanced communication network. Total guidance system failure, with less than 24 hours' reserve power. Shield effectiveness has been reduced 12 percent. We have covered the area in a spherical pattern which a ship without warp drive could cross in the given time.
|
|
||||||
|
|
||||||
Deflector power at maximum. Energy discharge in six seconds. Warp reactor core primary coolant failure. Fluctuate phaser resonance frequencies. Resistance is futile. Recommend we adjust shield harmonics to the upper EM band when proceeding. These appear to be some kind of power-wave-guide conduits which allow them to work collectively as they perform ship functions. Increase deflector modulation to upper frequency band.
|
|
||||||
``` {.scheme .code-term .numberLines}
|
|
||||||
#lang racket
|
|
||||||
|
|
||||||
;; File: rdm.rkt
|
|
||||||
;; Date: Oct 25, 2010
|
|
||||||
;; Author: Collin J. Doering <rekahsoft@gmail.com
|
|
||||||
;; Description: Random source file to experiment while learning racket (plt scheme)
|
|
||||||
|
|
||||||
;; factorial int[>=0] -> int[>=0]
|
|
||||||
;; Purpose: returns the factorial of the given positive (or zero) integer
|
|
||||||
;; Examples/Tests:
|
|
||||||
|
|
||||||
(define (factorial n)
|
|
||||||
(define (factorial-helper n acc)
|
|
||||||
(cond [(<= n 1) acc]
|
|
||||||
[else (factorial-helper (- n 1) (* acc n))]))
|
|
||||||
(if (integer? n)
|
|
||||||
(factorial-helper n 1)
|
|
||||||
(error "Expects argument to be an integer!")))
|
|
||||||
|
|
||||||
(define factorial!
|
|
||||||
(letrec ([fact-helper (lambda (n acc)
|
|
||||||
(if (<= n 1) acc (fact-helper (- n 1) (* acc n))))]
|
|
||||||
[fact! (lambda (n)
|
|
||||||
(fact-helper n 1))])
|
|
||||||
fact!))
|
|
||||||
|
|
||||||
(define (factorial-close [n 0])
|
|
||||||
(letrec ([acc 1]
|
|
||||||
[x 1]
|
|
||||||
[fac-c (lambda ()
|
|
||||||
(cond [(> x n) (set! n (+ n 1)) acc]
|
|
||||||
[else (set! acc (* x acc))
|
|
||||||
(set! x (+ x 1))
|
|
||||||
(fac-c)]))])
|
|
||||||
fac-c))
|
|
||||||
|
|
||||||
(define (sum-digits n [base 10])
|
|
||||||
(letrec ([sum-digits-helper
|
|
||||||
(lambda (n acc)
|
|
||||||
(cond [(zero? (floor (/ n base))) (+ acc (remainder n base))]
|
|
||||||
[else (sum-digits-helper (floor (/ n base)) (+ acc (remainder n base)))]))])
|
|
||||||
(sum-digits-helper n 0)))
|
|
||||||
|
|
||||||
;; fibinocci sequences
|
|
||||||
;; Very slow...big-O anaylsis of O(2^n) (not 100% sure tho)
|
|
||||||
(define (fib n)
|
|
||||||
(cond [(<= n 0) 0]
|
|
||||||
[(= n 1) 1]
|
|
||||||
[else (+ (fib (- n 1)) (fib (- n 2)))]))
|
|
||||||
|
|
||||||
;; fibinocci sequence...but implemented smart ;) haven't looked at the big-O analysis yet
|
|
||||||
(define (fast-fib n)
|
|
||||||
(letrec ([fib-lst empty]
|
|
||||||
[gen-fib (lambda (n x)
|
|
||||||
(cond [(> x n) (first fib-lst)]
|
|
||||||
[(= x 0) (set! fib-lst (cons 0 empty))
|
|
||||||
(gen-fib n (+ x 1))]
|
|
||||||
[(= x 1) (set! fib-lst (cons 1 fib-lst))
|
|
||||||
(gen-fib n (+ x 1))]
|
|
||||||
[else (let ([fibx (+ (first fib-lst) (second fib-lst))])
|
|
||||||
(set! fib-lst (cons fibx fib-lst))
|
|
||||||
(gen-fib n (+ x 1)))]))])
|
|
||||||
(gen-fib n 0)))
|
|
||||||
|
|
||||||
;; another fibinocci sequence function but with significantly improved memory performance :D (TODO: big-O analysis)
|
|
||||||
(define (fast-mem-fib n)
|
|
||||||
(letrec ([fib-dot-lst empty]
|
|
||||||
[gen-fib (lambda (n x)
|
|
||||||
(cond [(> x n) (car fib-dot-lst)]
|
|
||||||
[(= x 0) (set! fib-dot-lst (cons 0 empty))
|
|
||||||
(gen-fib n (+ x 1))]
|
|
||||||
[(= x 1) (set! fib-dot-lst (cons 1 0))
|
|
||||||
(gen-fib n (+ x 1))]
|
|
||||||
[else (let* ([fst (car fib-dot-lst)]
|
|
||||||
[scd (cdr fib-dot-lst)]
|
|
||||||
[fibx (+ fst scd)])
|
|
||||||
(set! fib-dot-lst (cons fibx fst))
|
|
||||||
(gen-fib n (+ x 1)))]))])
|
|
||||||
(gen-fib n 0)))
|
|
||||||
|
|
||||||
;; fibinocci closure..pretty much the same as fast-mem-fib but returns a gen-fib like function that takes
|
|
||||||
;; no paramters but instead encapsulates the values for n and x thus creating a fibinocci closure starting at n
|
|
||||||
(define (fibc [n 0])
|
|
||||||
(letrec ([fib-dot-lst empty]
|
|
||||||
[x 0]
|
|
||||||
[gen-fib-c (lambda ()
|
|
||||||
(cond [(> x n) (set! n (+ n 1))
|
|
||||||
(car fib-dot-lst)]
|
|
||||||
[(= x 0) (set! fib-dot-lst (cons 0 empty))
|
|
||||||
(set! x (+ x 1))
|
|
||||||
(gen-fib-c)]
|
|
||||||
[(= x 1) (set! fib-dot-lst (cons 1 0))
|
|
||||||
(set! x (+ x 1))
|
|
||||||
(gen-fib-c)]
|
|
||||||
[else (let* ([fst (car fib-dot-lst)]
|
|
||||||
[scd (cdr fib-dot-lst)]
|
|
||||||
[fibx (+ fst scd)])
|
|
||||||
(set! fib-dot-lst (cons fibx fst))
|
|
||||||
(set! x (+ x 1))
|
|
||||||
(gen-fib-c))]))])
|
|
||||||
gen-fib-c))
|
|
||||||
|
|
||||||
;; pow num num -> num
|
|
||||||
;; Purpose: given two real numbers x and n returns x^n
|
|
||||||
;; Examples/Tests:
|
|
||||||
|
|
||||||
(define (pow x n)
|
|
||||||
(define (pow-helper x n acc)
|
|
||||||
(cond [(= n 0) acc]
|
|
||||||
[(> n 0) (pow-helper x (- n 1) (* acc x))]
|
|
||||||
[(< n 0) (pow-helper x (+ n 1) (* acc (/ 1 x)))]))
|
|
||||||
(pow-helper x n 1))
|
|
||||||
|
|
||||||
;; Expandtion of the below macro:
|
|
||||||
;; (define (natural-number? n)
|
|
||||||
;; (if (and (interger? n) (>= n 0) #t #f)))
|
|
||||||
|
|
||||||
(define natural-number?
|
|
||||||
(lambda (n)
|
|
||||||
(if (and (integer? n) (>= n 0)) #t #f)))
|
|
||||||
|
|
||||||
(define average-num
|
|
||||||
(lambda lst
|
|
||||||
(/ (apply + lst) (length lst))))
|
|
||||||
|
|
||||||
(define (average-list lst)
|
|
||||||
(define (sum-list lst acc)
|
|
||||||
(cond [(empty? lst) acc]
|
|
||||||
[else (sum-list (rest lst) (+ acc (first lst)))]))
|
|
||||||
(/ (sum-list lst 0) (length lst)))
|
|
||||||
|
|
||||||
;; increasing common interval
|
|
||||||
(define (icd-interval i j d)
|
|
||||||
(define (icd-interval-helper i j d acc)
|
|
||||||
(cond [(> i j) acc]
|
|
||||||
[else (icd-interval-helper (+ i d) j d (cons i acc))]))
|
|
||||||
(if (> i j)
|
|
||||||
(error "i > j for a increasing common interval list to be generated!")
|
|
||||||
(reverse (icd-interval-helper i j d empty))))
|
|
||||||
|
|
||||||
;; interval num num -> listof(num)
|
|
||||||
;; Purpose: Given two
|
|
||||||
(define (interval i j)
|
|
||||||
(define (interval-helper i j acc)
|
|
||||||
(cond [(> i j) acc]
|
|
||||||
[else (interval-helper (+ i 1) j (cons i acc))]))
|
|
||||||
(reverse (interval-helper i j empty)))
|
|
||||||
|
|
||||||
;; common poduct interval
|
|
||||||
(define (cp-interval i j m)
|
|
||||||
(map (lambda (x) (if (= x 0) x (* m x))) (interval i j)))
|
|
||||||
|
|
||||||
;; letrec is cool :P
|
|
||||||
;; (letrec [(fact! (lambda (n) (if (<= n 1) 1 (* n (fact! (- n 1))))))]
|
|
||||||
;; (fact! 5))
|
|
||||||
|
|
||||||
;; take a looksi at racket/tcp and racket/ssl
|
|
||||||
|
|
||||||
(define (client)
|
|
||||||
(let-values ([(s-in s-out) (tcp-connect "localhost" 1342)])
|
|
||||||
(let ([read-and-display
|
|
||||||
(lambda (in-port)
|
|
||||||
(let ([responce (read in-port)])
|
|
||||||
(display responce)
|
|
||||||
(newline)))])
|
|
||||||
(read-and-display s-in)
|
|
||||||
(write (read-line (current-input-port) 'return-linefeed) s-out)
|
|
||||||
(close-output-port s-out)
|
|
||||||
(read-and-display s-in)
|
|
||||||
(close-input-port s-in))))
|
|
||||||
|
|
||||||
;; server
|
|
||||||
(define listener (tcp-listen 1342))
|
|
||||||
(let echo-server ()
|
|
||||||
(define-values (in out) (tcp-accept listener))
|
|
||||||
(thread (lambda ()
|
|
||||||
(copy-port in out)
|
|
||||||
(close-output-port out)))
|
|
||||||
(echo-server))
|
|
||||||
|
|
||||||
;; server (Version 2)
|
|
||||||
(define listener (tcp-listen 1342))
|
|
||||||
(define (server)
|
|
||||||
(let-values ([(in out) (tcp-accept listener)])
|
|
||||||
(thread (lambda ()
|
|
||||||
(copy-port in out)
|
|
||||||
(close-output-port out))))
|
|
||||||
(server))
|
|
||||||
|
|
||||||
(define (read-it-all f-in [acc ""])
|
|
||||||
(let ([line (read-line f-in)])
|
|
||||||
(if (eof-object? line) (begin acc (close-input-port f-in)) (read-it-all f-in (string-append acc line "\n")))))
|
|
||||||
|
|
||||||
;; takes a lowercase char and returns it shifted by 13 characters
|
|
||||||
(define (rot-char char)
|
|
||||||
(cond [(or (char-symbolic? char) (char-numeric? char) (char-whitespace? char)) char]
|
|
||||||
[(< (char->integer char) 109) (integer->char (modulo (+ (char->integer char) 13) 122))]
|
|
||||||
[else (integer->char (+ 96 (modulo (+ (char->integer char) 13) 122)))]))
|
|
||||||
|
|
||||||
(define (rot13 str)
|
|
||||||
(letrec ([rot13-helper (lambda (lst acc)
|
|
||||||
(cond [(empty? lst) acc]
|
|
||||||
[(char-upper-case? (first lst)) (rot13-helper (rest lst) (cons (char-upcase (rot-char (char-downcase (first lst)))) acc))]
|
|
||||||
[else (rot13-helper (rest lst) (cons (rot-char (first lst)) acc))]))])
|
|
||||||
(list->string (reverse (rot13-helper (string->list str) empty)))))
|
|
||||||
|
|
||||||
;; a much better written rot13 which takes advantage of testing intervals
|
|
||||||
(define (best-rot13 str)
|
|
||||||
(letrec
|
|
||||||
;; add-to-char char int -> char
|
|
||||||
;; Purpose: takes the unicode value of the given char and adds n evauluating to the char the additions represents
|
|
||||||
([add-to-char (lambda (char n)
|
|
||||||
(integer->char (+ n (char->integer char))))]
|
|
||||||
;; best-rot listof(char) (or listof(char) acc) -> listof(char)
|
|
||||||
;; Purpose: Given a list of characters returns the rot13 representation
|
|
||||||
[best-rot
|
|
||||||
(lambda (lst acc)
|
|
||||||
(cond [(empty? lst) acc]
|
|
||||||
[(<= 65 (char->integer (first lst)) 77) (best-rot (rest lst) (cons (add-to-char (first lst) 13) acc))]
|
|
||||||
[(<= 78 (char->integer (first lst)) 90) (best-rot (rest lst) (cons (add-to-char (first lst) -13) acc))]
|
|
||||||
[(<= 97 (char->integer (first lst)) 109) (best-rot (rest lst) (cons (add-to-char (first lst) 13) acc))]
|
|
||||||
[(<= 110 (char->integer (first lst)) 122) (best-rot (rest lst) (cons (add-to-char (first lst) -13) acc))]
|
|
||||||
[else (best-rot (rest lst) (cons (first lst) acc))]))])
|
|
||||||
(list->string (reverse (best-rot (string->list str) empty)))))
|
|
||||||
|
|
||||||
;; map defined in terms of foldr
|
|
||||||
(define (foldr-map fn lst)
|
|
||||||
(foldr (lambda (x y) (cons (fn x) y)) empty lst))
|
|
||||||
|
|
||||||
(define (foldr-copy lst)
|
|
||||||
(foldr cons empty lst))
|
|
||||||
|
|
||||||
(define (compose fn1 fn2)
|
|
||||||
(lambda (x) (fn1 (fn2 x))))
|
|
||||||
|
|
||||||
(define (foldr-append lst1 lst2)
|
|
||||||
(foldr cons lst2 lst1))
|
|
||||||
|
|
||||||
(define (foldr-length lst)
|
|
||||||
(foldr (lambda (x y) (+ y 1)) 0 lst))
|
|
||||||
|
|
||||||
(define (foldr-sum lst)
|
|
||||||
(foldr + 0 lst))
|
|
||||||
|
|
||||||
;; broken..needs to know the number of digits of the number n
|
|
||||||
(define (nth-digit n i)
|
|
||||||
(let ([f (/ n (expt 10 (+ i 1)))])
|
|
||||||
(floor (* 10 (- f (floor f))))))
|
|
||||||
|
|
||||||
(define (merge xs ys)
|
|
||||||
(cond [(and (empty? xs) (empty? ys)) empty]
|
|
||||||
[(empty? xs) ys]
|
|
||||||
[(empty? ys) xs]
|
|
||||||
[(< (first xs) (first ys)) (cons (first xs) (merge (rest xs) ys))]
|
|
||||||
[(equal? (first xs) (first ys))
|
|
||||||
(cons (first xs) (cons (first ys) (merge (rest xs) (rest ys))))]
|
|
||||||
[else (cons (first ys) (merge xs (rest ys)))]))
|
|
||||||
|
|
||||||
|
|
||||||
(define (merge-sort xs)
|
|
||||||
(cond [(empty? xs) empty]
|
|
||||||
[(empty? (rest xs)) xs]
|
|
||||||
[else (merge (merge-sort (take xs (quotient (length xs) 2)))
|
|
||||||
(merge-sort (drop xs (quotient (length xs) 2))))]))
|
|
||||||
|
|
||||||
(define (append-all a b)
|
|
||||||
(cond [(and (list? a) (list? b)) (append a b)]
|
|
||||||
[(list? a) (append a (list b))]
|
|
||||||
[(list? b) (cons a b)]
|
|
||||||
[else (list a b)]))
|
|
||||||
|
|
||||||
(define (my-append xs ys)
|
|
||||||
(cond [(empty? xs) ys]
|
|
||||||
[else (cons (first xs) (my-append (rest xs) ys))]))
|
|
||||||
|
|
||||||
(define (my-append2 xs ys)
|
|
||||||
(define (my-append2-h sx acc)
|
|
||||||
(cond [(empty? sx) acc]
|
|
||||||
[else (my-append2-h (rest sx) (cons (first sx) acc))]))
|
|
||||||
(my-append2-h (reverse xs) ys))
|
|
||||||
|
|
||||||
(define (my-append3 xs ys)
|
|
||||||
(foldr cons ys xs))
|
|
||||||
|
|
||||||
;; TODO: do the big-oh analysis of the flatten functions below
|
|
||||||
(define (my-flatten xs)
|
|
||||||
(cond [(empty? xs) '()]
|
|
||||||
[(list? (first xs)) (append (my-flatten (first xs)) (my-flatten (rest xs)))]
|
|
||||||
[else (cons (first xs) (my-flatten (rest xs)))]))
|
|
||||||
|
|
||||||
(define (my-flatten2 xs)
|
|
||||||
(define (my-flatten2-h xs acc)
|
|
||||||
(cond [(empty? xs) acc]
|
|
||||||
[(list? (first xs))
|
|
||||||
(my-flatten2-h (rest xs) (append (my-flatten2-h (first xs) '()) acc))]
|
|
||||||
[else (my-flatten2-h (rest xs) (cons (first xs) acc))]))
|
|
||||||
(reverse (my-flatten2-h xs '())))
|
|
||||||
```
|
|
||||||
|
|
||||||
Sensors indicate human life forms 30 meters below the planet's surface. Stellar flares are increasing in magnitude and frequency. Set course for Rhomboid Dronegar 006, warp seven. There's no evidence of an advanced communication network. Total guidance system failure, with less than 24 hours' reserve power. Shield effectiveness has been reduced 12 percent. We have covered the area in a spherical pattern which a ship without warp drive could cross in the given time.
|
|
||||||
|
|
||||||
Deflector power at maximum. Energy discharge in six seconds. Warp reactor core primary coolant failure. Fluctuate phaser resonance frequencies. Resistance is futile. Recommend we adjust shield harmonics to the upper EM band when proceeding. These appear to be some kind of power-wave-guide conduits which allow them to work collectively as they perform ship functions. Increase deflector modulation to upper frequency band.
|
|
@ -1,59 +0,0 @@
|
|||||||
---
|
|
||||||
title: The RekahSoft website is nearing completion!
|
|
||||||
author: Collin J. Doering
|
|
||||||
date: 2013-10-29
|
|
||||||
description: An Article in more detail about general
|
|
||||||
updated: 2013-11-26
|
|
||||||
tags: general
|
|
||||||
---
|
|
||||||
|
|
||||||
[This](/) website is almost done. Well..the content and theming still need to be completed, but
|
|
||||||
for the most part things are complete.
|
|
||||||
|
|
||||||
Testing links: [first post](/posts/first-post.html)
|
|
||||||
|
|
||||||
Run a manual sweep of anomalous airborne or electromagnetic readings. Radiation levels in our
|
|
||||||
atmosphere have increased by 3,000 percent. Electromagnetic and subspace wave fronts
|
|
||||||
approaching synchronization. What is the strength of the ship's deflector shields at maximum
|
|
||||||
output? The wormhole's size and short period would make this a local phenomenon. Do you have
|
|
||||||
sufficient data to compile a holographic simulation?
|
|
||||||
|
|
||||||
<!--more-->
|
|
||||||
|
|
||||||
These are the voyages of the Starship Enterprise. Its continuing mission, to explore strange
|
|
||||||
new worlds, to seek out new life and new civilizations, to boldly go where no one has gone
|
|
||||||
before. We need to neutralize the homing signal. Each unit has total environmental control,
|
|
||||||
gravity, temperature, atmosphere, light, in a protective field. Sensors show energy readings in
|
|
||||||
your area. We had a forced chamber explosion in the resonator coil. Field strength has
|
|
||||||
increased by 3,000 percent.
|
|
||||||
|
|
||||||
I have reset the sensors to scan for frequencies outside the usual range. By emitting harmonic
|
|
||||||
vibrations to shatter the lattices. We will monitor and adjust the frequency of the resonators.
|
|
||||||
He has this ability of instantly interpreting and extrapolating any verbal communication he
|
|
||||||
hears. It may be due to the envelope over the structure, causing hydrogen-carbon helix patterns
|
|
||||||
throughout. I'm comparing the molecular integrity of that bubble against our phasers.
|
|
||||||
|
|
||||||
Sensors indicate no shuttle or other ships in this sector. According to coordinates, we have
|
|
||||||
travelled 7,000 light years and are located near the system J-25. Tractor beam released, sir.
|
|
||||||
Force field maintaining our hull integrity. Damage report? Sections 27, 28 and 29 on decks
|
|
||||||
four, five and six destroyed. Without our shields, at this range it is probable a photon
|
|
||||||
detonation could destroy the Enterprise.
|
|
||||||
|
|
||||||
Exceeding reaction chamber thermal limit. We have begun power-supply calibration. Force fields
|
|
||||||
have been established on all turbo lifts and crawlways. Computer, run a level-two diagnostic on
|
|
||||||
warp-drive systems. Antimatter containment positive. Warp drive within normal parameters. I
|
|
||||||
read an ion trail characteristic of a freighter escape pod. The bomb had a molecular-decay
|
|
||||||
detonator. Detecting some unusual fluctuations in subspace frequencies.
|
|
||||||
|
|
||||||
Unidentified vessel travelling at sub warp speed, bearing 235.7. Fluctuations in energy
|
|
||||||
readings from it, Captain. All transporters off. A strange set-up, but I'd say the graviton
|
|
||||||
generator is depolarized. The dark colourings of the scrapes are the leavings of natural
|
|
||||||
rubber, a type of non-conductive sole used by researchers experimenting with electricity. The
|
|
||||||
molecules must have been partly de-phased by the anyon beam.
|
|
||||||
|
|
||||||
Now what are the possibilities of warp drive? Cmdr Riker's nervous system has been invaded by
|
|
||||||
an unknown microorganism. The organisms fuse to the nerve, intertwining at the molecular level.
|
|
||||||
That's why the transporter's biofilters couldn't extract it. The vertex waves show a K-complex
|
|
||||||
corresponding to an REM state. The engineering section's critical. Destruction is imminent.
|
|
||||||
Their robes contain ultritium, highly explosive, virtually undetectable by your transporter.
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user