1 kyu
Compiler to Lambda Calculus
Loading description...
Functional Programming
Compilers
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
just completed this; it was very fun! thank you
Nice! :]
Easiest KATA EVER
Not every name that is valid in JS is valid in this kata, as specified in the description. So none of those names you want is valid. Excluding that.
===
is not defined; that'll have to be==
.Also, note that
5 + ! 0 + 3
can have any value greater than or equal to9
, because any positive number is truthy. As soon as! 0
appears in any expression, the only unambiguous continuation is as aBoolean
. Nothing should keep you from returning2
for! 0
! ( Or1
, or1 000
. )Tests added.
add testing for
!
Add some more testing for
! !
. Update example tests too.Beautiful kata. Potentially my favourite kata on the site.
I made the mistake of using the 'standard' encoding of
true
internally (and forgetting about it), which caused a very difficult bug to find later. A bit more careful planning would have helped a lot :PA few things:
You don't seem to have any tests for defining constants (besides constants which are functions.)
When I removed the
DEBUG
I got a lot of errors. Ideally that should default to false, if undefined. (Only a minor thing though).Thanks for the kata! (Hopefully it gets out of beta one day!)
Just to clarify the thing about constants, a function like the following might be a good addition:
Oh lovely! An excuse to define
pi
to3
! :PYou're not supposed to remove
DEBUG
altogether. I'll look into if I can default it tofalse
, but if you remove it, then wnt it back, how are you going to remember it's there?Doing Church
true
- I empathise, but I see no way to prevent you from being stupid. It's specified adequately, no?Oh wait, you solved it! Nice! :D I see lots of regexes. :P
"Favourite kata" - did you do the BF transpiler? That inspired this, and internally it's even more bonkers than this. But thanks. :] I liked making it, and both ( :P ) of my solvers so far have high praise. Getting it approved, if ever, will only be icing on that cake.
Yes it is adequately specified, no complaints here. Unluckily though the wrong
true
still worked far too often, meaning I only realised my mistake when I couldn't passfib
orisPrime
.I haven't done BF transpiler yet, I'll get there eventually. I am working my way through my bookmarked katas which has built up a lot.
true
is tested separately, right after42
! How the He11 did you pass that then?const
should not be the same as$
. JS lack of typechecking?Because
TRUE=a=>b=>a
andtoInteger=n=>n(x=>x+1)(0)
, so'true'
came out asx=>x+1
, andBoolean(x=>x+1) === true
(I am not sure what you mean by the
const
comment)In Haskell terms, Church
true
=const
. In this kata,true
=($)
.Boolean(inc)
should not have beentrue
. Type errors are hard to catch in JS, but with currying, I should at least be able to force a type error by converting theNumber
to a ChurchBoolean
and aplying that with JStrue
andfalse
. I think I can change JSBoolean
to LCNumber ( s => z => true ) (false)
.Ah I see what you mean. Yes I was going to suggest something like that but I thought maybe I am making a big deal about an issue that no one except me will face :P
Since you are requiring the output to be
Int
(and floats don't make sense in this context) might a simpletypeof x === 'number'
be enough? Of course your way is more on theme though.I have to figure out ( again - even though I wrote it myself ) how testng is done exactly. :]
I think the root problem indeed is that your solution returned an object instead of a number.
false
is tested also - butzero
andfalse
are equal!( You'll have to wait 'till after the weekend for Lists as Folds II now. You just did that to yourself. :P )
I updated testing. Returning non-numbers for booleans should now throw; removing
DEBUG
should not throw; I have added yourcylinderArea
, for which I am massively grateful.If you could check if that
true
bug is caught, I would be even more massively grateful. The second test in the first group should catch it ( and possibly more later on ). I don't know how difficult it is to reintroduce that bug?ETA:
toBoolean
in the example tests should look likeconst toBoolean = term => { something }
. If it's an expression fat arrow thingie, refresh. ( Example tests and Submit tests are almost exactly the same. )I changed
True = One
toTrue = K
in my own solution, and I got only two errors! And I failed only one test in the previous version of the tests ..! :OTests may have been optimised for correct solutions a little too much ..
The
true
bug seems dealt with (and the error message it presents makes it easy to see what went wrong). I don't know how someone would reintroduce that bug, but it would be an encoding I am unfamiliar with I think.The cylinder test looks good! I hope no one gets offended by integer
pi
:PI hope someone does! 🙂🙃🙂
I thought about doing
h * r * r * 22 / 7
, but I didn't want to change your code; it also meant one lessconst name = $Number
.I am curious why multiple
return
statements, orconst
after return, etc. should raise an Error? (Since they are valid, if useless, JS?)Also, are "pseudo evals" (such as
Function("return " + js)()
) permitted?Multiple
return
statements andconst
afterreturn
can't be expressed in LC as specified here. ( A LC expression has a single return value; it's comparable to a JS fat arrow expression. ) I liked theError
better than silently ignoring code.eval
, pseudo or not, is fine with me. Your return value must be valid LC, so you can't useeval
in there anyway. The only reasoneval
went away is because I needed a LC parser / evaluator, named iteval
because I could, and was too lazy ( and too scared to make mistakes ) to rename it before publishing. ( This kata was months in the making as a kumite. I did not even intend to publish it as a kata until after it was essentially finished. )Hi Johan,
This is the fastest/simplest way to reach you, so posting here. Could you explain what happened there, plz...? :/
and there, btw... :(
Because they were approvable. If the system is broken, fix the system. Why is everyone raising issues after the fact? Why aren't these kata retired by CodeWars?
Seriously: what happens these days is someone publishes a kata, it gets downvoted by jaded experienced users ( including me ) a couple of times, it skirts by retirement because someone finds something worth saving, then it starts collecting upvotes from normal users. Then, after a couple of years, it collects enough upvotes to become approvable. I can only conclude this is what CodeWars wants.
It's also completely unclear who CodeWars is and who is CodeWars. We the users write our own kata, our own documentation, and our own code of conduct. And we the power users revel in the negative, in destroying aspiring kata authors and their work even if it's an honest effort, and in recent years we inflate rankings to something unrecognisable and unreconcilable with one of the few things that's obviously CodeWars ex cathedra, the ranking descriptions by the kyu buttons.
This is a meta discussion for which this place is not suitable. But I don't do Gitter and that's unfindable for new users anyway, so where are they - and I - to find guidelines that are not just de facto standards, written by the butcher inspecting his own meat ( this is a Dutch saying for which I know no better English translation ) ? Why can't I do what the system allows me to do?
Sure, some of those kata I approved had problems. But those problems were not bad enough for people not to like those kata, were not bad enough for people to actually raise issues on them, those kata were getting solved and upvoted anyway, by real, normal users. They like them. The decent thing to do seemed to be approving them, so they can find even more of an audience.
The system allows that, so, again, I can only conclude that is what the system wants.
If the system is broken, fix the system.
If some kata need to be retired, they need to be retired.
> The system is broken > So I'm gonna abuse this fact
If you keep ignoring all the issues all the time, and justify it with some bullshit like "but the system allows me to do it" or "this kata is old == we shouldn't fix it", you'll only end up reported for griefing.
Being reported to CodeWars would at least mean I know who to defer to.
"Reporting me" to self-policing users won't do much good, will it? Or are "you" just going to bully away anyone "you" don't like ?
Johan, I hear you (despite what you maybe think).
But, hear me too, plz.
You're stretching your views/acts in two completely different directions. For example:
while you perfectly know that:
The system allows you to fix katas before approval too (or even after). So why don't you do that first? Why allow low quality kata to go out of beta while some updates here and there can make them qualitative enough?
Just 3 examples:
When reviewing a beta, if it has flaw but you want to approve it because you think it has potential, just modify the kata before you approve it. I don't count anymore the number of kata I fixed myself before I approved them. I don't count either those I had to rewrite almost from scratch, because they were beyond repair, while being of real interest. So, see, that's possible. But that takes time, yeah.
I'm also perfectly fine with the fact that, maybe, you're not up to spend hours on a beta to correct/upgrade it. But in that case, don't approve something that has evident flaws. I honestly find the behavior disrespectful for those who try to actually improve the overall quality of the database.
Raise an issue explaining what the problems are. Possibly suggest solutions. The old betas are alredy safe from retirement so raising issues allow to keep the low quality stuff unapproved, while it's still there: maybe some motivated user will go by and fix what's needed.
Or maybe not.
But when you approve a kata like this (ie. with flaws), you're forcing the hand of those who care to actually do what you, as approver, were supposed to do. Does that sound like a reasonnable/sympathetic behaviour to you? :o To me it doesn't, I'm sorry.
Now considere the other side of the problem:
Why are there so many kata with a lot of issues?
And now, what is an approved kata? A kata which is, well... approved by the community. Bad things were done years ago, yeah, and we have awful stuff approved. But why contnue on this side? This is just encouraging authors to go in the wrong direction.
If a structural problem lays there (and it does for sure), there is no need to amplify it even further, don't you think? (talking about approving without fixing, here).
Again, you're stretching your judgment in the direction that suits yourself at point x while you go the other way at point y. In a way I personnally find a bit dishonest (the word is too strong, but I don't have anything else on hand, sorry).
You know the system is broken, so just don't use "just because I can" as a justification. That's only extending the flaw without bringing any positive counterpart.
It's like ZED or mrtp0 who vote 8 kyu on everything "just because they can". It's really "the system is flawed, let's break it further".
...but don't abuse it in the meantime. ;)
Just gimme the rights, and I'll do some cleaning... ;p (and not only in the betas...)
Cheers
two messages in the meantime...
well, as a matter of fact, cw has now a "mod" team. Hence people who interact directly with
kazk
. So you know were to go, now (seek for the shields).What's a mod, and where do I find that? How am I to know?
Who's kazk, and why is he special? Is he the new Jake? How am I to know? ( Who was Jake anyway? )
Really, AFAIK, you're just another user. I had noticed that shield, but I have no idea what it is or what it does.
An awful lot of assumptions are being made. No, I don't know where to go!
Yeah, again, CW is full of flaws about that (comunication and all). But plz, just be a bit helpful, not hidding behind those.
For a more precise "where", you get choices. All suboptimal, yeah, but still:
cheers
I have actually tried emailing
info@codewars.com
once. No reply, no action that I could see.What I see is a site that has been created once and left to morph into whatever the ( well, some ) users wanted it to be. No action against obvious abuse of the ranking or rating system. No cleaning up of duplicates. No cleaning up of old, decrepit, inadequate beta kata ( or approved ones ).
I have no idea where new versions of languages come from. There is no meta information anywhere that I can find. I've never understood GitHub, I can look at sources only if I happen across a link. JS
Test.assertDeepEquals
appeared one day - no documentation, no press release.I have almost nothing to go on beyond what the system allows me to do.
What is that shield? What is a mod?
Also, WTF is zulip?
At least I'm getting answers. :]
Took approving a couple of shit kata :P but I'm getting answers.
Can I suggest a page with that information somewhere findable for users ? Please?
This site is badly in need of some oversight, and users need to know to whom to turn to get something done.
ETA: Damn, that last sentence is unreadable. Users need to know who's going to actually do that oversight and how to get in touch with those people.
Well, you probably noticed, things are being worked on but are still in very early phase, and not ready yet to be official. That's why I do not feel in position to go further on the topic, especially when the goal of your message feels like it is to point out the lack of officiality of this. But I will try and get attention of someone who knows answers to your questions.
PS: forget zulip for the very same reasons, for now... ;)
edit: crossed messages
It's been that way for my entire time here, I have never seen any real change, things haven't gotten better, and they have gotten worse in several ways. I really hope some improvements are made and some maintenance is done. Will you in the meantime forgive me for believing it when I see it?
I appreciate your efforts.
Sure, Thomas. ;)
Also, I'd like to note that a link to the CW Wiki has been in the menu for several years and links to GitHub issues have been in Bug Reports and Feature Requests sections of the "forum", IIRC, for even longer.
The Wiki has helpful technical information. But as far as I can tell it's user-generated, no official CW stances there, and no way to ask questions. It's also incomplete. ( Please point me to the section on crowns and shields. )
The Bug Reports Forum has "File an issue on Github" in large friendly letters. Well, large letters. (1) That scares me away immediately because I don't know GitHub, and (2) that seems to be the place for bug reports, not problems with site use and abuse, copycats, abusive users, lack of maintenance on kata ( see above ) or other "soft" or "fuzzy" issues.
If I see a user submitting a copied, cheating or otherwise reportable solution, where do I report that? If I experience outright abuse from another user, where do I report that? In both cases: will something actually be done? Who actually runs this show? Who bans users? I have never experienced anyone clearly having or wielding authority; it's all community policing. And if someone won't let himself be policed, any problem is just not going away.
the repo is so far used for any kind of issue.
examples:
Shields and crowns have been existing for less than a bunch of days, so don't expect the documentation to be already up to date about that x)
I will try to answer some of your questions, but please keep in mind that nothing of it has been finally decided, everything is still under evaluation, and things can change, or even be dismissed if they prove to not work. As you can probably see, everything is in very early stage and not much is complete and finally decided, let alone ready for official announcement. But it is an attempt at making things better. Issues you mentioned (and not only these) are fully acknowledged by maintainers, and it's also fully acknowledged that all problems were neglected for the long time. It's not that it helps anything, but there's honest effort to fix things. It was very difficult until now, because, as said, problems were neglected for a long time, and when they got finally acknowledged, technical debt of the site itself was getting in a way. Now it's more or less sorted out, and maintainers can work on further improvements.
This is true. Documentation is being improved here. You can see how it's forming here. Not much is ready, many things are just stubs. but it's growing. Many of it is volountary work, and it's done by community. Docs repo is public, so if you would like to contribute in any way: writing, giving ideas, reviewing texts, it would be not only very helpful, but also could get you familiar with Github a bit ;) Things won't improve here if noone contributes.
This is not really like that. Github issue trackers are suitable for tracking various types of issues, not only bugs. Codewars issue tracker collects bugs, feature requests, suggestions, community stuff like abuse reports. It's being maintained and issues are handled.
Here. It's been working this way since, like, long time ago.
Here.
Yes. No. It depends. There are issues which are handled right away (community abuse of varius kinds). There are issues which take some time to verify, process, and finalize, but they are handled (cheaters, excessive copycats which abuse the system on a large scale, and griefers). There are types of issues which were not decided yet how to handle them correctly (copycats on smaller scale).
This part I get only partially. I agree that it's not written down anywhere, and it's not documented. But I do not see how it would help if it were. First of all, it's a very common knowledge for people who talk each to another. I have impression (please do not take it personally, it's just my impression and I can be completely wrong about it) that you've somewhat choosen to live out of community. You don't like Github, maybe you do not like Gitter, so it's simply very difficult for the information to reach you. You even said (if I get you correctly), that you won't work with tool you don't like even if it could help with your problem. That's OK, it's totally up to you, but I would have a very honest question: how would you want the announcements, information, and knowledge to reach you? What do you consider a proper way of passing information to you?
Everyone is up to discussion, community is being heard and listened to. Things go slowly, and they're not ready yet. But they go forward. I hope that all these efforts will be successful, because it would be very helpful to the site.
Thanks Blind. Funny to see Alex won't even mention my name.
And thanks Hobovsky. It's good to hear things are being done. You acknowledge things were not being done for the longest time, and that's where I'm coming from. Hence "I'll believe it when I see it."
I have missed for over four years where support was, after all, available. I don't do Gitter and I don't know what to do with Github ( it's not that I don't like it, I just don't understand it ). No, I'm not part of the community outside of
codewars.com
proper. So everyone there knowing things didn't help me very much. :PSo I didn't know who's who, who to listen to, who to talk to. I have wondered more than once over the past years if there was someone with real authority, and I have been unable to find anyone. There was a Jake once, and later there was Kazk, but he seemed overwhelmed with technical issues. That made for total anarchy where nobody had to listen to anything anyone said, because there's community policing only, and sometimes that just did not seem to be enough when tempers flared. Meanwhile, ranking standards went down the drain and kata duplication only ever got worse, never better. There must have been some moderating of comments and banning of users going on, but never so apparent to me that I wasn't disheartened by the general slide down the drain I saw happening.
Anyway. I missed that Forum -> Bug Reports -> "non-content related issue" includes "I have some problem with another user ( or vice versa )". And it never occurred to me to click on Issues in the Wiki - I thought that had to do with bugs in the website or langage / testing framework or something. You know, technical stuff. "Support" should maybe not be labeled "Issues" or "Bug Reports" ( talking about the Forum entry here ). And if you make it to that list, could "spammers" and "cheaters" be pinned to the top? "duplicate kata" is not an Issue, I found, but a Wiki page.
ETA: For important news, like new versions of languages or important changes to testing frameworks ( if that ever happens without a new langauge version ), a notification pointing to an article of documentation somewhere. ( I hope that kind of new stuff gets documented reasonably fast. ) Possibly only if the applicable language is one of My langauges. Introduction of crowns and shields: write it up in the Wiki and send a notification.
Blind ( or anyone else reading ),
is there an ongoing Issue for kata that really, really should be reranked? I could not find one.
Bob's Jump has performance requirements that necessitate memoisation or DP, and it's ranked
7
. That's just outrageous IMO. Or is it worth opening a standalone issue for this?There was this: https://github.com/codewars/codewars.com/issues/2001 and this: https://github.com/codewars/codewars.com/issues/2030 backed by corresponding lists on wiki, but these were related to some specific instances of the problem.
You can open more general issue, and create list on wiki, but the problem is already recognized as a kind of Pandora's box with no really good solution. It's been complained on, and discussed, unfortunately without any good consensus. If you have any idea, you can search for any post or issue related to idiotic difficulty rankings and post it there.
I am not sure if it's worth opening specific issue dedicated for this kata, but I can ask. I Will ask What would be the best way to handle it and open the github issue if necessary.
Okay managed to stumble upon this post....
Yes, it's been done in 15 months only (not even 20% time of CW's life span!!!)
Now we have CW official docs in good shape though still expanding in other languages' documentation part
We now have discord, and you're actually in it in which once you were very reluctant to get involved XD
Mods have ability to do that, so not to worry ! Just file a github report on the corresponding issue linked above ~~
Discord is now the main news broadcasting channel !
All noted here and still ongoing
You can always brought the issue to discord #fixing channel or raise it on content-issue section to be addressed soon!
So all in all , after 15 months only:
So, everything is going in the right track ! Hopefully for upcoming years as well, kudos !!! 😜