This file contains 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
pry(main)> Object.methods | |
C:/Ruby192/lib/ruby/gems/1.9.1/gems/pry-0.9.3-x86-mingw32/lib/pry/helpers/base_h | |
elpers.rb:92:in `block in simple_pager': undefined local variable or method `out | |
put' for Pry::Helpers::BaseHelpers:Module (NameError) | |
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/pry-0.9.3-x86-mingw32/lib/pry/h | |
elpers/base_helpers.rb:91:in `each' | |
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/pry-0.9.3-x86-mingw32/lib/pry/h | |
elpers/base_helpers.rb:91:in `each_slice' | |
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/pry-0.9.3-x86-mingw32/lib/pry/h | |
elpers/base_helpers.rb:91:in `simple_pager' |
This file contains 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
Question Answer given Answer expected | |
Is your character an adult man? Probably not Probably | |
Has your character really existed? Probably not Probably | |
Does your character have legs? Probably not No | |
Does your character use a cane? Probably not No | |
Is your character on an album cover? Probably not No | |
Does your character wield electricity/lightning as a weapon? Probably not No | |
Does your character have claws? Probably not No | |
Is your character Muslim? Probably not No | |
Is your character hired to kill people? Probably not No |
This file contains 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 delimonads.core | |
(:require [monads.core :as m]) | |
(:use delimc.core)) | |
(reset | |
(defn bind-cont | |
"Binds its monadic value argument to the continuation. | |
Easy to understand explanation: (f (bind-cont x) y) becomes do {x' <- x; f x' y}" | |
[monadic-value] |
This file contains 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
#_(deftest maybe-plus | |
(is (= :bogus | |
@(m/plus [m/maybe-zero-val | |
(m/do m/maybe | |
[_ (m/maybe 1)] | |
(throw (Exception. "Should not be thrown")))])))) |
This file contains 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
DynamicVariable subclass: #DynamicGeneratorVar | |
instanceVariableNames: '' | |
classVariableNames: '' | |
poolDictionaries: '' | |
category: 'Sgeo-DynamicGenerator'! | |
!DynamicGeneratorVar commentStamp: 'SethJGold 1/14/2013 06:41' prior: 0! | |
DynamicGeneratorVar holds the current DynamicGenerator in use. Should not be used directly by client code.! | |
This file contains 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
waitFor: anAnnouncementClass | |
"Blocks the current process until anAnnouncementClass is announced. | |
Note that synchronous code using this method runs the risk of missing announcements." | |
| val sem | | |
sem := Semaphore new. | |
self on: anAnnouncementClass do: [:ann | val := ann. sem signal]. | |
sem wait. | |
^val. | |
This file contains 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
listEven :: [a] -> Bool | |
listEven [] = True | |
listEven (_:xs) = listOdd xs | |
listOdd :: [a] -> Bool | |
listOdd [] = False | |
listOdd (_:xs) = listEven xs |
This file contains 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
/* code taken verbatim from http://www.scala-lang.org/api/current/index.html#scala.util.control.TailCalls$ */ | |
def isEven(xs: List[Int]): TailRec[Boolean] = | |
if (xs.isEmpty) done(true) else tailcall(isOdd(xs.tail)) | |
def isOdd(xs: List[Int]): TailRec[Boolean] = | |
if (xs.isEmpty) done(false) else tailcall(isEven(xs.tail)) |
This file contains 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
REBOL [ | |
Title: "Monads" | |
Author: "Sgeo" | |
] | |
do-monad: func [ | |
monad "An object containing a /bind and a /return." | |
assigns [block!] | |
result [block!] | |
/local ma f next-assigns arg |
This file contains 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
use [num] [ | |
num: 0 | |
count: func [x] [ | |
num: num + x | |
print num | |
] | |
] | |
count 1 count 1 count 1 |
OlderNewer