View foo.el
1 2 3 4 5 6 7 8 9 10
(defun my-erc-quit (s)
(or s (concat "brb " (aref my-erc-quit-reasons (random (length my-erc-quit-reasons))))))
 
(setq erc-part-reason 'my-erc-quit)
(setq erc-quit-reason 'my-erc-quit)
 
(setq my-erc-quit-reasons
["proving riemann hypothesis"
"cleaning the augean stables"
"inventing something better than sliced bread"
View clear.scm
1 2 3 4 5 6 7 8 9
(use-modules (system repl command))
 
(define-meta-command ((clear module) repl)
"clear
Removes all current bindings."
(let ((mod (current-module)))
(module-for-each (lambda (k v)
(module-remove! mod k))
mod)))
View galex.el
1 2 3 4 5 6 7 8 9 10
;; not tested
 
(defun galex-assoc-string (regexp alist)
(catch 'done
(while alist
(cond ((consp (car alist))
(if (string-match regexp (caar alist))
(throw 'done (car alist))))
((stringp (car alist))
(if (string-match regexp (car alist))
View fib.el
1 2 3 4 5 6 7 8
(setq fib (lambda ()
(let* ((b (cdddr fib))
(s (apply '+ b)))
(setcdr (cddr fib) (list (cadr b) s))
(throw 'result s))
0 1))
(defun fib () (catch 'result (funcall fib)))
(fib)
View zero_suffix.py
1 2 3 4 5 6 7 8 9 10
def rindex_func(func, l):
for (i,obj) in reversed(list(enumerate(l))): ## Boo! list()
if func(obj):
return i
return None
 
def only_as_suffix(obj, l):
try:
i = l.index(obj)
except ValueError:
View palindrome.scm
1 2 3 4 5 6 7 8 9
(define (make-palindrome l)
(define (loop l suffix)
(if (null? (cdr l))
(cons (car l) suffix)
(cons (car l)
(loop (cdr l) (cons (car l) suffix)))))
(if (null? l)
#f ; arbitrary choice
(loop l '())))
View last2.scm
1 2 3 4 5 6 7 8 9 10
;;; jffmcc's solution
(define (Last2Equal? L)
(cond ((> (length L) 2) (Last2Equal? (cdr L)))
((= (length L) 2) (equal? (car L) (cadr L)))
(else #f)))
 
;;; Alternative Solutions
 
;;; Compute length only once
(define (drop n l)
View fraktur
1 2 3 4 5 6 7 8 9
#!/usr/local/bin/guile -s
!#
;; Hey emacs this is -*- scheme -*- code
(eval-when (compile load eval)
(set! %load-extensions '(".guile.sls" ".sls" ".ss" ".scm" "")))
 
(import (ijputils strings)
(only (rnrs) let*-values)
(ice-9 match))
View examples.el
1 2 3 4 5 6 7 8 9 10
(assert
(equal
'(1 2)
(mbe-destructuring-let
(a b)
(list 1 2)
(list a b))))
 
(assert
(equal
View macro-rules.el
1 2 3 4 5 6 7 8 9 10
;;; macro-rules.el --- Macros by Example
 
;; Copyright (C) 2014 Ian Price
 
;; Author: Ian Price <ianprice90@googlemail.com>
;; Keywords: tools
 
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
Something went wrong with that request. Please try again.