Skip to content

Instantly share code, notes, and snippets.

View alcidesfp's full-sized avatar

Alcides Flores Pineda alcidesfp

View GitHub Profile
@alcidesfp
alcidesfp / num-roman.rkt
Created February 22, 2012 19:40
Kata Roman Numerals en Scheme Racket idiomático (funcional)
;; -*- coding: utf-8; mode: scheme -*-
;; $Id: num-roman.rkt,v 1.14 2012/02/16 04:02:35 alcides_fp Exp $
#lang racket
(provide numeral)
(define (numeral digito posicion)
(let ((matriz-numerales
#(#("" "I" "II" "III" "IV" "V" "VI" "VII" "VIII" "IX")
#("" "X" "XX" "XXX" "XL" "L" "LX" "LXX" "LXXX" "XC")
@alcidesfp
alcidesfp / numero-lcd-test.rkt
Created March 13, 2012 05:58
Kata NumberToLCD en Racket - Pruebas Unitarias
;; -*- coding:utf-8; mode:Scheme -*-
#lang racket
(require rackunit
rackunit/text-ui
"numero-lcd.rkt")
(define-test-suite numero-lcd-suite
(test-case
@alcidesfp
alcidesfp / numero-lcd.rkt
Created March 13, 2012 06:00
Kata NumberToLCD en Racket - Código de producción
;; -*- coding:utf-8; mode:Scheme -*-
#lang racket
(provide num->lcd)
(define cadenas #((string-append " - \n"
"| |\n"
" \n"
"| |\n"
" - \n") ;;0
@alcidesfp
alcidesfp / SimpleFrame.java
Created April 24, 2012 13:35
Ejemplo Swing Java
// -*- coding:utf-8; -*-
import java.awt.event.*;
import java.awt.BorderLayout;
import javax.swing.*;
/* Demuestra el uso de clases Swing en Java */
public class SimpleFrame extends JFrame {
public JLabel label;
@alcidesfp
alcidesfp / SimpleFrame.rb
Created April 24, 2012 13:40
Ejemplo Swing JRuby
#! /usr/bin/env jruby
# -*- coding:utf-8; -*-
'Demuestra el uso de clases Java Swing en JRuby'
require 'java'
#=========================================================================
class SimpleFrame < javax.swing.JFrame
@alcidesfp
alcidesfp / SimpleFrame.py
Created April 24, 2012 13:42
Ejemplo Swing Jython
#! /usr/bin/env jython
#-*- coding: utf-8; mode: Jython -*-
"Demuestra el uso de clases Java Swing en Jython"
from java.awt import BorderLayout
from javax import swing
#=========================================================================
class SimpleFrame(swing.JFrame):
@alcidesfp
alcidesfp / simple_frame.scm
Last active October 15, 2015 05:49
Ejemplo Swing Kawa
;; -*- coding:utf-8; mode:Scheme -*-
"Shows howto use Java Swing classes in Kawa Scheme"
(define-alias JLabel javax.swing.JLabel)
(define-alias JButton javax.swing.JButton)
;;========================================================================
(define-simple-class SimpleFrame (javax.swing.JFrame)
;; members
@alcidesfp
alcidesfp / gist:2591156
Created May 4, 2012 01:42
Snippet Swing Clojure
(ns demo1 (:import (javax.swing JFrame JLabel)))
(doto (JFrame. "Hello")
(.add (JLabel. "Hello, World!"))
(.pack)
(.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE)
(.setVisible true))
@alcidesfp
alcidesfp / gist:2591169
Created May 4, 2012 01:44
Snippet Swing Kawa
(define-alias JFrame javax.swing.JFrame)
(let ((f (JFrame "Hola")))
(f:add (javax.swing.JLabel "¡Hola a todos!"))
(f:pack)
(f:setDefaultCloseOperation JFrame:EXIT_ON_CLOSE)
(f:setVisible #t))
@alcidesfp
alcidesfp / persona1.scm
Last active October 4, 2015 20:38
Clase simple en Kawa
;; -*- coding:utf-8; mode:Scheme -*-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-simple-class Person ()
;; members
(name init: "" )
(birth-year init: 0 )
;; methods
((*init*) #!void) ;; default constructor
((*init* name: birth-year:) ;; constructor with params