Skip to content

Instantly share code, notes, and snippets.

define method newtons-sqrt (x :: <number>)
local method sqrt1 (guess)
// note call to other local method
if (close-enough? (guess))
guess
else
sqrt1 (improve (guess)) // note self-recursive call
end if
end sqrt1,
method close-enough? (guess)
PROCEDURE Move * (VAR p:Base; dt:Float; VAR r:Reflection; mode:MovementMode): BOOLEAN;
(** Moves the specified particle p in all the space with a straight trajectory
taking into account possible reflections from walls. r.Process(p) is
called every time after the particle is collided with the wall and
mirror-reflected form it. At that p.r contains coordinate of the collision
with the wall, p.v contains speed of the particle after the elastic mirror
reflection, r.wall contains the wall, r.alive contains TRUE.
If r.alive=FALSE after the collision then the particle is not anymore
moved. Also r.Process() may change p.v.
{$A+,B-,D+,E+,F-,G-,I-,L+,N-,O-,R+,S+,V+,X-}
{$M 16384,0,655360}
{******************************************************}
{* Алгоритм уплотнения данных по методу *}
{* Хафмана. *}
{******************************************************}
Program Hafman;
Uses Crt,Dos,Printer;
PROCEDURE Blur2DArray*;
VAR
time : LONGINT;
f, n : INTEGER;
x, y : INTEGER;
color : INTEGER;
a, b : POINTER TO Plane;
BEGIN
NEW(a);
NEW(b);
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
with Ada.Real_Time; use Ada.Real_Time;
with Interfaces; use Interfaces;
procedure Main is
package Duration_IO is new Ada.Text_IO.Fixed_IO(Duration); use Duration_IO;
width : constant integer := 640;
height : constant integer := 480;
#include <iostream>
#include <ctime>
enum Color {
RED = 0,
GREEN,
BLUE
};
const int width = 640;
public class Blur {
final static int RED = 0;
final static int GREEN = 1;
final static int BLUE = 2;
final static int width = 640;
final static int height = 480;
final static int frames = 1000;
final static int N = 13;
switch(o=symbol()) {
case 22: /* string */
if (width!=2)
bxdec();
printf("L%d\n", cval);
break;
case 41: /* - const */
if ((o=symbol())==23) { /* float */
@valexey
valexey / gist:6444140
Created September 4, 2013 23:22
Oberon processing demo module
MODULE Tree;
IMPORT PageInit, P := Processing;
VAR
theta : REAL;
PROCEDURE Branch(h : REAL);
BEGIN
h := 0.66*h;
@valexey
valexey / gist:6444154
Created September 4, 2013 23:23
Original processing tree demo
float theta;
void setup() {
size(640, 360);
}
void draw() {
background(0);
frameRate(30);
stroke(255);