8m
answered Scheme - Recursion of an argument at the end of a begin statement?
12m
revised Scheme (DrRacket) - Calling Generalized / Abstracted Function with Another Function
added 53 characters in body
34m
answered Is there a non-recursive way to write this "paginate" function?
11h
comment Is there a non-recursive way to write this "paginate" function?
just to have the whole picture, the other way round is listToMaybe . join ((<$) . splitAt n). But it's longer.
11h
comment Is there a non-recursive way to write this "paginate" function?
I do want to distinguish one fmap from the other, but of course YMMV. btw your last is also (<$) . splitAt n <*> listToMaybe, which must be the shortest encoding for this thing! nice :)
1d
comment Is there a non-recursive way to write this "paginate" function?
with infixr 9 .: ; (.:) f g x y = f (g x y) and list z f [] = z; list z f (x:xs) = f x xs (by analogy with maybe), we can have foo n = unfoldr (list Nothing (Just .: splitAt n .: (:))). -- (btw, your code has an error in it).
1d
comment Is there a non-recursive way to write this "paginate" function?
BTW the strictly Data.List version of this is simply takeWhile (not.null) . unfoldr (Just . splitAt n).
1d
comment Is there a non-recursive way to write this "paginate" function?
why use . on the right and <$> on the left? With . on the left too it'll be more apparent that <*> belongs to the function applicative. -- nice trick, using *> to encode the if.
2d
revised Scheme (DrRacket) - Calling Generalized / Abstracted Function with Another Function
added 207 characters in body
Dec
16
answered Scheme (DrRacket) - Calling Generalized / Abstracted Function with Another Function
Dec
16
revised Scheme (DrRacket) - Calling Generalized / Abstracted Function with Another Function
fit code to screen
Dec
16
comment Scheme explanation(construct)
@ValentinEmilCudelcu if you understand now, you should check the one answer that was most helpful to you. This will also give you a +2 rep bump. And with 15 rep you can also upvote any answer that you deem useful.
Dec
16
revised What is the difference between map and apply in scheme?
added 164 characters in body
Dec
15
awarded Supporter
Dec
15
revised Python prime generator in one-line
added 364 characters in body
Dec
15
answered What is the difference between map and apply in scheme?
Dec
15
revised Scheme explanation(construct)
trying to make it clearer
Dec
14
comment Understanding Haskell code which applies the `tails` function to an infinite list within a list comprehension
@DipakC you're most welcome!
Dec
13
revised Factorizing a number in python
correction
Dec
13
comment Primes in N (estimation)
you probably meant a formula for calculating this isn't known yet.
1 2 3 4 5