Hacker News new | past | comments | ask | show | jobs | submit | leoff's comments login

I've created a joke Python library, hoping that I would get asked to code it in an interview. No luck so far

https://github.com/leoffx/fizz


Love the implementation. Don’t let anyone convince you to change it.


Reminds me of this purposely over-engineered Java version: https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris...


I get the point, but update your library to support entries higher than 100. :-)


1000 if statements would have probably added more laughter than there already was in my life this morning lol.


I think the joke is that it's hardcoded. It's definitely easier to implement it for n numbers yourself.


Computer Science. After transitioning from Mechanical Engineer, and 5 years of being a "Software Engineer", I want to understand more how computers, operating systems, network, etc. work


One of the resources to be aware of is 'From Nand to Tetris'. It's online and it's free. It's of very high quality and very eye opening.


Thanks for the suggestion! I'm following the website https://teachyourselfcs.com/ , which also mentions this course. It looks very good so far.


Website : https://www.nand2tetris.org/ Don't forget to get the book.


The "Science" part is different from the "Applied" part which is what you are listing.

A good introduction to the former is Algorithmics: The Spirit of Computing by David Harel and Yishai Feldman - https://www.weizmann.ac.il/math/harel/algorithmics-spirit-co...


type this in your console `document.body.style.cssText = 'animation: none !important'`


From personal experience, I wouldn't try making anything complicated with Retool.

The saying "it makes hard things easy, and easy things impossible" is fitting, once it feels like you're fighting against the platform, it's time to quit and start writing some code.


The thing I like about Retool is that it's pretty easy to just drop to code within Retool itself, provided you're willing to write JavaScript. You can write JS "queries" that just run a piece of code, and you can create completely custom React UI components. You can also write JS for things like conditional formatting of table rows, generating and exporting a CSV file the user can download, transforming API responses, and so on. And you can still take advantage of Retool's automatic coaching and reloading to some extent. In my last job I built a number of fairly complex dashboards with Retool alongside my normal work, including one with an interactive network graph.


LOL


Interesting how the post doesn't mention the word "side effect" once.

To me, all of this could be summarized by "no side effect".


He didn't need to mention it because it's implicit in data flow. Instead of the side effecting / state changing

    whip(cream)
that needs to be under flow control, you have

    whipped_cream = whip(cream)
describing the flow of data. Data flow describes the relationship between non-changing entities and thus there are no side effects.

While they could have mentioned it, it wouldn't really change the message.


Similar reaction, I searched for "lambda calculus" first thing first and was pretty weirded by the "0 results".

To me (someone who really doesn't like FP as a religion), FP is about function application: everything should just be "pure" function calls taking values (not references) and returning values; immutability is indeed a corollary of that, static typing really isn't (isn't Church's original LC untyped, btw?).


Maybe the author was trying to avoid potential fallacies that follow that phrase around though:

* If you don't have side effects, you can't do anything.

* Haskell can do things? Then it has side-effects, so it's not functional.

* Computer getting hot is a side-effect.

* i++ is not a side-effect, because I intended to do it.


No, as in zero, (side) effects means no program for most domains.

For me, the essence of FP is the minimization of global state


I think the point of the article is to illustrate why "no side effect" is important.


While I agree, you can get all of that FP example from the article in say C++ by liberal const-usage. So is "const-y" C++ functional programming?


It's not enough to take out the 'bad bits' - you have to put in 'good bits' too.

For example, Java collections are mutable, but enough ink has been spilled about the dangers of shared mutable state, that there are various recommended defences, e.g. make defensive copies when you return collections to a caller. Or use one of the immutable collections that will throw a runtime exception if someone tries to mutate it.

Now consider if you wanted to evaluate 3 + 5. Should you throw an exception which tells the caller off for trying to change the value of 3? No, the caller just wanted 8!

This is what's missing with the 'just make things immutable' approach to FP mimicry. I want to be able to combine collections together. The Java standard library Set<> still doesn't have union and intersection for christ's sake.


I think liberal const-usage breaks move optimizations so it's not used in practice.


Perhaps not these days, back in pre-C++11 days it was very liberally used. And something I miss in other languages, precisely because it allowed for much easier reasoning.


this is wrong! ocaml is a functional programming language with side effects.


To be fair, OCaml is multi-paradigm.


i mean, then we get into defining multi-paradigm :P does it have objects that could, theoretically, be used in a java-like object oriented system? yes! does anybody do that? not really! it's far more functional than any other paradigm, and that's what counts.


How does Musk plan on winning with these escalations? He's effectively blacklisting himself from the country.


If I had a few hundred thousand million dollars, I'd probably be OK with losing a few million for an important principle.


What principles? The guy retweets Nazi propaganda then bans people he doesn't like while claiming he's a free speech absolutists.


Not sure how you arrive at that conclusion? This Brazilian judge has banned X in Brazil, barred Brazilians from accessing X using a VPN (with a $9k fine for violation), frozen the bank accounts of X's legal representative and threatened her with arrest. All without any discernible due process.


I’m trying to figure out how people aren’t aware of this by now. It’s been broadcast everywhere.


The VPN part hasn't. I'm pretty sure that mods are hiding the VPN-ban news from /r/news and /r/worldnews, because it would damage the ongoing anti-Musk two-minute hates.


Even setting aside free speech issues, the secret tribunal process and gag orders are unconstitutional per the 1988 constitution.


Out of curiosity, which part of the 1988 constitution makes it unconstitutional?


Here is a link to the constitution:

https://www.constituteproject.org/constitution/Brazil_2017

The biggest violation is of the freedom of expressions rights, which are in Article 5 Section 9:

> [introduction] Everyone is equal before the law, with no distinction whatsoever, guaranteeing to Brazilians and foreigners residing in the Country the inviolability of the rights to life, liberty, equality, security and property, on the following terms:

> expression of intellectual, artistic, scientific, and communication activity is free, independent of any censorship or license

Posting on Twitter is a communication activity and it is therefore permitted without any censorship, explicitly.

Look at Section 37:

> there shall be no exceptional courts or tribunals

In this case, the exceptional court is what Moraes implemented in 2022, basically as a secret court of one. He served on the Supreme Court but also as president of the electoral court. The proposal to give him unilateral censorship powers was proposed by him and approved by the electoral court, with the power being granted to him in the other court. It is a very convoluted legal maneuver to basically give himself powers that no executive or legislative authority gave him. Note that no laws are passed to perform this maneuver. And by issuing these orders in secret, as a Supreme Court justice, it makes the path to appeal difficult or impossible.

It was shortly after this move that the New York Times (and many others) called Moraes a threat to democracy:

https://www.nytimes.com/2023/01/22/world/americas/brazil-ale...

Also look at section 54:

> no one shall be deprived of liberty or property without due process of law

This one is obvious - a single judge issuing censorship orders with gag orders to prevent public visibility or challenge is a serious violation of due process.

Or section 57:

> no one shall be considered guilty until his criminal conviction has become final and non-appealable

The reason I mentioned this section is some are saying that the censorship orders will eventually be reviewed by the full court bench (rather than being issued in secret by one justice), and that the orders are valid until then. But that’s equivalent to considering someone guilty without criminal conviction.

There’s more than just these, if you look through the rest of it carefully. X’s official AlexandreFiles account (https://x.com/AlexandreFiles) is also posting the secret censorship orders they received along with side by side comparisons against Brazilian law.


Sticking to principles is "winning" for some people, not making more money or getting power. Zuckerberg would've folded long ago and did whatever the govt asked him to do in order to make more money.


Which principles applied in the Erdogan election assist?

https://www.bbc.com/news/technology-65609123


Doesn‘t even have to be about money. Would be perfectly rational to comply to minimize uncertainty, public outcry, getting into the cross-hair of other countries‘ regulators and distractions from operating the core product/service. In short: for most people it wouldn‘t be worth the headache to stand up against a state like this.


I don't think he plans much future business in Brazil. I suspect this a greater loss for them than he.


as a mechanical engineer, can confirm. also, e ≈ pi ≈ 3


in fact, e = 2, made rather abundantly clear in "finite difference" calculus, and also that in computer science, the "natural" log base 2.


I find the reaction to be appropriate, a large amount of people can't play the game anymore. What else would you expect? "I paid a considerable amount of money for the game and now I can't play it anymore, but the graphics were very nice on the small amount of time I played, 5 stars"?


In hindsight my comment was ill-considered. I'm removing it.


Interesting idea. Some feedback - The UI doesn't look very good everywhere (text on the landing page has low contrast, awkward elements placement in the tool)

- Why are you restricting the product only for education? From your demo it seems like it could be used for anything? E.g finding animations, certain video styles Your real product seems to be a semantic search for Youtube

- You should return a list of videos, instead of a single one. Allow people to choose the one they like most

Otherwise, cool project, it's also not something I would pay for, but maybe some people would


Hey, thank you for the feedback. For the UI part I think I have exagered by always thinking this a MVP so I shoudln't waste too many time on UI details or some stuff ( maybe working with UI library will be the solution ). The restriction for the education is just because of the fact that the main idea of the app is to help people finding educationnal content on YouTube and avoid buying online course when you can find it on YouTube so the target is the person who want to learn something online.


Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: