I'm studying lisp language (to do lisp routines) and in a general context i know what's a routine, but in a technical context i can talk about it, because i'm starting to learn routines now. So, what's the real definition of routine? (i've already "googled" this but didn't find anything)
1 : a usual order and way of doing something Taking a shower is part of my morning routine. 2 : a series of things that are repeated as part of a performance a dance routine. routine. adjective. Kids Definition of routine (Entry 2 of 2)
First, let's define what routine means: A routine is a sequence of actions that you do repeatedly. Brushing your teeth nightly and getting ready for bed is a routine. Waking up at 6:00 AM and exercising every morning is a routine.
What is Routine in OS? In computer programming, a routine is a sequence of code that is intended to be called and used repeatedly during the execution of a program. It can range from a subroutine, co-routine to a function. This makes the program shorter and easier to write and read when necessary.
A procedure is a routine that can accept arguments but does not return any values. A function is a routine that can accept arguments and returns one or more values.
The term routine derives from subroutine, which is a more common term in languages like BASIC where one actually creates SUBroutines. (BASIC actually had a difference between a SUBroutine and a FUNCTION, but nevertheless...)
From the Wikipedia entry:
In computer science, a subroutine (also called procedure, function, routine, method, or subprogram) is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code.
As the name "subprogram" suggests, a subroutine behaves in much the same way as a computer program that is used as one step in a larger program or another subprogram. A subroutine is often coded so that it can be started ("called") several times and/or from several places during a single execution of the program, including from other subroutines, and then branch back (return) to the next instruction after the "call" once the subroutine's task is done.
Different languages/environments/eras have different ecosystems and thus different terms to describe the same general concept. I generally only use the term function (or method in an "OOP" environment) these days.
Happy coding.
For fun I have Community Wiki'ed. The list below is hopefully to cover which term(s) is (are) "correct" (widely accepted) to use in a given language to mean routine. Informally routine is used in context of all the languages below so it should be omitted unless it is the defacto term used. Feel free to add, correct, and annotate as appropriate.
def
member of type, functions are first-class values.You can't find a technical definition because there isn't a technical definition specific to lisp. A 'routine', outside of vaudeville, is just another name for a function. While it's been many years since I programmed in Lisp full-time, no one ever used that term in any formal way, or even used it commonly. We talked about 'functions', 'macros', and 'forms.' If someone said, 'oh, there's a routine to calculate how many apples in a pie' it was perfectly informal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With