Skip to content

Instantly share code, notes, and snippets.

View ayaderaghul's full-sized avatar
🐉
Married to Anthony Gorman

Aya de Raghũl ayaderaghul

🐉
Married to Anthony Gorman
View GitHub Profile
@ayaderaghul
ayaderaghul / Harvard-style-citation.scm
Last active August 29, 2015 14:03
Citation program - Harvard style
;; this small program helps to cite academic papers in Harvard style. it produces latex syntax (in a .txt file).
;; reference of sources (and link to the harvard style of citation) can be found at the end of this file.
(require racket/gui/base)
;; cite in havard style
(define frame (new frame% [label "cite"]
[min-width 500]))
;; callback of tab
@ayaderaghul
ayaderaghul / csv->latex.scm
Last active August 29, 2015 14:03
CSV -> Latex table syntax
;; this inputs a csv file and produces table syntax in latex
;; file name sample to enter: gni.csv
;; it outputs automatically
;; note: csv file needs to be produced like this in libre:
;; the separator should be & (latex style) instead of ; or ,
;; any commas left in the csv file should be switched to space or -
;; to avoid confusion because Racket reads csv with commas as separator
;; note: i leave the fixed number of columns to be 10 ^^ (for laziness)
;; that doesnt cause much trouble in latex though
@ayaderaghul
ayaderaghul / sample.scm
Created September 29, 2014 19:37
sample run for racket tutor
;; CONCEPT
; this is a tutorial GUI for each function in racket
; the usage of each function will be demonstrated by interactive examples
; the interaction is made mostly with text fields (for entering data in general) and sliders (for numerical arguments)
; the idea is that user will see the result immediately as silder goes or text entered
; the results (evaluation) are printed out as messages on the canvas
;; how to run this
; to get into a programming environment: open terminal
; to load racket program, type in: racket
@ayaderaghul
ayaderaghul / vector-1.scm
Created September 29, 2014 19:38
GUI for function vector, vector-length, vector-ref, vector-drop, vector-take
;; load the GUI package, picture package & the master file with some support functions
(require racket/gui/base
pict
"master.scm")
#|
SKETCH
______________________________________________
|text field has an exemplary vector
|(hint message & error message)
@ayaderaghul
ayaderaghul / vector-2.scm
Created September 29, 2014 19:39
GUI for function: vector-append, vector-set!
;; load the GUI package
(require racket/gui/base
"master.scm")
#|
SKETCH
______________________________________________
|two text fields for two vectors ready to be appended
|(hint message & error message)
|---------------------
@ayaderaghul
ayaderaghul / if.scm
Created September 30, 2014 18:59
GUI for if
;; load the GUI package
;; and the package that turns messages into picture (ie with color)
(require racket/gui/base
"master.scm")
(require pict)
;; SKETCH
; on the right, the workflow will be shown step by step by sliding the slider
#|
OPERATION PANE ILLUSTRATION PANE
@ayaderaghul
ayaderaghul / master.scm
Created September 30, 2014 18:59
master file for racket tutor (containing support functions)
#lang racket
(require racket/gui/base
pict)
;; SUPPORT FUNCTIONS to read string entered in the text field
(define (read<-data s)
(read (open-input-string s)))
; read<-data is not able to catch extension (error)
; now we add that ability so it becomes (current-data...)
@ayaderaghul
ayaderaghul / cond.scm
Created October 1, 2014 09:43
GUI for cond, and, or
;; load the GUI package
(require racket/gui/base)
;; load the package for colorful message
(require pict)
;; load the support file
(require "master.scm")
;; the biggest canvas
(define big-frame (new frame% [label "cond"]
[min-width 1000]))
@ayaderaghul
ayaderaghul / ibar.rkt
Last active August 29, 2015 14:18
iterated bargaining game, deterministic machines
CREATE NEW VERSION ON GITHUB. DONT CHANGE THIS VERSION!!! JUST DONT!!!
;(require racket) ; for emacs to call REPL
(require racket/gui/base) ; to have TV
(require plot/no-gui) ; to have plot/dc
(require math/base) ; to have sum
;(require math) ; to have mean
;(require 2htdp/batch-io) ; to import csv
(require "csv.rkt") ; to export csv
(plot-new-window? #t)
@ayaderaghul
ayaderaghul / markov.rkt
Created April 17, 2015 13:52
markov chain calculator
(require racket)
(require math/matrix)
(define (array-sum an-array)
(for/sum ([x an-array]) x))
;; absorbing markov chain
;; transition matrix P