Skip to content

Instantly share code, notes, and snippets.

View voodootikigod's full-sized avatar
🚀
Changing the world

Chris Williams voodootikigod

🚀
Changing the world
View GitHub Profile
%% ``The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved via the world wide web at http://www.erlang.org/.
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
delegate = Object.new
def delegate.netServiceBrowserWillSearch(browser)
puts "search commencing!"
end
def delegate.netServiceBrowser(browser, didFindService:service, moreComing:more)
# this never calls regardless of the services on the network.
puts "Found service #{service.name}."
end
/* This is a template command */
CmdUtils.CreateCommand({
name: "example",
icon: "http://example.com/example.png",
homepage: "http://example.com/",
author: { name: "Your Name", email: "you@example.com"},
license: "GPL",
description: "A short description of your command",
(define (fb x)
(cond ((= (remainder x 15) 0) "FizzBuzz")
((= (remainder x 3) 0) "Fizz")
((= (remainder x 5) 0) "Buzz")
(else x)
))
(do ((i 1 (+ i 1))) ((> i 100))
(display (fb i))
(newline))
@voodootikigod
voodootikigod / FizzBuzzSchemer.scm
Created October 28, 2008 01:23
THE GREATEST FIZZBUZZ SOLUTION IN SCHEME EVAR
(define (fb x)
(cond ((= (remainder x 15) 0) "fizzbuzz")
((= (remainder x 3) 0) "fizz")
((= (remainder x 5) 0) "buzz")
(else x)
))
(fb 1)
(fb 2)
(fb 3)
(fb 4)
(define (print x)
(cond ((= (remainder x 15) 0) 'fizzbuzz)
((= (remainder x 3) 0) 'fizz)
((= (remainder x 5) 0) 'buzz)
(else x)))
(define (makelist n)
(if (= n 101)
'()
(cons (print n)
(makelist (+ n 1)))))
(define (fast-expt b n)
(define (iter a b count)
(cond ((= count 0) a)
((even? count) (iter a (square b) (/ count 2)))
(else (iter (* a b) b (- count 1)))))
(iter 1 b n))
(define a (lambda (x) (+ x 4)))
(a 4)
(define (b q) (a q))
(define a (lambda (x) (* x 16)))
(b 4)
(a 4)
def _template_location(action, type = nil, controller = controller_name)
controller == "layout" ? "layout.#{action}.#{type}" : "#{action}.#{type}"
end
-module(ex01).
-compile(export_all).
mapper(F, A) when is_function(F) ->
[ F(X) || X <- A].
mapper_test() ->
V = [1,2,3,4,5],
F = fun(X) -> X * 2 end,
mapper(F, V).