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
diff --git a/tests/best_solutions_test.cpp b/tests/best_solutions_test.cpp | |
index f54e575..eafb30b 100644 | |
--- a/tests/best_solutions_test.cpp | |
+++ b/tests/best_solutions_test.cpp | |
@@ -169,29 +169,29 @@ int main() | |
const std::vector<decision_vector> &best_x = best_tests[i].problem->get_best_x(); | |
//browse the solutions set | |
for(std::vector<decision_vector>::size_type j=0; j<best_x.size(); j++) { | |
- fitness_vector best_f_computed = best_tests[i].problem->get_best_f().at(j); | |
- const fitness_vector &best_f = best_tests[i].best_f.at(j); |
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
Step 6 : RUN su run; cabal install QuickCheck | |
---> Running in 8911cac2a285 | |
Resolving dependencies... | |
Downloading primitive-0.5.4.0... | |
Downloading random-1.1... | |
Configuring primitive-0.5.4.0... | |
Configuring random-1.1... | |
Building primitive-0.5.4.0... | |
Building random-1.1... | |
Installed primitive-0.5.4.0 |
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
respond' :: Config -> Message -> String -> (String, String) | |
respond' cfg m reply = (sendTo, text) | |
where | |
senderNick = (IRC.Parser.nick (sender m)) | |
sendTo = if location m == (Config.nick cfg) | |
then senderNick | |
else location m | |
text = if location m == (Config.nick cfg) | |
then reply |
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
queryRedis :: forall a. R.Connection -> R.Redis a -> Bot (Maybe a) | |
queryRedis db r = do | |
eitherComp <- redisComp | |
return $ either (const Nothing) Just eitherComp | |
where | |
redisComp :: Bot (Either SomeException a) | |
redisComp = io $ try $ runRedis db r |
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
data Message = Message { | |
sender :: String | |
, command :: Command | |
, location :: String | |
, payload :: String | |
} deriving (Show) | |
data Ping = Ping { | |
response :: String | |
} deriving (Show) |
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 random | |
query = 'insert into employees (emp_id, first_name, surname, salary, dept_id, comm_pct) VALUES ("%s", "%s", "%s", %d, "%s", %s);' | |
def get_id(name, surname): | |
return "%s%s%02d" % (name[0], surname[0], random.randint(0, 99)) | |
if __name__ == '__main__': | |
names = [line.rstrip() for line in open("first-names.txt")] | |
surnames = [line.rstrip() for line in open("names.txt")] |
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
var zmq = require("zmq"); | |
sock = zmq.socket("sub"); | |
sock.connect("ipc:///tmp/keypad.zmq"); | |
sock.on("message", function(msg) { | |
console.log(msg); | |
}); |
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
╭─jdiez@voidray ~ | |
╰─$ ghci | |
GHCi, version 7.8.3: http://www.haskell.org/ghc/ :? for help | |
Loading package ghc-prim ... linking ... done. | |
Loading package integer-gmp ... linking ... done. | |
Loading package base ... linking ... done. | |
λ: data Player = Player { health :: Int, name :: String } deriving (Show) | |
λ: let player = Player 100 "José" | |
λ: let setHealth p h = p { health = h } | |
λ: let player' = setHealth player 80 |
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
module Problem14 where | |
collatzWriter :: Int -> [Int] | |
collatzWriter 1 = [] | |
collatzWriter n = next : collatzWriter next | |
where | |
next | |
| n `mod` 2 == 0 = n `div` 2 | |
| otherwise = 3 * n + 1 |
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
module Problem14 where | |
import Control.Monad.Writer | |
collatzWriter :: Int -> Writer [Int] () | |
collatzWriter 1 = return () | |
collatzWriter n = tell [next] >> collatzWriter next | |
where | |
next | |
| n `mod` 2 == 0 = n `div` 2 |