This file contains hidden or 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
simpleGet uri error ok = | |
do resp <- simpleHTTP req | |
either error | |
(\r -> | |
case rspCode r of | |
(2,_,_) -> ok (rspBody r)) | |
resp | |
where req=request urii | |
urii =fromJust $ parseURI uri | |
This file contains hidden or 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
main = do resp <- simpleHTTP request | |
case resp of | |
Left x -> print ("Error connecting: " ++ show x) | |
Right r -> | |
case rspCode r of | |
(2,_,_) -> | |
print $ ( valFromObj "statuses_count" | |
=<< decode (rspBody r) :: Result Int) | |
where | |
request=Request {rqURI = uriSadache, |
This file contains hidden or 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
let fibs@(h:tfibs)= 1:2:zipWith (+) fibs tfibs |
This file contains hidden or 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
lazy val xxxx={ println("initializing xxxx");1} | |
def getOne(x:Int):Int= 1 | |
println(getOne(xxxx)); |
This file contains hidden or 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
object looksLikeAFunction{ | |
def apply(s:String):Int=1 | |
} | |
object nowAFunction extends Function[String,Int]{ | |
def apply(s:String):Int=1 | |
} | |
object TestMethods { | |
implicit def functionToAnother(f:Function[String,Int]):Function[Int,String] = | |
(i:Int)=> f(i.toString()).toString() |
This file contains hidden or 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
type 'a SimpleType= F of (int ->'a-> 'a) | |
let get a = F(fun req -> id) | |
[<GeneralizableValue>] | |
let oops2<'T> : SimpleType<'T> = get "" |
This file contains hidden or 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 : RegexLang | |
-- Copyright : | |
-- License : AllRightsReserved | |
-- | |
-- Maintainer : | |
-- Stability : | |
-- Portability : | |
-- |
This file contains hidden or 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 Randexp | |
#r "..//Dependencies//FSharp.PowerPack.dll" | |
open System | |
open LazyList | |
type Lang = LazyList<String> | |
let (.|.) (h:Lazy<_>) (t:Lazy<_>)= LazyList.delayed <| fun()-> LazyList.consDelayed (h.Value) <| fun () -> t.Value | |
let rec alt (xs:Lang) (ys:Lang) :Lang= | |
match (xs,ys) with | |
LazyList.Cons(x,xt) ,LazyList.Cons(y,yt) -> match compare (String.length x, x) (String.length y, y) with | |
-1 -> lazy(x) .|. lazy(alt xt ys) |
This file contains hidden or 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 UrlPatterns | |
open System.Text.RegularExpressions | |
let t2 a b=(a,b) | |
let matchUrl pattern:string->(Map<string,string>* string ) Option= | |
let regex=(new Regex(pattern)) | |
let names= regex. GetGroupNames() | |
in fun url -> let m=regex.Match(url) | |
if not(m.Success) then None | |
else let groups= m.Groups in | |
let paramMap=[for i in 0..groups.Count do |
This file contains hidden or 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
Sandwiches: | |
* Jay's Cheesesteaks (many seitan flavors) | |
* Ike's Place (tons of amazing veggie sandwiches) | |
* Toaster Oven (Potbelly's clone) | |
Mexican: | |
* Papalote (their house salsa is the best IN THE WORLD) | |
* El Buen Sabor (my favorite super veggie burrito) | |
* Taqueria Cancún (classic mission burrito; open till 2am on fri/sat, 1am other days, I think) |