Here, let "a..b" represent the choice of all values in the range from a to b, and "for(a) do b" loop over all choices in a, producing an array containing the values of b. Then we can write a simple loop like:pic.twitter.com/yVYAUSLSR3
This is the legacy version of twitter.com. We will be shutting it down on June 1, 2020. Please switch to a supported browser, or disable the extension which masks your browser. You can see a list of supported browsers in our Help Center.
You can add location information to your Tweets, such as your city or precise location, from the web and via third-party applications. You always have the option to delete your Tweet location history. Learn more
Add this Tweet to your website by copying the code below. Learn more
Add this video to your website by copying the code below. Learn more
By embedding Twitter content in your website or app, you are agreeing to the Twitter Developer Agreement and Developer Policy.
| Country | Code | For customers of |
|---|---|---|
| United States | 40404 | (any) |
| Canada | 21212 | (any) |
| United Kingdom | 86444 | Vodafone, Orange, 3, O2 |
| Brazil | 40404 | Nextel, TIM |
| Haiti | 40404 | Digicel, Voila |
| Ireland | 51210 | Vodafone, O2 |
| India | 53000 | Bharti Airtel, Videocon, Reliance |
| Indonesia | 89887 | AXIS, 3, Telkomsel, Indosat, XL Axiata |
| Italy | 4880804 | Wind |
| 3424486444 | Vodafone | |
| » See SMS short codes for other countries | ||
This timeline is where you’ll spend most of your time, getting instant updates about what matters to you.
Hover over the profile pic and click the Following button to unfollow any account.
When you see a Tweet you love, tap the heart — it lets the person who wrote it know you shared the love.
The fastest way to share someone else’s Tweet with your followers is with a Retweet. Tap the icon to send it instantly.
Add your thoughts about any Tweet with a Reply. Find a topic you’re passionate about, and jump right in.
Get instant insight into what people are talking about now.
Follow more accounts to get instant updates about topics you care about.
See the latest conversations about any topic instantly.
Catch up instantly on the best stories happening as they unfold.
Here, let "a..b" represent the choice of all values in the range from a to b, and "for(a) do b" loop over all choices in a, producing an array containing the values of b. Then we can write a simple loop like:pic.twitter.com/yVYAUSLSR3
New expressive power comes from our ability to nest choices inside of loops, where each iteration explores all choices. Then we can variably "exponentiate", and write PrintXY as:pic.twitter.com/loFkBD2RaC
Is this a quirky, special-case language feature? Definitely not; it has well-defined semantics and increases the expressive power of loops. And it's what 14-year-old me intuitively tried to do in Apple BASIC.
Tim Sweeney Retweeted Tikhon Jelvis
There are many interesting solutions in this thread. The C and JavaScript solutions seen akin to mechanical devices that crank out solutions. One is an astonishingly short Haskell composition of library functions:https://twitter.com/tikhonjelvis/status/1265453175219183616?s=20 …
Tim Sweeney added,
There is generally a barrier to reading these solutions. In one case you have to run through the behavior of imperative code in your head to understand what it does. In another you have to understand the near magical incantation of pointfree function compositions.
not sure if you are referring to this one in particular, but I don't believe there is much about this that is "point-free" -- aside from one arguable case (using `print` instead of `(\n -> print n)`). Point free is always a stylistic choice and never actually a requirement :)
I do agree that point-free code can be very unreadable, but you can usually get the same expressiveness with fully pointful code -- and @tikhonjelvis 's solution is a shining example 
In this case the main barrier might be the "lingo", but it can be clearer if we name the components: allLengthN n = replicateM n "XY" printAll things = traverse_ print things main = printAll (allLengthN 128)
My brain has a hard time following this style. Am I alone? At every step of this I have to think about what arguments are being plumbed in the course of passing one higher order function to another.
I wouldn't say you're alone! but maybe it's a similar sort of plumbing-tracking that you'd face with nested loops? (difficult w/o practice) In this case tho there are no HOFs passed to any other HOFs -- the only HOF here is traverse_. admittedly not obvious up front from syntax
I understand loops and I understand “map f”. The problem with higher order functions is that one has to understand the unique argument plumbing of “f g” (or worse) for every higher order f, as if each f were a unique language construct.
ah right, I think I see your point. it's like instead of only having to learn for loops and while loops, you have to learn...an endless supply of userspace-defined control flow constructs. It's definitely something that good types make a little more manageable, but not perfect
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.