veganism.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
Veganism Social is a welcoming space on the internet for vegans to connect and engage with the broader decentralized social media community.

Administered by:

Server stats:

295
active users

#recursion

1 post1 participant0 posts today

@looopTools

Fair enough. Because recursion always has a limit, in any language, the tutorials probably assume you're aware of this already. The specific limit in Python is adjustable, but there's no way to eliminate it altogether.

Do the tutorials actually include data/examples that run into the recursion limit? Or is it only when applying code like that to other data that you run into issues?

I ask because the easiest way to smash the limit is to create a cyclic data structure, which is trivial in Python. If you naively recurse such an object, it goes on forever - until it hits the configured limit or the machine runs out of memory, anyways. i.e. this case:

>>> foo = ["bar"]
>>> foo.append(foo)
>>> foo
['bar', [...]]

If you think it's possible your recursion code might have to deal with something like this, you usually end up keeping track of the objects you've already processed, and skip them if you see the same object again (typically by the object ID).

In many cases, you can also rewrite recursive code so that it's not recursive, and cannot run into this problem. As a bonus, problems that can be refactored this way usually run faster without the recursion.

#politics #DOGE #GAO #oversight #recursion

"[Wired], citing government records and sources, revealed that the Government Accountability Office (GAO) launched an investigation back in March into how Elon Musk’s pseudo-agency has been handling data in the offices that it has pried its way into."

gizmodo.com/the-government-acc

Gizmodo · DOGE Is About to Get DOGE'dAn audit of DOGE’s handling of data at federal agencies is reportedly underway.

🥳 Oh wow, a 2023 #Java article using #ASM to dabble in tail call recursion—because who doesn't love a good #bytecode manipulation adventure, right? 📜 Pro tip: avoid #recursion altogether and save yourself from this academic exercise in "elegance." 🙄
unlinkedlist.org/2023/03/19/ta #tailcall #programming #tips #elegance #HackerNews #ngated

unlinkedlist.orgTail Call Recursion in Java with ASM – UnlinkedList

What is this kind of recursion called?

Where the recursive function can call itself from more than one of its branches?

---

(defun my-set-minus (a b)
(cond

( (null a) nil)
( (member (first a) b) (my-set-minus (cdr a) b))
( t (cons (first a) (my-set-minus (cdr a) b)) )

)
)

🚨 OMG, #recursion is the enemy! Who knew XML parsers were the real #villains of the software world? 😱 Apparently, the thrilling tale of CVE-2024-8176 will keep you on the edge of your chair—if you can stay awake through all the riveting details about #C99 and MIT licenses. 📜💤
blog.hartwork.org/posts/expat- #XMLparsers #CVE20248176 #MITlicenses #HackerNews #ngated

blog.hartwork.orgHartwork Blog · Recursion kills: The story behind CVE-2024-8176 / Expat 2.7.0 released, includes security fixes

👨‍💻 Ah, behold the latest triumph in the annals of "because we can" programming: Zinc! A systems language so cutting-edge it managed to rediscover the joys of #recursion... and parsing! ⚙️✨ Meanwhile, not-so-secretly, developers everywhere are still trying to figure out why they need another #programming language when we already have 256 too many. 🤔🔍
sr.ht/~oconnor0/zinc/ #Zinc #systemslanguage #codingtriumph #HackerNews #HackerNews #ngated

Replied to Chuck Darwin

A handful of mini-revolutions have already occurred.

One came in the mid-2000s,
when Ruth #Britto, Freddy #Cachazo, Bo #Feng and Edward #Witten discovered the “#recursion #relations,”
equations that let physicists condense hundreds of pages of Feynman diagrams to mere lines.

Around the same time, Arkani-Hamed joined the hunt for a new conceptual perspective on particle physics,
after a couple of thought experiments led him to doubt that space and time are truly well-founded physical concepts.

Several years later, he and Trnka discovered the amplituhedron.

The amplituhedron is a curvy shape whose contours encode the number and orientation of particles involved in an interaction.

Its volume gives the amplitude for that interaction to occur.

This volume equals the sum of amplitudes of all the Feynman diagrams depicting the various alternative ways the interaction could play out,
but in this case you calculate the answer without reference to those spatiotemporal dynamics;

all you need is the list of momentums of the particles that exist before and after the interaction.

“However the scattering happens, it’s controlled by this real structure,”
said Vijay Balasubramanian, a physicist at the University of Pennsylvania who studies quantum gravity.

“You don’t have to talk about space-time.”

The surprising discovery brought new people into the search.

But the amplituhedron worked only for a theory of particles that came hand in hand with exotic partner particles,
a simplifying balance called supersymmetry.

(Generally speaking, one quantum “theory” describes one specific set of rules for one specific set of particles.
As such, there are many quantum theories, some for real particles and others for fictitious ones.)

“You’re a little bit suspicious that maybe the amazing things you’re seeing have nothing to do with the real world,” said Giulio Salvatori,
a physicist who would later join the group.

In the following years, Arkani-Hamed’s team identified a second type of shape,
the “#associahedron,” that worked in a similar way.

It had flat sides, and its volume gave scattering amplitudes for the particles of a simplified quantum theory,
one that’s easier to study.

The particles in this theory carry a type of charge called “color” that is also carried by the quarks and gluons in real-world atomic nuclei.

(This charge has nothing to do with actual colors, but the mathematics of how charges combine to make color-neutral composite particles resembles how red, green and blue light together make white.)

The particles of this theory also lack supersymmetric partners.

The associahedron therefore represented a major step toward the real world.

But the shape gave only partial answers, producing amplitudes for only the shortest sequences of subatomic events.

Sensing a breakthrough was close, Arkani-Hamed recruited Salvatori and Hadleigh Frost at the University of Oxford,
young physicists who had been independently advancing the understanding of the associahedron’s strange shapes,
along with the mathematicians Pierre-Guy Plamondon and Hugh Thomas.

In 2019, the gang started looking for a geometrical route to all of these amplitudes.

Then the pandemic hit,
and the team left our space-time to work in the digital ether of Zoom.

They would emerge two years later with a second revolutionary way of doing quantum physics.

Many people say that #Rust is very hard to #prototype with or to #refactor. This couldn't be further from the truth! It is the exact opposite!

Let me share with you one of the most profound experiences I had with #RustLang on a casual sunday - a thread 🧵

I'm currently rewriting my #transpiler from #nom to #chumsky and until now everything has turned out great so far, until I've hit the following road block:
Implementing parsers by using #parser functions that have indirect #recursion.

1/11