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
| # 30 minutes Lisp in Ruby | |
| # Hong Minhee <http://dahlia.kr/> | |
| # | |
| # This Lisp implementation does not provide a s-expression reader. | |
| # Instead, it uses Ruby syntax like following code: | |
| # | |
| # [:def, :factorial, | |
| # [:lambda, [:n], | |
| # [:if, [:"=", :n, 1], | |
| # 1, |
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
| /* | |
| 使用前调用init静态建树,然后模仿query进行类Binary Search Tree式的访问即可 | |
| Obj是点的类型,如果追求效率或者在点上除了坐标还有其它信息,可以自己写一个Obj类,然后重载[]运算符 | |
| */ | |
| namespace KDTree { | |
| int K; | |
| typedef vector <int> Obj; | |
| template <int T> bool cmpT(const Obj &a, const Obj &b) { return a[T] < b[T]; } | |
| bool (*cmp[])(const Obj &, const Obj &) = {cmpT <0>, cmpT <1>, cmpT <2>}; //填到所需要的最大维度数目为止,这里表示的是最大3维 | |
| struct Filter { |
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
| #!/usr/bin/python3 | |
| # By Steve Hanov, 2011. Released to the public domain. | |
| # Please see http://stevehanov.ca/blog/index.php?id=115 for the accompanying article. | |
| # | |
| # Based on Daciuk, Jan, et al. "Incremental construction of minimal acyclic finite-state automata." | |
| # Computational linguistics 26.1 (2000): 3-16. | |
| # | |
| # Updated 2014 to use DAWG as a mapping; see | |
| # Kowaltowski, T.; CL. Lucchesi (1993), "Applications of finite automata representing large vocabularies", | |
| # Software-Practice and Experience 1993 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| {-# LANGUAGE TypeSynonymInstances #-} | |
| data Dual d = D Float d deriving Show | |
| type Float' = Float | |
| diff :: (Dual Float' -> Dual Float') -> Float -> Float' | |
| diff f x = y' | |
| where D y y' = f (D x 1) | |
| class VectorSpace v where | |
| zero :: v |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.