21h
comment Python program to find 10,001st prime number exceeding runtime limit
@skyking "have you even tried" and "sieve of Atkin" don't go together in one sentence. :) Sieve of Atkin is reportedly very complex to implement efficiently. Not that I ever tried.
21h
comment Python program to find 10,001st prime number exceeding runtime limit
perform en.wikipedia.org/wiki/… analisys. That's how you know. find out what's the order of growth for your program. it should be below n^1.5 (trial division can achieve that). Anything close to n^2 or worse, won't be fast enough by a long shot. Good ones (sieves) run at n^1.00..1.10.
1d
revised Fond Memories of Past Primes
added 248 characters in body
1d
revised Fond Memories of Past Primes
added 9 characters in body
1d
answered Fond Memories of Past Primes
1d
comment Fond Memories of Past Primes
"fond memories of primes past" would be a more literary title. :)
1d
comment "Hello, World!"
but this prints it with the double quotes. it should be printed without them.
1d
awarded Supporter
1d
comment More efficient tail of church encoded list
@user3237465 I specifically wanted to avoid the lazy pattern, for whatever reason.
1d
answered More efficient tail of church encoded list
2d
revised Building accumulator for lazy lists in Racket
typos, c/e
Aug
28
awarded Nice Question
Aug
27
revised CLP Prolog - Logic Programming
edited tags
Aug
27
comment Using Haskell's map function to calculate the sum of a list
mapM is just a fold in disguise though.
Aug
27
revised Is it possible to define foldr using map?
edited tags
Aug
27
comment Using Haskell's map function to calculate the sum of a list
lists are indexed families, it seems, or sequences. If you accept this, you can't object to the usage of zip. If you do object, that means that you treat lists as non-sequenced, unordered collections.
Aug
26
revised Is it possible to define foldr using map?
edited tags
Aug
26
comment Is it possible to define foldr using map?
if zip is allowed, scanl can be implemented with map, and with the addition of last - also foldl, and sum in particular. lazy foldr on infinite lists might be problem.
Aug
26
comment Using Haskell's map function to calculate the sum of a list
@LuisCasillas the point of this answer is that lists are not sets I guess; their structure (items' positions; first/last element) is perfectly visible; map is not just fmap. IOW instance Functor [] talks of lists as sets, since only fmap is available &nothing else. with sets there's only membership, no position, so there's no order. we can very well define Applicative for lists-as-sets too, with cartesian product the only possible implementation - precisely because there's no concept of position. But with it, inner product becomes another possibility (i.e. zip, i.e. ZipList).
Aug
26
comment Is it possible to define foldr using map?
Const a >>= Const b = Const (a <> b) does not typecheck.
1 2 3 4 5