Empirical orders of growth, please!
In a declarative language,
length(a) == 0
is the same as null?(a)
,
and [y | x <- [1..], y <- []]
is just []
.
Any high-level language worth its salt must have Abstract Data Types with automatic O(1) append
where possible, and efficient lists and strings. Otherwise, it is not high-level enough.
How to generate all the permutations of elements in a list one at a time in Lisp?
What's in a powerset? A set's subsets...
condU:(g ~~>! h) f x = case g x of [] -> f x; (y:_) -> h y
apply (FUNARG lambda env) xs a = apply lambda xs env
hammingSlice hi w = (c, sortBy (compare `on` fst) b) where
ordfactors = foldr g [1] . reverse . primePowers where
1:foldr (\n s->fix (merge s . (n:) . map (n*))) [] [2,3,5]
(define (call/cc& proc& k) (proc& k k))
(define (list . xs) xs)
primes = [2
..] \ [[p²
, p²+p ..] | p <- primes]
((g<=<f)=<<) = (g=<<).(f=<<) = join.(g<$>).join.(f<$>)
Monads as generalized function application
How Monads are considered Pure?
Monads are EDSLs are Nested Loops are Trees:
do { [1,2,3] ; [4,5] } =>
do { x <- [1,2,3] ; do { y <- [4,5] ; return y }} =>
for x from [1,2,3] { for y from [4,5] { yield y }} =>
[ 4,5, 4,5, 4,5 ]
-
Great QuestionNov 17, 2018
-
PunditJun 8, 2017
-
Civic DutySep 15, 2020
-
Necromancer
× 2Apr 16, 2018
-
Self-LearnerOct 28, 2017
-
ExcavatorOct 29, 2018
-
CuriousMar 25, 2017