Hacker Newsnew | past | comments | ask | show | jobs | submit | jayceedenton's commentslogin

Without the explicit recur it's far too easy to misidentify a tail call and use recursion where it's not safe.

Recur has zero inconvenience. It's four letters, it verifies that you are in a tail position, and it's portable if you take code to a new function or rename a function. What's not to love?


That doesn't work for mutual recursion, what is quite common in Scheme programs. Besides, tail call optimization is not only useful in recursion.


Tails calls are especially useful in languages with macros. You don't know what context you are in, you just generate the call that makes sense. If the call happens to be in tail-position, you get the benefit of it.

Moreover, you can design cooperating macros that induce and take advantage of tail-position calls.

Here's a simple example that motivates tail-calls that are not tail-recursive:

https://cs.brown.edu/~sk/Publications/Papers/Published/sk-au...


Yeah, absent automatic TCO, we have to do it all, explicitly, by hand... `recur` and `trampoline`.

recur: https://clojuredocs.org/clojure.core/recur

  > Evaluates the exprs in order, then, in parallel, rebinds the bindings of
the recursion point to the values of the exprs.

  (def factorial
    (fn [n]
      (loop [cnt n
             acc 1]
         (if (zero? cnt)
              acc
            (recur (dec cnt) (* acc cnt))
  ; in loop cnt will take the value (dec cnt)
  ; and acc will take the value (* acc cnt)
  ))))
trampoline: https://clojuredocs.org/clojure.core/trampoline

  > trampoline can be used to convert algorithms requiring mutual recursion without stack consumption.
i.e. these emulate TCO, with similar stack consumption properties (they don't implement real TCO).

(edit: formatting)


Thanks for the pointers. Trampolining is an old idea for obtaining tail-calls. It's a kind of folk-wisdom that has been rediscovered many times, as the related work here shows:

https://dl.acm.org/doi/pdf/10.1145/317636.317779

Usually the trampoline is implemented automatically by the language rather than forcing the author to confront it, though I can see why Clojure might have chosen to put the burden on the user.


Yeah, Rich's HOPL lecture covers that ground...

https://clojure.org/about/history

  > Clojure is not the product of traditional research
  > and (as may be evident) writing a paper for this setting 
  > was a different and challenging exercise.
  > I hope the paper provides some insight into why 
  > Clojure is the way it is and the process and people
  > behind its creation and development.


Ah, I didn't know there was a HOPL paper! Some day I will have time to run a course reading HOPL papers. Some day I will have the time to read HOPL papers myself (-:. Thanks for the pointer.


> Speaking to female and male friends, both sides are seeing them as a complete shitshow

In what sense?


To simplify, women are completely inundated with poor quality matches, men get very few matches.


It's not really surprising. Hetero sexual desire has been framed negatively for well over a decade, as at best exploitative and at worst misogynistic and perverted. Men told that if you want sex you're part of society's biggest problem, and women told that if you give in to a man's sordid desires you are being taken advantage of and subjugated. All we ever talk about is the dreaded 'power imbalance'.

We've removed sex from normal life as far as possible. Films can be full of violence but any hint of titillation is verboten now. Any reference to sex in normal walks of life is seen as harassment, chauvinistic or pandering to the male gaze. Our culture is influenced by global social and religious conservatism in the quest to sell media to as many markets as possible. Our own new conservatism (the so-called left wing) is just as bad.

On top of that we have the culmination of a few decades of obsessive education about STDs and sex as a dangerous act that can ruin lives. A far cry from 'The Joy of Sex' as a cultural phenomenon.

We're letting prudes and those with deep psychological issues around sex call the shots. Millennials and Gen Z may be a lost cause, but let's hope that Gen A can rewrite the rules.


That’s an exaggeration. As an Asian who has interacted with Americans, I still see the US as one of the most sexualized places in the world. The emphasis on physical attractiveness is extreme, and the hook-up culture, pick-up culture and PUA industry have influenced not just America but Asia as well. What you’re describing sounds more like a pushback against abuse and manipulative forms of hooking up, which is a natural reaction in a society shaped by individualism. People are simply becoming more cautious. This will likely drive an even greater focus on physical and sexual appearance as consensual hookups continue.


It's crazy, the rural fundamentalist Christian community I was raised in was more sex positive than almost everyone in secular institutions despite all the "misogyny" and "homophobia."


[flagged]


TEEN pregnancy IS bad. What the actual fuck is wrong with you?


Age limits on buying cigarettes are easily thwarted by finding a corner shop that needs the sale and will sell to kids. Height restrictions on fairground rides are easily thwarted by putting bits of wood in your shoes. None of this matters.

The point is that this kind of control will drastically reduce under 18s consuming content that they shouldn't. We don't need the all of society's controls to be flawless.


A VPN is a hell of a lot easier to access then a corner shop that's willing to break the rules, and such rules on corner shops didn't exactly stop teenagers from finding porn before the internet


For a kid, finding porn before the internet was significantly more difficult.

If you were old enough to pass for 18 yeah a newstand might sell you a magazine. Most would not if you were clearly younger. And you needed to pay for it. Most kids (especially young kids) don't have any money.

And then you had one magazine. Still photos. And it didn't show anything but naked bodies. No real sex, the hardcore stuff was only in adult bookstores.

It was virtually impossible, pre-internet, for an average kid to find a way to spend hours and hours looking at an endless stream of hardcore porn.


At my school one guy had adult VHS cassettes (probably his parents') and a VHS player and he invited other guys to watch porn. By the way I wasn't invited. Maybe it was good because later the teachers found out about this.


Yes, the arrival of home video players was a glimpse into what was to come with the internet. Easier availability.


Without co-opting the loaded notion of what we mean by "shouldn't," I do agree that, at a certain point, manipulating controls to feather through the margins and outliers has diminishing positive returns and increasing negative ones.


Should or shouldn't is a matter of opinion that I disagree with because it has no evidential basis. Downloading a free VPN isn't just doable, it's completely trivial in the privacy of your home and doesn't require any confrontation or risk unlike trying to buy alcohol or cigarettes illegally.

And that is before you consider that what you're ultimately doing, even if your blocking strategies were successful, is steering kids towards the darker markets where illegal and actually harmful content isn't removed and that don't care about your ID laws.


> Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety.

- Benjamin Franklin


Exactly. For example, adult smoking prevalence in the EU has dropped by about 9% per decade among men which means it's fallen nearly in half since the 1970s.

The US is always against regulations when they don't benefit their companies, whether it's social media, AI, porn, tobacco, or weapons.


That was after the ban on smoking indoors and public spaces.


Most EU countries passed laws between 2002 and 2009 raising the tobacco purchase age to 18. And they also introduced regulations on how and where they can advertise smoking, how the packaging looks, and even where the products are displayed.

The EU and Asia are doing a great job protecting their people from harmful US goods and services. On the other hand, South America and Africa are poor continents with little power to negotiate.


In the UK, the single most effective reduction in the number of people smoking was the ban on smoking in public and indoor spaces.

We went from being up in arms to complete acceptance of this as the norm shockingly fast. Well under a year.

I live in a European country now that prides itself on "individual freedom", and basically can not visit outdoor public places. When I suggest an establishment ban smoking on their terrace, they find it unthinkable. This was the very reaction people in the UK had, _until it got passed in law and everyone was fine with it_


> We don't need the all of society's controls to be flawless

We don't, but we do need them to be at least close to best-effort. This is a nonsense law, implemented in a nonsense way. Clearly nobody cared whether it worked or not, and there's either an anterior motive or it was something the current government (whose idea it was not) couldn't back out of without being labelled "pedo-loving scum!".

Unfortunately, I can't let your examples go without comment either. Age restrictions on the sale of tobacco caused a dive in the numbers of children smoking since those shops absolutely stopped selling to children when the penalties came in. I know, I was one of them and none of my friends could get cigs from shops anymore. As for the height restriction bypass; we're not in Looney Tunes, that's not a thing.


If you think VPN is going to stop kids from accessing porn, I have a bridge to sell you.


Porn is a service problem?


Oh, if these rules would teach the under 18s to not be 'content consumers' as you seem to consider yourself, that would be great.

But I'm afraid they're only there to satisfy the puritans. The average shitty content that you 'consume' will still be fine.


10+ years ago Clojure had a fantastic introductory experience. lein new and away you go. lein was so good and effective, for both tiny hello world projects and real production apps.

The experience has gotten worse and worse now for a decade. The core team have continued to take things in a worse direction (supported by a small group of fanboys) and most newcomers are now completely baffled by the tooling.


The cli/deps.edn tooling is different from Leiningen, and far, far less complicated IMO. I've written a good number of Leiningen plugins and it was always brutal to get anything to work properly, especially in combination with other plugins.

Leiningen attempts to be everything to everyone in terms of building, testing, and packaging Clojure code. It's Clojure's version of Maven.

cli/deps.edn effectively reduces things down to a) what should be on the classpath and b) what should get executed. Working inside an IDE? You just want it to download the dependencies and build a classpath. Running nREPL? Add that to the classpath, and set the starting namespace to start nREPL. Packaging an application? Run dependencies that do that work, based on the clojure.tools.build library.

I was there myself; I used Leiningen and didn't take the time to figure out deps.edn --- until I did, saw the light, and converted all of Walmart's projects to use deps.edn, which greatly sped up our build and improved our dev experience.


tools.deps is less complicated mostly because it just flat-out does much less. To mimic everything lein can do required adopting half a dozen other libs and writing your own build scripts.

It's better now, but people are pretty uncritical of the core team, and adopted tools.deps before its surrounding ecosystem was ready to fully replace lein.

The upshot was, everyone got to rebuild the wheel for a couple years. And I say this as someone who once lost a week debugging a subtle lein/maven classpath AOT bug.


You can still do lein new and away you go, today. That still works.

Many people still use lein for new projects, especially for larger ones. For small on-off thing, clojure command line is more convenient. So it is a good thing to have more choices.


Also, today, half the docs you find around are about lein, half are about tools.deps, and no one ever gets the full definition because they assume you know your way around. :shrug:, I guess ?


Which of these languages is declarative? Aren't they both imperative?


Maybe Java when using decorators?


Java 8+ is basically a declarative language. They even officially started departing from Object Oriented Programming towards Data Oriented Programming ( article by their chief architect https://www.infoq.com/articles/data-oriented-programming-jav... ). Unfortunately, most of the comparison articles come from people who still code POJOs with setters, use for loops and overall rely on mutable and unsafe code.

And using Pike’s own words “go is unapologetically imperative”.


> Java 8+ is basically a declarative language.

That's a bold claim!

The article you link to does not contain the word "declarative". It simply states that modern Java allows more of Data-Oriented Programming, meaning a emphasis on pure data structures (records) and more expressive types (algebraic types). It doesn't say much about the code that deals with this data, which is of course procedural.

Apart from SQL which is not generic, I've toyed with two declarative languages, and I can't see much similarities with Java. https://en.wikipedia.org/wiki/List_of_programming_languages_...


Is there any benefit to using workspaces over just introducing some variables and having an 'environment' variable?

You can have a directory per environment and a directory of shared resources that are used by all environments.

It seems like workspaces add a new construct to be learned and another thing to add to all commands without much benefit. Could we just stick with the simple way of doing this?


The proposal shows an example on how to isolate environments without duplicating some code. It acts, more or less, as a template for the architecture which you render it according to the values (environments/accounts).

I agree it isn't a simplest way to do that, but I don't think that it add as much complexity this. Perhaps it could be more laborious for the point of view of architecture, but it could be easier to handle and maintain.


Been a while since I used workspaces but my understanding is that you have: - a directory that has the infrastructure code - a directory per environment that has the specific configuration to be applied to that environment

It's a pretty classic separation of code and config. Might not be intuitive to everyone I guess, but that separation is very beneficial I find.

For instance, adding a new environment is relatively trivial. Not something you do all the time granted, but I have had the need on occasions.

Same goes for removing an environment.


You described my pattern. I don’t care for it. I just don’t know what other pattern I could apply. It can get really messy and the code duplication is a headache. Humans don’t read the middle if that makes sense. So you’re having to keep a very keen eye on making the environment directories the same in my experience.

Things like terragrunt can be really helpful. I don’t use terraform without it.


Performance. I've seen workspaces with just a thousand resources take 30 minutes to plan and apply. That's a pretty reasonable number to get to if you have per developer or per customer environments, or deploy infrastructure to multiple regions.


They seem to play nicer with Terraform Cloud, when I've used it. I'm not sure how useful they are if it's just vanilla tf, especially if your codebase is simple. I guess it's just extra isolation for safety, perhaps.


Why was Poland so high?


> The share gross electricity generation from coal in 2022 was 70.7%, (1.7 p.p. less than in 2021).

https://www.trade.gov/country-commercial-guides/poland-energ...


From that data, for the same reason as China: overdependence on coal.


This is a good example, I think, of why a future in which all homework is obsolete because of AI is actually not likely.

If a lecturer at university sets a task for 100 students (say, write an essay about the factors that led to the first world war), there will be clear and glaring similarities between the way that points are made and explained if many students use chatgpt. Yes a student might rewrite or paraphrase chatgpt, but low effort copy and paste is going to be very obvious because chatgpt's model cannot produce an entirely unique approach to the task every time it is asked.

I know there are weights and parameters that can be adjusted, so there is some variety available, but I think better to think of the LLM as an additional (all-knowing) person you can consult. If everyone consults that same person for an answer to that assignment it's trivial to detect.


If I were the students in the OP's story, the lesson I've learnt would not be "I have to be a better English writer". It would be "I have to cheat better next time so I won't get caught".


The current equivalent is the "just copy the Wiki article".

I've started to notice the low-effort YouTube videos where the arguments / points / facts are presented in the same sequence as the matching articled on Wikipedia.


> a red headed step child

Very good point, but please stop using this phrase.


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

Search: