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
| import Text.ParserCombinators.Parsec | |
| import Control.Applicative hiding ((<|>), many) | |
| data Expr = Func ([Expr] -> Expr) | |
| | EInt Int | |
| | ESymbol String | |
| | EList [Expr] | |
| wrap x = "(" ++ x ++ ")" |
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
| Prelude> floor (1/0) | |
| 179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216 |
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
| All Expressions | |
| test.c: (4, 3) Assignment: "i = i < 5 ? i : i" | |
| test.c: (4, 3) Variable: "i" | |
| test.c: (4, 7) Conditional Operator: "i < 5 ? i : i" | |
| test.c: (4, 7) Binary Operator: "i < 5" | |
| test.c: (4, 7) Variable: "i" | |
| test.c: (4, 11) Constant Value: "5" | |
| test.c: (4, 15) Variable: "i" | |
| test.c: (4, 17) Variable: "i" |
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
| public Maybe<int> OrderedQty { get; set; } | |
| public Maybe<int> ShippedQty { get; set; } | |
| public Maybe<int> VirtualInStock { | |
| get { | |
| var v = from oq in OrderedQty | |
| from sq in ShippedQty | |
| select InStock - (oq - sq); |
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
| public static class InvoiceMixins | |
| { | |
| public static IEnumerable<OrderItem> GetTaxableOrderItems(this IOrderItems invoice) { | |
| if (invoice.GetOrderItems() == null) return new OrderItem[] { }; | |
| return invoice.GetOrderItems().Where(oi => !oi.IsTaxFree); | |
| } | |
| // SubTotalSub :: (IExtendedPrice a) => a -> IEnumerable<OrderItem> -> decimal | |
| public static decimal SubTotalSum<T>(this T invoice, IEnumerable<OrderItem> orderItems) | |
| where T : IExtendedPrice { |
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
| import maybe.*; | |
| [A] | |
| Functor?(static A) = false; | |
| [A | CallDefined?(fmap, A)] | |
| overload Functor?(static A) = true; | |
| define fmap; |
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
| #!/bin/bash | |
| if [ -d ".git" ]; then | |
| echo "setting default remote (origin) and merge branch (master)" | |
| git config branch.master.remote origin && \ | |
| git config branch.master.merge refs/heads/master | |
| else | |
| echo "no .git directory" | |
| fi |
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
| public static IEnumerable<T> Cons<T>(this T c, IEnumerable<T> xs) { | |
| yield return c; | |
| foreach (var x in xs) { | |
| yield return x; | |
| } | |
| } | |
| } | |
| // "Hello".Cons(new string[] { "World", "." }) |
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
| > import qualified Data.ByteString.Char8 as B | |
| > import Data.Enumerator as E | |
| > import Data.Enumerator.List as EL | |
| > import Control.Monad | |
| > import Data.Char | |
| > import Data.Enumerator.IO | |
| > import System.IO | |
| > import System.Environment | |
| > import Prelude as P |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Web; | |
| using System.Web.UI; | |
| using System.Web.UI.WebControls; | |
| using System.IO; | |
| using Crypto; | |
| using System.Text; |