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
(ns org.apache.http.examples | |
"Basic HTTP Server. | |
A quick port of http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpServer.java to Clojure" | |
(:import (java.io File OutputStreamWriter InterruptedIOException IOException) | |
(java.net ServerSocket URLDecoder) | |
(java.util Locale) | |
(org.apache.http.protocol BasicHttpProcessor HttpContext BasicHttpContext HttpRequestHandler HttpRequestHandlerRegistry HttpService ResponseConnControl ResponseContent ResponseDate ResponseServer) | |
(org.apache.http ConnectionClosedException HttpEntity HttpEntityEnclosingRequest HttpException HttpRequest HttpResponse HttpServerConnection HttpStatus MethodNotSupportedException) | |
(org.apache.http.entity ContentProducer EntityTemplate FileEntity) | |
(org.apache.http.impl DefaultConnectionReuseStrategy DefaultHttpResponseFactory DefaultHttpServerConnection) |
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
(ns tiger | |
(:import ( org.apache.commons.net.ftp FTP FTPClient)) | |
(:require [com.github.kyleburton.sandbox.ftp :as ftp]) | |
(:use [ clojure.contrib.str-utils :as str])) | |
(def *tiger-ftp-url* "ftp://anonymous:user%[email protected]/geo/tiger/TIGER2008/") | |
(ftp/list-all *tiger-ftp-url*) | |
(ftp/list-files *tiger-ftp-url*) | |
(ftp/list-directories *tiger-ftp-url*) |
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
#!/usr/bin/ruby | |
# Trivial little twitter script | |
# Pass it a list of names as command line arguments | |
# and it will return a list of all people who follow everyone in the | |
# list. | |
# A person is implicitly assumed to follow themselves, so if foo follows | |
# bar and bar follows foo then common_followers foo bar would include | |
# both foo and bar in the output, but if bar did not follow foo it | |
# would include neither. |
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
(atom) | |
(car) | |
(cdr) | |
(cond) | |
(cons) | |
(eq) | |
(quote) |
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
(atom) | |
(car) | |
(cdr) | |
(cond) | |
(cons) | |
(eq) | |
(quote) |
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 Lunar extends Baysick { | |
def main(args:Array[String]) = { | |
10 PRINT "Welcome to Baysick Lunar Lander v0.9" | |
20 LET ('dist := 100) | |
30 LET ('v := 1) | |
40 LET ('fuel := 1000) | |
50 LET ('mass := 1000) | |
60 PRINT "You are drifting towards the moon." |
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 Lunar extends Baysick { | |
def main(args:Array[String]) = { | |
10 PRINT "Welcome to Baysick Lunar Lander v0.9" | |
20 LET ('dist := 100) | |
30 LET ('v := 1) | |
40 LET ('fuel := 1000) | |
50 LET ('mass := 1000) | |
60 PRINT "You are drifting towards the moon." |
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
fn( reduce | |
[?f $?lst] | |
if(empty?($?lst) | |
call(?f) | |
else | |
call(?f first($?lst) | |
reduce(?f rest($?lst))))) | |
reduce(_(1 2 3 4 5) +) |
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
fn( reduce | |
[?f $?lst] | |
if(empty?($?lst) | |
call(?f) | |
else | |
call(?f first($?lst) | |
reduce(?f rest($?lst))))) | |
reduce(_(1 2 3 4 5) +) |
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
fn( reduce | |
[?f $?lst] | |
if(empty?($?lst) | |
?f() | |
else | |
?f(first($?lst) | |
reduce(?f rest($?lst))))) | |
reduce(_(1 2 3 4 5) +) |