#How to make Hierarchical GUI Components and Applications (1/3)
Original Posts
http://jinjor-labo.hatenablog.com/entry/2013/12/08/221003
#How to make Hierarchical GUI Components and Applications (1/3)
Original Posts
http://jinjor-labo.hatenablog.com/entry/2013/12/08/221003
#How to make Hierarchical GUI Components and Applications (2/3)
Original Posts
http://jinjor-labo.hatenablog.com/entry/2013/12/08/221003
#How to make Hierarchical GUI Components and Applications (3/3)
Original Posts
http://jinjor-labo.hatenablog.com/entry/2013/12/08/221003
| 5578864439 | |
| ENV: Scala | |
| POINT: 目的のパターンに至るまでの組み合わせの数を再帰的に求める。一度求めた値は再利用して計算量を抑える。 | |
| ■POINTの補足 | |
| 種類毎の宝石数をベクトルa、その時の全パターン数をf(a)であらわすと、 | |
| aが1次元の時、f(a)はaの絶対値となる。また、aから各種類の宝石のうちひとつを選んで取り去った | |
| ベクトルの集合Bに対して、f(a)=Σ(f(b)+1) | b<-B | |
| 例えば、宝石"aaabcc"が与えられた時、全ての組み合わせは | |
| =f([3,1,2]) |
| import Data.List;import Data.List.Split;import Data.Ord;l=length;f(_,b,_)=b;g(_,_,m)=m;d=comparing;y(p,e,r)b=(p,r,m$dropWhile((>=)e.f)b):b;m[]=[];m t=maximumBy(d l)[a:b|(a,_,b)<-t];a s=(show.l$s):s>>=id;main=do c<-readFile"tickets.txt";putStr.a.sort$m$foldr y[]$sortBy(d g)[(' ':l!!0,w 3,w 1)|s<-lines c,let l=splitOneOf" -/"s;p=read.(!!)l;w i=31*(p i)+(p$i+1)] |
| import Data.List.Split;import Data.List;import Data.Ord;b(_,_,a)=a;p q[]=[];p q((n,w,a):t)|q<w=n:(p a t)|True=p q t;y a=(show.length)a++(a>>=id);main=do e<-readFile"tickets.txt";putStr.y.sort$p 0$sortBy(comparing b)[(' ':l!!0,w 1,w 3)|s<-lines e,let l=splitOneOf" -/"s;p=read.(!!)l;w i=31*(p i)+(p$i+1)] |
| <template id="target"> | |
| <div> | |
| <span foo="{{ bar }}">{{foo}}</span> | |
| <template repeat="{{ bar , i in list }}"> | |
| <div><span>{{i}}: </span><span>{{foo}}</span><span>{{bar}}</span></div> | |
| </template> | |
| <div><a>{{bar}} dayo{{foo}}</a></div> | |
| </div> |
| var childProcess = require('child_process'); | |
| var nedb = require('nedb'); | |
| db = {}; | |
| db.commits = new nedb('db/commits.db'); | |
| db.commits.loadDatabase(); | |
| var update = function(lines, db, cb, latestId) { | |
| var head = lines.shift(); | |
| var splitted = head.split(',,'); |
| todos = [{name: 'foo'}, {name: 'bar'}]; | |
| main = <ul>{{map(todos, todo => <li>{{ todo.name }}</li>)}}</ul>; |
| var Flyweight = function() { | |
| this._all = null; | |
| this._indexed = null; | |
| }; | |
| Flyweight.prototype._fetch = function() { | |
| console.log('fetch'); | |
| return Promise.resolve([{ | |
| _id: 1 | |
| }]); |