This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; singular variable setter | |
(defmacro defproposition [symbol] | |
; this is simplified here for demonstration | |
`(setv ~symbol None)) | |
; multiple variable setter | |
(defmacro defpropositions [&rest args] | |
(if (len args) | |
`(do | |
(defproposition ~(get args 0)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; index-find function needs to be available at compile time for the lambda expression macro | |
(eval-and-compile | |
; set comma constant for separator | |
; at the moment Hy doesn't support dot on macro expressions because dot is mixed with internal HyCons functionality | |
; causing this error: https://github.com/hylang/hy/blob/e8ffd412028232cc2cc4fe4bfb10f21ce8ab2565/hy/compiler.py#L2478 | |
(setv comma '·) | |
; find index of the element from the list. if the element is not found, return -1 | |
(defn index-find [elm lst] | |
(try (.index lst elm) (except [ValueError] -1)))) | |
; lambda expression macro |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(eval-and-compile | |
; pretty print utility | |
(defn lprint [expr] | |
(if (coll? expr) | |
(+ "(" (.join " " (list-comp (lprint x) [x expr])) ")") | |
(str expr))) | |
; church number body generator: (N 3 m n) ; -> (m (m (m n))) | |
(defn N [n x y] | |
(if (zero? n) y | |
(+ (% "(%s " x) (N (dec n) x y) ")")))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(eval-and-compile(defmacro D[&rest e]`(defn ~@e))(D €[a b](.extend a b)a)(D §[a](.reverse a)a)(D ¤[a](first a))(D ?[e](instance? F e))(D £[e](if(coll? e)(if(?(¤ e))(£(apply(¤ e)(rest e)))(if(? e)e(do(def x(list(map £ e)))(if(?(¤ x))(£ x)x))))e))(D $[a b c](if(coll? c)(if(? c)(if(=(¤ c)a)c(F[(¤ c)($ a b(second c))]))((type c)(genexpr($ a b d)[d c])))(if(= a c)b c)))(defclass V[HySymbol](D --call--[self &rest v](€[self]v)))(defclass F[HyExpression](D --call--[self a &rest b](def e(£($(¤ self)a(second self))))(if b(def e(apply e b)))e)))(defmacro L[&rest e](reduce(fn[y x]`((fn[](def ~x(V(gensym'~x)))(F[~x ~y]))))(§(list e)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#from summa import summa | |
#from predecessor import predecessor | |
def bn(n): | |
return list(reversed(list(map(lambda x: 1 if x == "1" else 0, "{0:b}".format(n))))) | |
def is_zero(n): | |
return not n[1:] and not n[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_zero(n): | |
return not n[1:] and not n[0] | |
def carry_over(first_num, second_num): | |
stack = [] | |
for i, j in enumerate(second_num): | |
if j: | |
# basicly same as map(sum, zip(stack, a)) but with zero appends | |
stack = [(stack.pop(0) + n) if stack else n \ | |
for n in ([0] * i + first_num)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 luku | |
Alkulause 1 – 3. Johannes lausuu tervehdyksen seitsemälle Vähä Aasian seurakunnalle 4 – 8 sekä kertoo Jeesuksen ilmestyneen hänelle Patmos – saarella ja käskeneen hänen kirjoittaa, mitä hän näyssään oli saanut nähdä 9 – 20. | |
1 Jeesuksen Kristuksen ilmestys, jonka Jumala antoi hänelle, näyttääkseen palvelijoillensa, mitä pian tapahtuman pitää; ja sen hän lähettämänsä enkelin kautta antoi tiedoksi palvelijalleen Johannekselle, | |
2 joka tässä todistaa Jumalan sanan ja Jeesuksen Kristuksen todistuksen, kaiken sen, minkä hän on nähnyt. | |
3 Autuas se, joka lukee, ja autuaat ne, jotka kuulevat tämän profetian sanat ja ottavat vaarin siitä, mitä siihen kirjoitettu on; sillä aika on lähellä! | |
4 Johannes seitsemälle Aasian seurakunnalle: Armo teille ja rauha häneltä, joka on ja joka oli ja joka tuleva on, ja niiltä seitsemältä hengeltä, jotka ovat hänen valtaistuimensa edessä, | |
5 ja Jeesukselta Kristukselta, uskolliselta todistajalta, häneltä, joka on kuolleitten esikoinen ja maan kuningasten hallitsija! Hänelle, jok |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# copyright (c) https://raw.githubusercontent.com/epilanthanomai/hexameter/master/betacode.py | |
import unicodedata | |
map_b2u = { | |
'A': '\u03b1', # alpha | |
'B': '\u03b2', # beta | |
'C': '\u03be', # xi | |
'D': '\u03b4', # delta | |
'E': '\u03b5', # epsilon | |
'F': '\u03c6', # phi |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer