- 1
- 2
- 3
Официальный тред для каклосрача #2
http://govnokod.ru/15804 - не открывается
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
Официальный тред для каклосрача #2
http://govnokod.ru/15804 - не открывается
срать тут ↓
+1
There was once a programmer who was attached to the court of the
warlord Wu. The warlord asked the programmer: "Which is easier to design:
an accounting package or an operating system?"
"An operating system," replied the programmer.
The warlord uttered an exclamation of disbelief. "Surely an
accounting package is trivial next to the complexity of an operating
system," he said.
"Not so," said the programmer, "when designing an accounting package,
the programmer operates as a mediator between people having different ideas:
how it must operate, how its reports must appear, and how it must conform to
tax laws. By contrast, an operating system is not limited by outward
appearances. When designing an operating system, the programmer seeks the
simplest harmony between machine and ideas. This is why an operating system
is easier to design."
The warlord of Wu nodded and smiled. "That is all good and well,"
he said, "but which is easier to debug?"
The programmer made no reply.
-- Geoffrey James, "The Tao of Programming"
друзья, а как думаете вы?
что проще делать, а что дебажить?
−102
Тест.
0
IT Оффтоп #23
#1: https://govnokod.ru/18142 https://govnokod.xyz/_18142
#2: https://govnokod.ru/18378 https://govnokod.xyz/_18378
#3: https://govnokod.ru/19667 https://govnokod.xyz/_19667
#4: https://govnokod.ru/21160 https://govnokod.xyz/_21160
#5: https://govnokod.ru/21772 https://govnokod.xyz/_21772
#6: https://govnokod.ru/24063 (потёр пидор сракер) https://govnokod.xyz/_24063
#7: https://govnokod.ru/24538 https://govnokod.xyz/_24538
#8: https://govnokod.ru/24815 (потёр пидор сракер) https://govnokod.xyz/_24815
#9: https://govnokod.ru/24867 https://govnokod.xyz/_24867
#10: https://govnokod.ru/25328 https://govnokod.xyz/_25328
#11: https://govnokod.xyz/_25436 https://govnokod.ru/25436 (потёр пидор сракер)
#12: https://govnokod.xyz/_25471
#13: https://govnokod.xyz/_25590 (потёр пидор сракер)
#14: https://govnokod.xyz/_25684
#15: https://govnokod.xyz/_25694
#16: https://govnokod.xyz/_25725
#17: https://govnokod.xyz/_25731
#18: https://govnokod.xyz/_25762
#19: https://govnokod.xyz/_25767
#20: https://govnokod.xyz/_25776
#21: https://govnokod.xyz/_25798
#22: https://govnokod.xyz/_25811
−103
Я гниль.
+1
https://www.youtube.com/watch?v=WT-oowiPUVQ
Черная дыра
0
https://i.redd.it/67mnaevvhlm31.jpg
Эх... А ведь так всё и было....
0
(set-logic LIA)
;(set-option :produce-proofs true)
(define-fun-rec add_via_add1 ((a Int) (b Int)) Int
(ite (= b 0) a ; if (b == 0) return a
(ite (< b 0) (- (add_via_add1 (- a) (- b))) ; if (b < 0) return add_via_add(-a,-b)
(+ (add_via_add1 a (- b 1)) 1) ; return add_via_add(a, b-1) + 1;
)
)
)
(assert
(not (forall ((a Int) (b Int))
(= (add_via_add1 a b) (+ a b))
))
)
(check-sat)
(get-model)
(exit)
Хуйня, которую SMT солверы Z3 и CVC4 доказать не могут. Надо переходить на Coq, Metamath, LEAN, Mizar или еще какую-то такую хуйню
0
███████
██ ██
██ ██
██ ██ █████ ████ ██ ██ ██████ █████ ██████ ████ ██ ██ █████ ██ ██ ██ ██ ██ █ ██ ██ ██ ████
██ ██ ██ ██ ██ ██ ██ ██ █ ██ █ ██ ██ █ ██ █ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ███ ██ ██ ██ ██ █████ ██ ██ ██ ██ ██ ██ ██ ██ █ █ █ ██ ██ █████
██ ██ ██ ██ ██ ██ ██ █ ██ ██ ██ ██ ██ ██ ██ ███████ ███████ ███████ ██ ██ █████ ███████ ██ ██
██ ██ ██ ██ ██ ██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █ █ █ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██ █ ██ ██ ██ ██ ██
██ ██ █████ ███ ██ ██ ██ ████ █████ ████ ███ ██ ██ ██ █████ ██ ██ ██ ██ █ ██ ██ ██ ███ ██
██
██ ██
█████
Политота не нужна
0
static F1(jtdrr){PROLOG(0055);A df,dg,hs,*x,z;B b,ex,xop;C c,id;I fl,*hv,m;V*v;
RZ(w);
// If the input is a name, it must be from ".@'name' which turned into ".@(name+noun) - or in debug, but that's discarded
if(AT(w)&NAME){RZ(w=sfn(0,w));}
// If noun, return the value of the noun.
if(AT(w)&NOUN)R w; // no quotes needed
// Non-nouns and NMDOT names carry on
v=FAV(w); id=v->id; fl=v->flag;
I fndx=(id==CBDOT)&&!v->fgh[0]; A fs=v->fgh[fndx]; A gs=v->fgh[fndx^1]; // In verb for m b., if f is empty look to g for the left arg. It would be nice to be more general
hs=v->fgh[2]; if(id==CBOX)gs=0; // ignore gs field in BOX, there to simulate BOXATOP
if(fl&VXOPCALL)R drr(hs);
xop=1&&VXOP&fl; ex=id==CCOLON&&hs&&!xop;
b=id==CHOOK||id==CADVF; c=id==CFORK;
m=!!fs+(gs||ex);
if(!m)R spella(w);
if(evoke(w))R drr(sfne(w)); // turn nameref into string or verb; then take rep
if(fs)RZ(df=fl&VGERL?every(fxeach(fs),0L,jtdrr):drr(fs));
if(gs)RZ(dg=fl&VGERR?every(fxeach(gs),0L,jtdrr):drr(gs));
if(ex)RZ(dg=unparsem(num[0],w));
m+=!b&&!xop||hs&&xop;
GATV0(z,BOX,m,1); x=AAV(z);
RZ(x[0]=rifvs(df));
RZ(x[1]=rifvs(b||c||xop?dg:fl&VDDOP?(hv=AV(hs),link(sc(hv[0]),link(spellout(id),sc(hv[1])))):spellout(id)));
if(2<m)RZ(x[2]=rifvs(c||xop?drr(hs):dg));
EPILOG(z);
}
F1(jtdrep){A z=drr(w); R z&&AT(z)&BOX?z:ravel(box(z));}
F1(jtaro){A fs,gs,hs,s,*u,*x,y,z;B ex,xop;C id;I*hv,m;V*v;
RZ(w);
if(FUNC&AT(w)){
v=FAV(w); id=v->id;
I fndx=(id==CBDOT)&&!v->fgh[0]; fs=v->fgh[fndx]; gs=v->fgh[fndx^1]; // In verb for m b., if f is empty look to g for the left arg. It would be nice to be more general
hs=v->fgh[2]; if(id==CBOX)gs=0; // ignore gs field in BOX, there to simulate BOXATOP
if(VXOPCALL&v->flag)R aro(hs);
xop=1&&VXOP&v->flag;
ex=hs&&id==CCOLON&&!xop;
m=id==CFORK?3:!!fs+(ex||xop&&hs||!xop&&gs);
if(!m)R spella(w);
if(evoke(w)){RZ(w=sfne(w)); if(FUNC&AT(w))w=aro(w); R w;} // keep nameref as a string, UNLESS it is NMDOT, in which case use the (f.'d) verb value
}
GAT0(z,BOX,2,1); x=AAV(z);
if(NOUN&AT(w)){RZ(x[0]=rifvs(ravel(scc(CNOUN)))); if(AT(w)&NAME)RZ(w=sfn(0,w)); x[1]=INCORPNA(w); RETF(z);} // if name, must be ".@'name', format name as string
GATV0(y,BOX,m,1); u=AAV(y);
if(0<m)RZ(u[0]=rifvs(aro(fs)));
if(1<m)RZ(u[1]=rifvs(aro(ex?unparsem(num[0],w):xop?hs:gs)));
if(2<m)RZ(u[2]=rifvs(aro(hs)));
s=xop?aro(gs):VDDOP&v->flag?(hv=AV(hs),aro(foreign(sc(hv[0]),sc(hv[1])))):spellout(id);
RZ(x[0]=rifvs(s)); x[1]=INCORPNA(y);
R z;
}
F1(jtarep){R box(aro(w));}
// Create A for a string - name~, a primitive, or the boxed string
static DF1(jtfxchar){A y;C c,d,id,*s;I m,n;
n=AN(w);
ASSERT(1>=AR(w),EVRANK); // string must be an atom or list
ASSERT(n,EVLENGTH);
s=CAV(w); c=*(s+n-1);
DO(n, d=s[i]; ASSERT((C)(d-32)<(C)(127-32),EVSPELL);); // must be all ASCII
if(CA==ctype[(UC)*s]&&c!=CESC1&&c!=CESC2)R swap(w); // If name and not control word, treat as name~, create nameref
ASSERT(id=spellin(n,s),EVSPELL); // not name, must be control word or primitive. Also classify string
if(id!=CFCONS)y=ds(id); else{m=s[n-2]-'0'; y=FCONS(CSIGN!=*s?scib(m):2==n?ainf:scib(-m));} // define 0:, if it's that, using boolean for 0/1
ASSERT(y&&RHS&AT(y),EVDOMAIN); // make sure it's a noun/verb/adv/conj
if(!self || AT(y)