Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Mathlete posted:

The big example is implementing a prime number sieve. In python, I'd just make a bitstring or something and play whack-a-mole. It's true that you can always set! the elements of mutable vectors in Racket, but the process is so wordy that you are practically discouraged from doing it. What would you do in a language like Haskell where apparently you can't mutate anything?

Funny you should ask - there's a rather interesting paper around exactly this question, which also explains quite well why the "straightforward" functional implementation one might write is actually completely terrible.

Jabor fucked around with this message at 11:20 on Jul 20, 2015

Adbot
ADBOT LOVES YOU

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Snak posted:

You can tell that it's wrong right away, because c is not a list. So the tail function obviously does not belong there. The recursion itself needs to be implemented in the Seq case, since that's the only place the code knows there's more than one statement.

What are the actual semantics of NewInt? It looks to me like you might be overthinking it a little bit.

  • Locked thread