The ---
separator is not squeak syntax, but is presented to distinguish IDE("Browser") code from REPL content ("Workspace").
This file contains 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
#lang plai | |
(print-only-errors #t) | |
(define-type AE | |
[num (n number?)] | |
[bool (n boolean?)] | |
[bool-and (lhs AE?) (rhs AE?)] | |
[bool-or (lhs AE?) (rhs AE?)] | |
[bool-not (s AE?)] | |
[add (lhs AE?) |
This file contains 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
#lang plai | |
(print-only-errors #t) | |
;fibs : int -> int | |
;Retorna el n-esimo numero de fibonacci | |
(define (fibs n) | |
(cond | |
((equal? n 1) 0) | |
((equal? n 2) 1) | |
(else (+ (fibs (- n 1)) (fibs (- n 2))))) |
This file contains 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
#lang plai | |
#| | |
<WAE> ::= <num> | |
| {+ <WAE> <WAE>} | |
| {- <WAE> <WAE>} | |
| {with {<id> <WAE>} <WAE>} | |
| <id> | |
|# | |
(define-type WAE |
This file contains 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
#lang racket | |
(define (my-if pred true false) | |
(if | |
(pred) | |
(true) | |
(false))) | |
;(define (infiniteloop x) | |
; (infiniteloop x)) |
This file contains 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
#lang plazy | |
(define (my-if p t f) | |
(if p t f)) | |
(define (infiniteloop x) | |
(infiniteloop x)) | |
;al contrario de #lang racket, aquí esta función sí funciona correctamente. | |
(my-if #f (infiniteloop 0) 123) |
This file contains 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
#lang racket | |
;P1 No. Al evaluar, el nombre 'fibs en la llamada recursiva no se encontrará en el ambiente. | |
;P3: | |
;pow no es recursiva por la cola | |
(define (pow base exp) | |
(if (= exp 0) | |
1 |
This file contains 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
brew install ncurses | |
gem install ncursesw -- --with-opt-dir=/usr/local/opt/ncurses |
This file contains 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 pipe | |
; Inspired on F#'s Forward pipe operator (|>) | |
(lambda args | |
(let ((v (car args)) | |
(functions (cdr args))) | |
(foldl (λ (f v) (f v)) v functions)))) | |
(test (pipe 1 | |
add1 |
This file contains 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
#lang slideshow | |
(require slideshow/play) | |
(provide timer-slide) | |
(module stopwatch racket | |
(provide (all-defined-out)) | |
(define time? number?) | |
(define (seconds n) n) |
OlderNewer