Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
ּ_בּ | |
בּ_בּ | |
טּ_טּ | |
כּ‗כּ | |
לּ_לּ | |
מּ_מּ | |
סּ_סּ | |
תּ_תּ | |
٩(×̯×)۶ | |
٩(̾●̮̮̃̾•̃̾)۶ |
// [snippet: Async socket server using F# async computations.] | |
open System | |
open System.IO | |
open System.Net | |
open System.Net.Sockets | |
open System.Threading | |
type Socket with | |
member socket.AsyncAccept() = Async.FromBeginEnd(socket.BeginAccept, socket.EndAccept) |
function pp(object, depth, embedded) { | |
typeof(depth) == "number" || (depth = 0) | |
typeof(embedded) == "boolean" || (embedded = false) | |
var newline = false | |
var spacer = function(depth) { var spaces = ""; for (var i=0;i<depth;i++) { spaces += " "}; return spaces } | |
var pretty = "" | |
if ( typeof(object) == "undefined" ) { pretty += "undefined" } | |
else if ( typeof(object) == "boolean" || | |
typeof(object) == "number" ) { pretty += object.toString() } | |
else if ( typeof(object) == "string" ) { pretty += "\"" + object + "\"" } |
/** | |
* Part Zero : 10:15 Saturday Night | |
* | |
* (In which we will see how to let the type system help you handle failure)... | |
* | |
* First let's define a domain. (All the following requires scala 2.9.x and scalaz 6.0) | |
*/ | |
import scalaz._ | |
import Scalaz._ |
$snapins = Get-PSSnapin -Registered | |
$snapins | Add-PSSnapin | |
Get-Module -ListAvailable | Import-Module | |
Get-PSSnapin | Format-Table -autosize PSVersion, Name | |
Get-Module | Format-Table -autosize ModuleType, Name | |
function ff ([string] $glob) { get-childitem -recurse -include $glob } |
########################################################## | |
# How to NEVER use Lambdas. An inneficient and yet educa-# | |
# tonal guide to the proper misuse of the lambda constru-# | |
# ct in Python 2.x. [DO NOT USE ANY OF THIS EVER] # | |
# by: e000 (13/6/11) # | |
########################################################## | |
## Part 1. Basic LAMBDA Introduction ## | |
# Well, it's worth diving straight into what lambdas are. | |
# Lambdas are pretty much anonymous "one line" functions |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
#!/bin/sh | |
SERVER="http://localhost:8081" | |
URL="$SERVER/nexus/service/local/artifact/maven/content" | |
REPO="sandbox" | |
USER="admin:admin123" | |
group=$1 | |
artifact=$2 |
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
/* | |
A basic lens library for the purpose of demonstration. | |
Implements a lens as the costate comonad coalgebra. | |
This library is not complete. | |
A more complete lens library would take from |
One of my favorite past times is to look at the notebooks of famous scientists. Da Vinci's notebook is well known, but there plenty others. Worshipping Da Vinci like no other, I bought a Think/Create/Record journal, used it mostly to keep jot down random thoughts and take notes. This was great in the beginning, but the conformity of lines drove me nuts. Only moleskines made blank notebooks, so I had to buy one.
At the same time I started a freelance project. The project itself is irrelevant, but suffice to say it was very complex and spanned several months. It seemed like a perfect opportunity to use the moleskine. Looking back, all my entries fell under few categories: