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
# sequence :: Monad m => [m a] -> m [a] | |
# | |
# a way of implementing this functionality is through a left fold | |
# that unwraps the each monad in the first list and accumulates it | |
# in the second list, rewrapped in the target monad: | |
# | |
# sequence actions = foldl unwrapAccumulateRewrap (return []) actions | |
# where unwrapAccumulateRewrap wrappedAccumulator action = | |
# wrappedAccumulator >>= \accumulator -> action >>= \value -> return (value : accumulator) | |
# |
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 numpy as np | |
from random import choice | |
def feed_forward(network, input, activation): | |
activations = [input] | |
output = input | |
for layer in network: | |
output = activation(np.dot(output, layer)) |
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
(defclass user () | |
((name :reader user-name :initarg :name) | |
(roles :reader user-roles :initarg :roles))) | |
(defclass role () | |
((name :reader role-name :initarg :name))) | |
(defclass post () | |
((author-name :reader author :initarg :author) | |
(title :accessor post-title :initarg :title :initform nil) |
NewerOlder