Skip to content

Instantly share code, notes, and snippets.

Red []
#macro [
integer!
'times
block!
] func [start end] [
change/part start
reduce [
'loop start/1 start/3
@guaracy
guaracy / cmds.red
Last active November 19, 2016 04:16
Red [
Title: "Red - functions"
Author: "Guaracy Monteiro"
Version: 0.0.1
Needs: 'View
]
;#include %help.red ; help.red from %environment/console
fn: copy []
Red [
Title: "Dessaturate"
Author: "Guaracy Monteiro"
Needs: 'View
Version: 0.1
]
desaturate: function [
image
/Lightness
@guaracy
guaracy / clientes.cob
Last active May 24, 2022 13:47
Exemplo crud em cobol para cadastro de clientes
IDENTIFICATION DIVISION.
PROGRAM-ID. CLIENTES.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT FILE1 ASSIGN TO DISK
ORGANIZATION IS INDEXED
ACCESS MODE IS RANDOM
FILE STATUS IS FS-STAT
`0:\:{x[z],y,a,x[z],a,"Take one down, pass it around",a,x[z-1],y,a,a:"\n"}[{($x)," bottle",:[x=1;"";"s"]," of beer"};" on the wall"]'|1_!100
\\
Red []
max: 99
bottles: max
while [bottles > 0] [
bottle_word: either bottles = 1 ["bottle"]["bottles"]
if bottles <> max [
print "Take one down and pass it arround"
print [bottles bottle_word "of beer on the wall"]
var
max : integer = 99;
bottles : integer;
bottle_word : string;
begin
for bottles := max downto 1 do begin
if bottles = 1 then
bottle_word := 'bottle'
else
(*
* Aplicativo de Agenda Eletrônica - versão em Pascal
* Desenvolvido por Rafael D. Toledo
* (rafaeldtoledo@gmail.com)
* Baixado de http://striker07.wordpress.com
* Compartilhe, use à vontade, mas cite a fonte! =)
*)
program
agendaEletronica;
using System;
namespace ConsoleApplication11
{
class Program
{
static void Main(string[] args)
{
Program p = new Program();
identification division.
program-id. 99-bottles.
data division.
working-storage section.
77 max pic 9(02) value 99.
77 bottle-word pic x(07).
77 bottles pic 99.