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 -*- | |
| (cond-expand (chicken (require-extension srfi-64)) | |
| (kawa (require 'srfi-64))) | |
| (load "dec-hex.scm") | |
| (test-begin "dec-hex-suite") | |
| (test-begin "caso-prueba-1") | |
| (let ((pruebas '((253 "FD") |
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 (dec->hex num) ;; versión iterativa con DO | |
| "Función de conversión de números decimales a hexadecimales" | |
| (if (and (integer? num)(>= num 0)) ;; def solo para enteros positivos | |
| (let ((base 16) | |
| (cifras-hex "0123456789ABCDEF")) | |
| (do ((cantidad num (quotient cantidad base)) | |
| (retval '() (cons (string-ref cifras-hex (remainder cantidad base)) | |
| retval))) | |
| ((= cantidad 0)(if (null? retval) "0" (list->string retval))) )))) |
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-simple-class Person () | |
| ;; members | |
| (name init: "" ) | |
| (birth-year init: 0 ) | |
| ;; methods | |
| ((*init*) #!void) ;; default constructor | |
| ((*init* name: birth-year:) ;; constructor with params |
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
| (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)) |
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
| (ns demo1 (:import (javax.swing JFrame JLabel))) | |
| (doto (JFrame. "Hello") | |
| (.add (JLabel. "Hello, World!")) | |
| (.pack) | |
| (.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE) | |
| (.setVisible 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 -*- | |
| "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 |
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/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): |
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/bin/env jruby | |
| # -*- coding:utf-8; -*- | |
| 'Demuestra el uso de clases Java Swing en JRuby' | |
| require 'java' | |
| #========================================================================= | |
| class SimpleFrame < javax.swing.JFrame |
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; -*- | |
| 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; |
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 num->lcd) | |
| (define cadenas #((string-append " - \n" | |
| "| |\n" | |
| " \n" | |
| "| |\n" | |
| " - \n") ;;0 |