mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-12-08 04:18:48 +00:00
Merge pull request #1782 from anpar/master
Add Oz to recognized languages
This commit is contained in:
@@ -410,3 +410,5 @@ https://github.com/vmg/zephir-sublime:
|
|||||||
- source.php.zephir
|
- source.php.zephir
|
||||||
https://github.com/whitequark/llvm.tmbundle:
|
https://github.com/whitequark/llvm.tmbundle:
|
||||||
- source.llvm
|
- source.llvm
|
||||||
|
https://github.com/eregon/oz-tmbundle:
|
||||||
|
- source.oz
|
||||||
|
|||||||
@@ -1849,6 +1849,13 @@ Oxygene:
|
|||||||
- .oxygene
|
- .oxygene
|
||||||
tm_scope: none
|
tm_scope: none
|
||||||
|
|
||||||
|
Oz:
|
||||||
|
type: programming
|
||||||
|
color: "#fcaf3e"
|
||||||
|
extensions:
|
||||||
|
- .oz
|
||||||
|
tm_scope: source.oz
|
||||||
|
|
||||||
PAWN:
|
PAWN:
|
||||||
type: programming
|
type: programming
|
||||||
color: "#dbb284"
|
color: "#dbb284"
|
||||||
|
|||||||
52
samples/Oz/example.oz
Normal file
52
samples/Oz/example.oz
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
% You can get a lot of information about Oz by following theses links :
|
||||||
|
% - http://mozart.github.io/
|
||||||
|
% - http://en.wikipedia.org/wiki/Oz_(programming_language)
|
||||||
|
% There is also a well known book that uses Oz for pedagogical reason :
|
||||||
|
% - http://mitpress.mit.edu/books/concepts-techniques-and-models-computer-programming
|
||||||
|
% And there are two courses on edX about 'Paradigms of Computer Programming' that also uses Oz for pedagogical reason :
|
||||||
|
% - https://www.edx.org/node/2751#.VHijtfl5OSo
|
||||||
|
% - https://www.edx.org/node/4436#.VHijzfl5OSo
|
||||||
|
%
|
||||||
|
% Here is an example of some code written with Oz.
|
||||||
|
|
||||||
|
declare
|
||||||
|
% Computes the sum of square of the N first integers.
|
||||||
|
fun {Sum N}
|
||||||
|
local SumAux in
|
||||||
|
fun {SumAux N Acc}
|
||||||
|
if N==0 then Acc
|
||||||
|
else
|
||||||
|
{Sum N-1 Acc}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
{SumAux N 0}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
% Returns true if N is a prime and false otherwize
|
||||||
|
fun {Prime N}
|
||||||
|
local PrimeAcc in
|
||||||
|
fun {PrimeAcc N Acc}
|
||||||
|
if(N == 1) then false
|
||||||
|
elseif(Acc == 1) then true
|
||||||
|
else
|
||||||
|
if (N mod Acc) == 0 then false
|
||||||
|
else
|
||||||
|
{PrimeAcc N Acc-1}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
{PrimeAcc N (N div 2)}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
% Reverse a list using cells and for loop (instead of recursivity)
|
||||||
|
fun {Reverse L}
|
||||||
|
local RevList in
|
||||||
|
RevList = {NewCell nil}
|
||||||
|
for E in L do
|
||||||
|
RevList := E|@RevList
|
||||||
|
end
|
||||||
|
@RevList
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user