Subject: mailing-list for TeXmacs Users
List archive
From : "Adrian S." <address@hidden>- To: address@hidden
- Subject: [TeXmacs] A menu for scheme learners, and a macro to speed up editing.
- Date: Tue, 6 Mar 2012 17:53:48 -0700
Here are two things:
The first one is a modification of a macro by Alvaro to speed up editing. I think the modification is better, specially if the math equation has fractions. It might help someone.
The second one is a menu with some Scheme constructs. It might be helpful for someone.
Both can go inside of .TeXmacs/progs/my-init-texmacs.scm
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Macro for better editing formulas
; modified from a macro by Alvaro Tejero
;;;;;;;;;;;;;;;;;;;;;;;;;;
(kbd-map
(:mode in-math?)
("return"
(if
(or (inside? 'hybrid) (inside? 'label) (inside? 'phantom) (in-prog?))
(begin (kbd-return))
(begin (traverse-right)))))
(kbd-map
(:mode in-math?)
("S-return"
(if
(or (inside? 'hybrid) (inside? 'label) (inside? 'phantom) (in-prog?))
(begin (kbd-return))
(begin (traverse-left)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;A menu for those learning scheme
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(menu-extend texmacs-extra-menu
(=> "Schelp"
(-> "Assignements"
(-> "define"
("Define variable"
(insert "(define <var> <exp>)"))
("Define procedure"
(insert "(define (<procedure_name> <var_1> <etc>) <exp_1> <exp_2> <etc>)"))
("Define procedure with variable number of arguments"
(insert "(define (<procedure_name> . <var_r>) <exp_1> <etc>)"))
("Define procedure with variable number of arguments"
(insert "(define (<procedure_name> <var_1> <etc> . <var_r>) <exp_1> <exp_2> <etc>)")))
("let"
(insert "(let ((<var_1> <exp_1>) <etc>) <exp1> <etc>)"))
("let*"
(insert "(let* ((<var_1> <exp_1>) <etc>) <exp1> <etc>)"))
("letrec"
(insert "(letrec((<function> (lambda (<var> <etc>) <exp1> <etc>))<etc>) <exp1> <etc>)"))
("set!"
(insert "(set! <var> <exp>)")))
(-> "Loops"
("Do"
(insert "(do ((<loop_variable> <initial_value> <update_expresion>)<etc>)(<test_to_finish> <exp_1_after_finish> <etc>) <exp_1> <etc>)"))
("named let (for iteration)"
(insert "(let <loop_name> ((<loop_variable> <initial_value>)<etc>) (if <test> (begin <exp_1> <etc> (loop_name <new_value>))))"))
("named let (general)"
(insert "(let <loop_name> ((<loop_variable> <initial_value>)<etc>)<exp1> <etc>)"))
("while"
(insert "(while <test> <exp_1> <etc>)"))
("for-each"
(insert "(for-each <function> <list_1> <etc>)"))
("map (returns a list)"
(insert "(map <function <list_1> <etc>)"))
("apply"
(insert "(apply <procedure> <obj_1> <etc> <list_1> <etc>")))
(-> "Program flow"
("If"
(insert "(if <test> <exp_if_true> <exp_if_false>"))
("If (a common variant)"
(insert "(if <test> (begin <exp1> <etc>) (begin <exp1> <etc>))"))
("cond"
(insert "(cond ((<test_1> <exp_1> <etc>)<etc>)"))
("case"
(insert "(case <expresion> (<key> <exp_1>)<etc>)"))
(-> "other"
("cond"
(insert "(cond <clause_1> <etc>)"))
(-> "clauses for cond"
("(test)"
(insert "(<test>)"))
("(<test> <exp>)"
(insert "(<test> <exp_1> <etc>)"))
("(<test> => <procedure>)"
(insert "(<test> => <procedure>)"))
("(else <exp_1> <etc>)"
(insert "(else <exp_1> <etc>)")))))
(-> "functions"
("lambda"
(insert "(lambda (<var_1> <etc>)<exp_1> <etc>)")))
(-> "tests"
("eq?"
(insert "(eq? <obj_1> <obj_2>)"))
("eqv?"
(insert "(eqv? <obj_1> <obj_2>)"))
("equal?"
(insert "(equal? <obj_1> <obj_2>)"))
("null?"
(insert "(null? <obj>)"))
("positive?"
(insert "(positive? <obj>)"))
("list?"
(insert "(list? <obj>)"))
("symbol?"
(insert "(symbol? <obj>)"))
("boolean?"
(insert "(boolean? <obj>)"))
("pair?"
(insert "(pair? <obj>)"))
("number?"
(insert "(number? <obj>)"))
("integer?"
(insert "(integer? <obj>)"))
("real?"
(insert "(real? <obj>)"))
("complex?"
(insert "(complex? <obj>)"))
("char?"
(insert "(char? <obj>)"))
("string?"
(insert "(string? <obj>)"))
("vector?"
(insert "(vector? <obj>)"))
("symbol?"
(insert "(symbol? <obj>)"))
("procedure?"
(insert "(procedure? <obj>)"))
("zero?"
(insert "(zero? <obj>)")))
(-> "transformations"
("string->list"
(insert "(string->list <string>)"))
("string->number"
(insert "(string->number <string>"))
("string->number (base n)"
(insert "(string->number <string> <base>)"))
("string->symbol"
(insert "(string->symbol <string>)"))
("symbol->string"
(insert "(symbol->string <symbol>)"))
("vector->list"
(insert "(vector->list <vector>)"))
("number->string"
(insert "(number? <obj>)"))
("number->string (base n)"
(insert "(number->string <number> <base>)"))
("list->string"
(insert "(list->string <list>)"))
("list->vector"
(insert "(list->vector <list>)"))))))
- [TeXmacs] A menu for scheme learners, and a macro to speed up editing., Adrian S., 03/07/2012
Archive powered by MHonArc 2.6.19.