Skip to content

Instantly share code, notes, and snippets.

@westerp
westerp / reverse-filter-atoms.cl
Created May 11, 2018 17:42
Suggested solution to: Create a function which gets a list as parameter and creates a list in which only the original list's atoms exist in reversed order. example : list: (a (b c) d e)) output: (e d a)
(defun reverse-filter-atoms (l)
(funcall
((lambda (f)
((lambda (g) (funcall g g))
(lambda (g)
(funcall f (lambda (&rest args) (apply (funcall g g) args))))))
(lambda (fa)
(lambda (l k)
(if (endp l)
(funcall k l)
@westerp
westerp / flatten.cl
Created September 16, 2014 14:55
Tail recursive flatten in Common Lisp
(defun flatten (lst &optional backtrack acc)
(cond ((consp lst) (flatten (car lst) (cons (cdr lst) backtrack) acc))
(lst (flatten (car backtrack) (cdr backtrack) (cons lst acc)))
(backtrack (flatten (car backtrack) (cdr backtrack) acc))
(t (nreverse acc))))
@westerp
westerp / LethalLokeV2.1
Last active August 29, 2015 14:06
LethalLokev2
>(-)*17>->+>->+>->[(<)*5+[(>)*7([..(+)*120(+.)*27>([-[-[-[-[-[-[-[-[(+)*8+[+[+[+
[+[+[+[+[(+)*70..(+)*42(+.)*27>[-[-[-[-[-[-[-[-[(+)*8+[+[+[+[+[+[+[+[(+)*70..(+)*42(
+.)*27>[-[-[-[-[-[-[-[-[(+)*8+[+[+[+[+[+[+[+[(+)*70..(+)*42(+.)*27>[-[-[-[-[-[-[
-[-[(+)*8+[+[+[+[+[+[+[+[(+)*70..(+)*42(+.)*27>[-[-[-[-[-[-[-[-[(+)*8+[+[+[+[+[+
[+[+[(+)*70..(+)*42(+.)*27>[-[-[-[-[-[-[-[-[(+)*8+[+[+[+[+[+[+[+[(+)*70..(+)*42(
+.)*27>[-[-[-[-[-[-[-[-[(+)*8+[+[+[+[+[+[+[+[(+)*70..(+)*42(+.)*27>[-[-[-[-[-[-[
-[-[(+)*8+[+[+[+[+[+[+[+[(+)*70..(+)*42(+.)*27>[-[-[-[-[-[-[-[-[(+)*8+[+[+[+[+[+
[+[+[(+)*70..(+)*42(+.)*27>[-[-[-[-[-[-[-[-[(+)*8+[+[+[+[+[+[+[+[(+)*70..(+)*42(
+.)*27>[-[-[-[-[-[-[-[-[(+)*8+[+[+[+[+[+[+[+[(+)*70..(+)*42(+.)*27>[-[-[-[-[-[-[
-[-[(+)*8+[+[+[+[+[+[+[+[(+)*70..(+)*42(+.)*27>[-[-[-[-[-[-[-[-[(+)*8+[+[+[+[+[+
@westerp
westerp / billy-quine.bf
Created January 10, 2014 22:33
A 153,191 byte quine including the Norwegian story of the Three billy goats Gruff
[
Once upon a time there were three billy goats, names Gruff. They were on their
way to eat on the hillside, but they had to cross a bridge. Under the bridge
lived a troll, with eyes as big as saucers, and a nose as long as a poker.
The first goat over the bridge was the youngest Billy Goat Gruff. "Trip, trap,
trip, trap!" he walked across the bridge.
"Who's that tripping over my bridge?" roared the troll.
@westerp
westerp / addition.zzt
Created April 10, 2013 23:59
Adding with numbers in Zozotez. Playing around after looking at https://gist.github.com/2584539.git
;; usage: ./zozotez addition.zzt or
;; jitbf zozotez.bf < addition.zzt or
;; one anonymous function to wrap all out stuff in it
((\()
;; symbols 0 to 9 to represent digits. eg. 100 is '(1 0 0)
(:'d2clis '(0 1 2 3 4 5 6 7 8 9))
;; auxuillary function for d2c
(:'d2caux