-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Round out data/list #59
base: master
Are you sure you want to change the base?
Conversation
This looks great. Two questions:
Thanks. |
For 1, I was copying what clojure called it (same with nth). I'll change it to /= to keep with haskell. I'll add documentation tonight, sorry for the delay. |
Oh, gotcha, I didn’t realize Clojure had a function named And no worries—I’d just like to make it a policy to avoid adding functions to the standard library without also adding documentation, but there’s no rush. |
ef40c56
to
c7ed1b9
Compare
c7ed1b9
to
e9d457b
Compare
The documentation has been added. |
128) | ||
(take 5 (unfoldr (λ [x] (Just (Tuple x {x + 2}))) 0)))} | ||
|
||
@defproc[(concat [_ (Monoid m)] [ms (t:List m)]) m]{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These uses of Monoid
need to be t:Monoid
to be properly linked.
|
||
@(hackett-examples | ||
(unfoldr (λ [x] (if {x == 1} Nothing | ||
(Just (Tuple (show x) (quotient! x 2))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you’re going to use quotient!
and remainder!
in examples, they probably need documentation as well. (My policy so far has basically been to document everything undocumented as I use them in other pieces of documentation.)
@defproc[(fold-map [_ (Monoid m)] [f {a t:-> m}] [xs (List a)]) m]{ | ||
|
||
Applies @racket[f] to each element of @racket[xs] and concatenates each resulting list. Equivalent | ||
to @racket[=<<] when @racket[m] is @racket[(List b)] for some @racket[b]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The two uses of List
here should be t:List
.
(all? (<= 2) {1 :: (error! "never happens") :: Nil}) | ||
(all? (<= 1) Nil))} | ||
|
||
@defproc[(elem? [_ (t:Eq a)] [x a] [xs (t:List a)]) t:Bool]{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t think there’s currently a great way to typeset this sort of function, but I don’t think this is a good way. Maybe just use defthing
here for now.
The git history should be a lot nicer now.