-
Notifications
You must be signed in to change notification settings - Fork 223
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
INGI1131 (Oz 2) - Ajout de solutions d'APE 2-4-5 #813
Conversation
Pourquoi as-tu fermé la PR ? =) |
Il y a eu une erreur dans les greetings (j'ai pas compris pourquoi) et les changements ne s'appliquaient pas malgré que tu les aies approuvés. Je me suis dis que ça n'avait juste pas fonctionné... Mais c'est la première fois que je fais un Pull Request, j'ai peut-être mal compris un truc :) |
@Dj0ulo L'erreur avec le greetings n'a rien à voir avec ta PR en l'occurrence, et nous sommes justement en train de l'enlever (#814). Pour ce qui en est d'approuver, ce n'est pas en approuvant que les changements sont acceptés, pour cela il faut merge la pull request. En général, les administrateurs essaient de review tous les trois la PR avant de merge, du coup ici il y avait encore des reviews à faire. |
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.
Merci pour ta contribution !
Concernant les solutions que tu as apportées/qui étaient déjà présentes : il y en a beaucoup qui ne sont pas tail-recursive. Je ne sais pas dans quelle mesure on a insisté sur la récursivité terminale dans le cours ; tout ce que je sais dire, c'est que c'est généralement une propriété très importante en programmation fonctionnelle (sinon elle n'a pas de sens), donc je trouverais dommage que dans les solutions proposées il n'y ait pas de versions tail-recursive.
(Si tu n'as pas les versions tail-recursive, je peux te les retrouver. Ou les réinventer sur le moment, ça se retient ^^)
fun {Flatten List} | ||
case List | ||
of nil then nil | ||
[] H|T then {Append {Flatten H} {Flatten T}} |
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.
Il y a une version plus optimisée que celle utilisant Append
, je sais pas si tu vois laquelle, mais elle peut être utile à présenter ici.
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.
Non je ne vois pas vraiment comment faire sans Append pour l'instant :/
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.
local
fun {DoFlatten Xs Start End}
case Xs of
X|Xr then S S1 in
if {DoFlatten X S S1}
then S=Start {DoFlatten Xr S1 End}
else S2 in Start=X|S2 {DoFlatten Xr S2 End}
end
[] nil then Start=End true
else false
end
end
in
fun {Flatten X}
Start in if {DoFlatten X Start nil} then Start else X end
end
end
Ça ne me manque pas ce cours...
Il y a la nouvelle solution Flatten de @Peiffap, jsp si elle est déjà appliquée à la PR ou si il faut faire une manip en plus |
SI tu l'approuves, tu peux faire un commit sur ta branche locale et puis push online. |
Voilà c'est bon pour moi ! |
@@ -0,0 +1,25 @@ | |||
declare |
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.
J'aurais laissé les deux solutions ici. Peut-être d'abord celle-ci et en-dessous la plus simple.
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.
ok je fais ça
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'd have to check whether my repo for the class still has some missing answers.
Co-Authored-By: Gilles Peiffer <[email protected]>
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.
@Jimvy Any reasons not to merge? Otherwise this is good to go.
Also, I'll open a ticket concerning the potentially missing solutions to pull from my personal repository.
Thanks a lot @Dj0ulo! |
No description provided.