318,679 Plays

alfred-f-jones-world-hero:

fuck-benedict-cumberbatch:

THIS IS THE MO St„ TIMPORATN POS T

(Source: xoxo-gamer, via kr-studios)

50,698 notes

Subtyping and Lenses

Just worked out that, as far as I can tell, the operations defined for a subtyping relation a <: b can be directly captured by a Lens' a b.

Namely the operations:

view : (a <: b) -> a -> b
over : (a <: b) -> (b -> b) -> a -> a

Recall that a Lens' can be defined as such:

type Lens s t a b = forall f. Functor f => (a -> f b) -> s -> f t
type Lens' s a = Lens s s a a

A brief subtyping example:

--  Assuming
Fruit : Type
Apple : Type
apple : Apple

--  An Apple is a Fruit
rel : Apple <: Fruit

--  Given an Apple we can soundly view it as a Fruit
view rel : Apple -> Fruit
view rel apple : Fruit

--  If we can transform a Fruit, then we can trivially transform an Apple
f : Fruit -> Fruit
over rel : (Fruit -> Fruit) -> Apple -> Apple
over rel f : Apple -> Apple
over rel f apple : Apple

view and over are functions that work with Lens.

Neat.

1 note

trigonometry-is-my-bitch:

"Glassified" Ruler by MIT Media Lab Automatically Measures Angles, Volume, and Shape Properties.
[source]

trigonometry-is-my-bitch:

"Glassified" Ruler by MIT Media Lab Automatically Measures Angles, Volume, and Shape Properties.

[source]

(via superiorvintage)

1,470 notes

septagonstudios:

Richard Davies

septagonstudios:

Richard Davies

538 notes

hyrodium:

Inspired by this twocubes’ post and asked to make a animation of it, I made a gif.

(via spring-of-mathematics)

2,097 notes

Quick attempt at https://www.codeeval.com/browse/156/

My approach uses State and its associated Applicative instance along with traverse - just for fun.

I’m a Haskell dabbler. I’ve never written anything substantial with it - this is the first time I’ve ever actually used State and traverse since learning about them.

import Data.Traversable (Traversable, traverse)
import Data.Char (toUpper, toLower, isLetter)
import Control.Applicative ((<$>), pure)
import Control.Monad.State (State, state, evalState)

--  Retrieves the next case and negates the state
nextCase :: State Bool Bool
nextCase = state (\upper -> (upper, not upper))

--  Apply a case to a given letter
applyCase :: Char -> Bool -> Char
applyCase letter upper = (if upper then toUpper else toLower) letter

--  Statefully process a given character.  If the character is a letter, we
--  apply and switch cases.  Otherwise leave it as is.
processChar :: Char -> State Bool Char
processChar chr = if isLetter chr then applyCase chr <$> nextCase else pure chr

--  Process a traversable of characters by alternating upper and lower case
--  for just the letter characters
caseify :: Traversable t => t Char -> t Char
caseify chrs = evalState (traverse processChar chrs) True

With the following test case:

input :: [String]
input = ["To be, or not to be: that is the question.",
         "Whether 'tis nobler in the mind to suffer",
         "The slings and arrows of outrageous fortune,",
         "Or to take arms against a sea of troubles,",
         "And by opposing end them? To die: to sleep."]

test :: IO ()
test = mapM_ (putStrLn . caseify) input

Output of running test:

To Be, Or NoT tO bE: tHaT iS tHe QuEsTiOn.
WhEtHeR 'tIs NoBlEr In ThE mInD tO sUfFeR
ThE sLiNgS aNd ArRoWs Of OuTrAgEoUs FoRtUnE,
Or To TaKe ArMs AgAiNsT a SeA oF tRoUbLeS,
AnD bY oPpOsInG eNd ThEm? To DiE: tO sLeEp.
0 notes

explosm:

By @TheKrisWilson. Get your buns over to http://www.explosm.net/comics and roll around in those comics! Get ‘um all over ya!

explosm:

By . Get your buns over to  and roll around in those comics! Get ‘um all over ya!

(via kr-studios)

1,091 notes

gjmueller:

New device allows brain to bypass spinal cord, move paralyzed limbs

For the first time ever, a paralyzed man can move his fingers and hand with his own thoughts thanks to a new device. A 23-year-old quadriplegic is the first patient to use Neurobridge, an electronic neural bypass for spinal cord injuries that reconnects the brain directly to muscles, allowing voluntary and functional control of a paralyzed limb.

gjmueller:

New device allows brain to bypass spinal cord, move paralyzed limbs

For the first time ever, a paralyzed man can move his fingers and hand with his own thoughts thanks to a new device. A 23-year-old quadriplegic is the first patient to use Neurobridge, an electronic neural bypass for spinal cord injuries that reconnects the brain directly to muscles, allowing voluntary and functional control of a paralyzed limb.

(via superiorvintage)

92,949 notes

mathani:

Take a smooth, closed convex curve and slide a chord of constant length around it. Meanwhile consider a point on the moving chord that divides it into parts of length a and b. This point also traces out a closed curve as the chord makes a round.
Now, what is the area between the curves? I had no idea. But by Holditch’s theorem, it is simply: π a b.
Amazing, right?

mathani:

Take a smooth, closed convex curve and slide a chord of constant length around it. Meanwhile consider a point on the moving chord that divides it into parts of length a and b. This point also traces out a closed curve as the chord makes a round.

Now, what is the area between the curves? I had no idea. But by Holditch’s theorem, it is simply: π a b.

Amazing, right?

(via albanhouse)

696 notes

meghabits:

[x]

(Source: sizvideos)

304,852 notes

jvmblog:

Building a DBMS in Scala - Tiark Rompf

3 notes

beesandbombs:

spinning dots

beesandbombs:

spinning dots

3,140 notes

study-hack:

Learned this the other day in BioPsych: 
The reason why flashcards are a great way to memorize concepts and terms is because when you study with them, you make your brain work hard to retrieve information from your memory.The more you do this, the better it stays in your long-term memory. 
—&gt; To remember things better, you must make yourself retrieve that information several times. This is also the reason why simply reading over your notes a thousand times won’t help you study. Because you’re not working hard to retrieve any information, the info is not consolidated in your long-term memory and stays in your working memory (only up to 5 seconds max). 
P.S. Sorry about the long absence! Last couple weeks of the quarter are crazy. 

study-hack:

Learned this the other day in BioPsych: 

The reason why flashcards are a great way to memorize concepts and terms is because when you study with them, you make your brain work hard to retrieve information from your memory.The more you do this, the better it stays in your long-term memory. 

—> To remember things better, you must make yourself retrieve that information several times. 

This is also the reason why simply reading over your notes a thousand times won’t help you study. Because you’re not working hard to retrieve any information, the info is not consolidated in your long-term memory and stays in your working memory (only up to 5 seconds max). 

P.S. Sorry about the long absence! Last couple weeks of the quarter are crazy. 

(via biognosis)

1,041 notes

caseylalonde:

ponderpretties:

The Deer God is a breathtaking 3d pixel art game that will challenge your religion and your platforming skills.”

You play as a stag, it has pretty music and everything is so so pretty.
This game is beautiful and you should pledge on its kickstarter- it has only a month remaining!

Correction - 7 Days. 5k from goal.

(via naysyrose)

34,074 notes

Haskell? Haha!

Cool t-shirt :P

0 notes