Bored and unwilling so doing some emacs vintage timewasting using this : http://vimgolf.com/challenges/4d29ae2107e0177c7e000036
; solution
; making a template, then iterate/expand through input once
; repeat until EOF
;; in
cow moo
horse neigh
duck quack
goose honk
hen cluck
chick peep
pig oink
sheep baa
;;out
Old MacDonald had a farm, E I E I O.
And on that farm he had a cow, E I E I O.
With a moo, moo here and a moo, moo there.
Here a moo, there a moo, everywhere a moo, moo.
Old MacDonald had a farm, E I E I O.
Old MacDonald had a farm, E I E I O.
And on that farm he had a horse, E I E I O.
With a neigh, neigh here and a neigh, neigh there.
Here a neigh, there a neigh, everywhere a neigh, neigh.
Old MacDonald had a farm, E I E I O.
Old MacDonald had a farm, E I E I O.
And on that farm he had a duck, E I E I O.
With a quack, quack here and a quack, quack there.
Here a quack, there a quack, everywhere a quack, quack.
Old MacDonald had a farm, E I E I O.
Old MacDonald had a farm, E I E I O.
And on that farm he had a goose, E I E I O.
With a honk, honk here and a honk, honk there.
Here a honk, there a honk, everywhere a honk, honk.
Old MacDonald had a farm, E I E I O.
Old MacDonald had a farm, E I E I O.
And on that farm he had a hen, E I E I O.
With a cluck, cluck here and a cluck, cluck there.
Here a cluck, there a cluck, everywhere a cluck, cluck.
Old MacDonald had a farm, E I E I O.
Old MacDonald had a farm, E I E I O.
And on that farm he had a chick, E I E I O.
With a peep, peep here and a peep, peep there.
Here a peep, there a peep, everywhere a peep, peep.
Old MacDonald had a farm, E I E I O.
Old MacDonald had a farm, E I E I O.
And on that farm he had a pig, E I E I O.
With an oink, oink here and an oink, oink there.
Here an oink, there an oink, everywhere an oink, oink.
Old MacDonald had a farm, E I E I O.
Old MacDonald had a farm, E I E I O.
And on that farm he had a sheep, E I E I O.
With a baa, baa here and a baa, baa there.
Here a baa, there a baa, everywhere a baa, baa.
Old MacDonald had a farm, E I E I O.
;; tmpl
Old MacDonald had a farm, E I E I O.
And on that farm he had a {{wat}}, E I E I O.
With a {{snd}}, {{snd}} here and a {{snd}}, {{snd}} there.
Here a {{snd}}, there a {{snd}}, everywhere a {{snd}}, {{snd}}.
Old MacDonald had a farm, E I E I O.
;; pre
;; clipboard contains input data
C-x b i n C-j ;; (buffer in)
C-y ;; input
;; preprocess input
M-< C-M-% s SPC <return> SPC <return> !
M-< C-M-% g e e s e <return> g o o s e <return> !
M-<
;; prepare template from out
C-x b o u t <enter> M-< M-h M-w C-x b t e m p C-j C-y
M-<
C-M-% c o w <enter> { { w a t } } <enter>
C-M-% m o o <enter> { { s n d } } <enter>
C-x b i n <enter>
;; main macro
<f3>
;; copy and paste template
C-x o C-x o
M-h M-w
C-x o C-y
;; put animal, sound in kill-ring
C-k
;; move 2 'Old' up
C-r O l d C-r
C-a
;; replace wat -> animal
C-s w a t <return>
M-b <delete> <delete> <delete> <delete> <delete> <backspace> <backspace> C-y
M-b M-d <backspace>
;; replace snd -> sound
C-SPC M-} C-M-% { { s n d } } <return> C-y <return> !
;; next
M-}
C-f
C-u 8 <f4>
Affichage des articles dont le libellé est macro. Afficher tous les articles
Affichage des articles dont le libellé est macro. Afficher tous les articles
lundi 6 mai 2013
mardi 8 janvier 2013
Scala value class-like to php macro
;; '//' SPACE CLASS <NAME> '(' ARGS* ')'
;; class name { private args; function name(args) { $this->args = args } public get_args() { return $this->args; }(fset 'scala-to-php
[?\C-k ?\C-y ?\C-j ?\C-y ?\C-a tab delete delete delete ?\M-f ?\M-f ?\C- ?\C-e ?\C-\M-% ?\( ?\\ ?\( ?. ?* ?\\ ?\) ?\) return ?\{ ?\C-q ?\C-j ?\' ?1 backspace backspace ?\\ ?1 ?\C-q ?\C-j ?\} return ?! ?\C-r ?\{ ?\C-e ?\C-f ?\C- ?\C-e ?\C-\M-% ?, return ?\; ?\C-q ?\C-j return ?! ?\C-e ?\; ?\C- ?\C-r ?\{ ?\C-e ?\C-f ?\C-\M-% ?^ return ? ? ?p ?r ?i ?v ?a ?t ?e ? ?$ return ?! ?\C-e ?\C-j ?\C-y ?\C-a tab delete delete delete ?\M-d ?f ?u ?n ?c ?t ?i ?o ?n ?\C-e ? ?\{ ?\} ?\C-a ?\C-s ?\( ?\C-f ?\C-b ?\C- ?\C-f ?\C-s ?\) ?\C-b ?\C-\M-% ?\\ ?\( ?\[ ?\[ ?: ?a ?s ?c ?i ?i backspace backspace backspace backspace ?l ?p ?h ?a ?\" ?\] ?\] backspace backspace backspace ?: ?\] ?\] ?\\ ?+ backspace backspace ?+ ?\\ ?\) ?\C-b ?\C-e return ?$ ?\' ?1 backspace backspace ?\\ ?1 return ?y ?y ?y ?y ?\C-s ?\{ ?\C-f ?\C-b ?\C-j ?\S-\C-o ?\C-y ?\M-y ?\C-a tab ?\C-s ?\( ?\C- ?\C-a backspace tab ?\C-e backspace ?\C-a tab ?\C- ?\C-e ?\C-\M-% ?, return ?\; ?\C-q ?\C-j return ?! ?\C-e ?\; ?\C-r ?\{ ?\C-e ?\C-f ?\C- ?\C-s ?\} ?\C-p ?\C-e tab ?\C- ?\C-s ?\C-r ?\{ ?\C-e ?\C-f ?\C-\M-% ?\\ ?\( ?\[ ?\[ ?: ?a ?s ?c ?i backspace backspace backspace ?l ?p ?h ?a ?: ?\] ?\] ?+ ?\\ ?\) ?\; return ?p backspace ?$ ?t ?h ?i ?s ?- ?> ?$ ?\\ ?1 ? ?= ? ?$ backspace ?$ ?\\ ?1 ?\; return ?! ?\C-e ?\C-f tab ?\C-e ?\C-j ?\C-y ?\C-a ?\C- ?\C-s ?\( ?\C-? ?\C-s ?\C-m ?\C-r ?/ ?/ ?\C-f ?\C-a ?\C- ?\C-s ?\( ?\C-m backspace ?\C-e backspace ?\C-a ?\C- ?\C-e ?\C-\M-% ?, return ?\C-q ?\C-j return ?! ?\C-r ?\} ?\C-e ?\C-f ?\C- ?\C-s ?\} ?\C-p ?\C-e ?\C-\M-% ?6 ?\\ ?\( backspace backspace backspace ?^ ?\' backspace ?\\ ?\( ?. ?* ?\\ ?\) return ?p ?u ?b ?l ?i ?c ? ?g ?e ?t ?_ ?\\ ?1 ?\( ?\) ?\S- ?\{ ? ?$ ?t ?h ?i ?s ?- ?\M-b ?r ?e ?t ?u ?r ?n ? ?\C-e ?. backspace ?> ?$ ?\\ ?1 ?\; ? ?\} return ?! ?\C-s ?\} ?\C-m ?\C- ?\C-r ?c ?l ?a ?s ?s ?\C-m tab])
// class User(name,login,password)
===
class User{
private $name;
private $login;
private $password;
function User($name,$login,$password) {
$this->$name = $name;
$this->$login = $login;
$this->$password = $password;
}
public get_name() { return $this->$name; }
public get_login() { return $this->$login; }
public get_password() { return $this->$password; }
}
/tmp/kbd-macro.el (END)
I should write an keybindings expander and a literal reducer to make this bearable </lisp>
Inscription à :
Articles (Atom)