What is a trampoline function?

There is also the LISP sense of ‘trampoline’ as described on Wikipedia: Used in some LISP implementations, a trampoline is a loop that iteratively invokes thunk-returning functions. A single trampoline is sufficient to express all control transfers of a program; a program so expressed is trampolined or in “trampolined style”; converting a program to trampolined … Read more

Why are dates calculated from January 1st, 1970? [duplicate]

using date(January 1st, 1970) as default standard The Question makes two false assumptions: All time-tracking in computing is done as a count-since-1970. Such tracking is standard. Two Dozen Epochs Time in computing is not always tracked from the beginning of 1970 UTC. While that epoch reference is popular, various computing environments over the decades have … Read more

Truly understanding the difference between procedural and functional

Functional Programming Functional programming refers to the ability to treat functions as values. Let’s consider an analogy with “regular” values. We can take two integer values and combine them using the + operator to obtain a new integer. Or we can multiply an integer by a floating point number to get a floating point number. … Read more

What’s the difference between compiled and interpreted language?

What’s the difference between compiled and interpreted language? The difference is not in the language; it is in the implementation. Having got that out of my system, here’s an answer: In a compiled implementation, the original program is translated into native machine instructions, which are executed directly by the hardware. In an interpreted implementation, the … Read more

What are some compelling use cases for dependent method types?

More or less any use of member (ie. nested) types can give rise to a need for dependent method types. In particular, I maintain that without dependent method types the classic cake pattern is closer to being an anti-pattern. So what’s the problem? Nested types in Scala are dependent on their enclosing instance. Consequently, in … Read more

Detecting programming language from a snippet [closed]

I think that the method used in spam filters would work very well. You split the snippet into words. Then you compare the occurences of these words with known snippets, and compute the probability that this snippet is written in language X for every language you’re interested in. http://en.wikipedia.org/wiki/Bayesian_spam_filtering If you have the basic mechanism … Read more

Should I use multiplication or division?

Python: time python -c ‘for i in xrange(int(1e8)): t=12341234234.234 / 2.0’ real 0m26.676s user 0m25.154s sys 0m0.076s time python -c ‘for i in xrange(int(1e8)): t=12341234234.234 * 0.5’ real 0m17.932s user 0m16.481s sys 0m0.048s multiplication is 33% faster Lua: time lua -e ‘for i=1,1e8 do t=12341234234.234 / 2.0 end’ real 0m7.956s user 0m7.332s sys 0m0.032s time … Read more

What languages can be compiled to WebAssembly (Wasm)? [closed]

WebAssembly support is ever evolving. Right now it is supported by the following languages: C / C++ – has very good (production ready) support via EmScripten, or other minimal LLVM-based toolchains Rust – WebAssembly is an officially supported target, with a highly active community around it. Go – has now supports WebAssembly as an official, … Read more

What is the difference between mutex and critical section?

For Windows, critical sections are lighter-weight than mutexes. Mutexes can be shared between processes, but always result in a system call to the kernel which has some overhead. Critical sections can only be used within one process, but have the advantage that they only switch to kernel mode in the case of contention – Uncontended … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)