This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/csi -s | |
;; -*- coding:utf-8; mode:Scheme -*- | |
(use extras) | |
(define (pide-nombre) | |
(display "Hola, ¿Cuál es tu nombre?: ") | |
(read-line)) | |
(define (pide-ann) | |
(display "¿En qué año naciste?: ") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; -*- coding:utf-8; mode: Scheme -*- | |
(define-alias JFrame javax.swing.JFrame) | |
(define-alias Runnable java.lang.Runnable) | |
(define-alias EventQueue java.awt.EventQueue) | |
(define-simple-class MyApp (Runnable) | |
;; members | |
(main-wnd ::JFrame | |
init: (JFrame "Window Title" | |
default-close-operation: JFrame:EXIT_ON_CLOSE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- coding:utf-8; mode: Groovy -*- | |
import javax.swing.JFrame | |
import java.lang.Runnable | |
import java.awt.EventQueue | |
class MyApp implements Runnable { | |
// members | |
JFrame main_window | |
// methods | |
public MyApp() { //constructor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Versión iterativa compacta con DO | |
(define (fib n) | |
(do ((a 0 b)(b 1 (+ a b))(i n (- i 1))) | |
((= i 0) a ))) | |
;; Versión iterativa explícita con named LET | |
(define (fib n) | |
(let loop ((a 0) | |
(b 1) | |
(i n)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; -*- coding: utf-8; mode: Scheme -*- | |
;; FizzBuzz en Scheme R5 (Kawa, Chicken) sin utilizar funciones de bibliotecas extras | |
;;------------------------------------------------------------------------ | |
(define (my-iota n #!optional (i 0)) | |
"Regresa una lista de N numeros naturales consecutivos que van desde | |
I=0 hasta N-1 por default y opcionalmente desde I hasta N si se | |
proporciona I >= 0" | |
(if (and (>= n 0) (integer? n)) ;; Definida solo para los Naturales | |
;; Versión recursiva con NAMED LET es efectivamente iterativa | |
(let loop ((j i) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; -*- coding: utf-8; mode: scheme -*- | |
;; $Id: num-roman-test.scm,v 1.2 2012/07/08 00:09:35 alcides_fp Exp $ | |
(cond-expand (chicken (require-extension srfi-64)) | |
(kawa (require 'srfi-64))) | |
(load "num-roman.scm") | |
(test-begin "num-roman-suite") | |
;;------------------------------------------------------------------------ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; -*- coding: utf-8; mode: Scheme -*- | |
;; $Id: num-roman.scm,v 1.3 2012/07/31 05:39:03 alcides_fp Exp $ | |
(cond-expand (chicken (require-extension srfi-1)) | |
(kawa (require 'srfi-1))) | |
;;------------------------------------------------------------------------ | |
(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") | |
#("" "C" "CC" "CCC" "CD" "D" "DC" "DCC" "DCCC" "CM") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; -*- coding:utf-8; mode:Lisp -*- | |
;; Snippet de código utilizando Swing en Armed Bear Common Lisp | |
(require :abcl-contrib) | |
(require :jss) | |
(let ((frame1 (jss:new :JFrame "Ventana Hola")) ) | |
(#"add" frame1 (jss:new :JLabel "Hola a todos desde ABCL")) | |
(#"pack" frame1) | |
(#"setDefaultCloseOperation" frame1 (jss:get-java-field :JFrame "EXIT_ON_CLOSE")) | |
(#"setVisible" frame1 +true+)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; -*- coding: utf-8; mode: Scheme -*- | |
#lang racket | |
(provide dec->hex) | |
(define (dec->hex num) | |
(let ((base 16) | |
(cifras-hex "0123456789ABCDEF")) | |
(do ((cantidad num (quotient cantidad base)) |