kids encyclopedia robot

Kent Recursive Calculator facts for kids

Kids Encyclopedia Facts
Quick facts for kids
KRC
Paradigm functional
Designed by David Turner
First appeared 1981; 44 years ago (1981)
Influenced by
SASL
Influenced
Miranda

KRC stands for Kent Recursive Calculator. It is a special kind of programming language that helps computers solve problems. KRC was designed to be easy to understand and use, especially for teaching people how to think about computer programs in a new way.

What is KRC?

KRC is known as a lazy functional language. This means it works differently from many other programming languages you might hear about.

Functional Programming Explained

In a functional language, you write programs by creating "functions." Think of a function like a math formula or a recipe. It takes some ingredients (inputs) and always gives you the same result (output) without changing anything else. This makes programs easier to test and understand.

What "Lazy" Means in KRC

The "lazy" part means KRC only does calculations when it absolutely needs to. Imagine you have a long list of chores. A "lazy" person might only do a chore if someone asks them to, not just because it's on the list. KRC works similarly with calculations, which can make some programs run faster or handle very large tasks more easily.

How KRC Was Made

KRC was created by a computer scientist named David Turner. He worked on it from November 1979 to October 1981. KRC was built upon an older language called SASL, which David Turner also designed.

Key Features of KRC

KRC had some cool features that made it powerful:

  • Pattern Matching: This lets you write code that looks for specific patterns in data. It's like sorting your toys by shape or color.
  • Guards: These are like special conditions that must be true before a part of your code can run. For example, "only if the light is green, then go."
  • ZF Expressions (List Comprehensions): This is a neat way to build lists of things. Imagine you want a list of all even numbers from 1 to 10. You can tell KRC to "give me all numbers 'x' from 1 to 10, where 'x' is even." This makes creating lists much simpler.

Where KRC Was Used

Two main versions of KRC were created. David Turner made the first one using a language called BCPL. It ran on a system called EMAS. Later, another person named Simon J. Croft made a version using the C language, which worked on Unix computers.

KRC was very important for teaching. From 1982 to 1985, it was the main language used to teach functional programming at the University of Kent at Canterbury in the UK. Many students learned how to program using KRC.

KRC's Successor: Miranda

KRC led to a newer and even more advanced language called Miranda. Miranda added new features, like a special system for checking the "types" of data in a program. This helps programmers avoid mistakes and makes their code more reliable.

kids search engine
Kent Recursive Calculator Facts for Kids. Kiddle Encyclopedia.