Questions tagged [implementation]

Deals with various issues of implementation.

Deals with various issues of implementation of functions, features, languages, etc.

2196 questions
11
votes
3 answers

How library functions in Haskell are implemented

I'm just starting to learn Haskell and would find it very helpful to see how Haskell functions are implemented. I've been able to find the Standard Prelude on different question, but I'm now interested in Data.List. Is there any way to find the…
11
votes
6 answers

Why is size_t better?

The title is actually a bit misleading, but I wanted to keep it short. I've read about why I should use size_t and I often found statements like this: size_t is guaranteed to be able to express the maximum size of any object, including any…
Paul Manta
  • 30,618
  • 31
  • 128
  • 208
11
votes
1 answer

Implementation of closures in Lua?

I have a question about how closures are implemented. Say this is in a file named test.lua: local a = 'asdf' local function b() return a end a = 10 return b And another file does a = require 'test' a() it will print 10 If a is a pointer on…
Seth Carnegie
  • 73,875
  • 22
  • 181
  • 249
11
votes
3 answers

counting boolean parenthesizations implementation

Given a boolean expression containing the symbols {true, false, and, or, xor}, count the number of ways to parenthesize the expression such that it evaluates to true. For example, there is only 1 way to parenthesize 'true and false xor true' such…
SecureFish
  • 2,391
  • 7
  • 32
  • 43
11
votes
1 answer

Speed of indexing Perl arrays by offset

According to this question and this answer, lists are implemented as arrays: Perl implements lists with an array and first/last element offsets. The array is allocated larger than needed with the offsets originally pointing in the middle of…
Seth Carnegie
  • 73,875
  • 22
  • 181
  • 249
11
votes
2 answers

Does a clean and extendable LSTM implementation exists in PyTorch?

I would like to create an LSTM class by myself, however, I don't want to rewrite the classic LSTM functions from scratch again. Digging in the code of PyTorch, I only find a dirty implementation involving at least 3-4 classes with inheritance:…
Guillaume Chevalier
  • 9,613
  • 8
  • 51
  • 79
11
votes
4 answers

python parent class 'wrapping' child-class methods

I have the following situation in my python code: class Parent(object): def run(self): print "preparing for run" self.runImpl() print "run done" class Child(Parent): def runImpl(self): print "child…
Yonatan
  • 1,187
  • 15
  • 33
11
votes
3 answers

PHP Interface and Abstract Class best practice for inheritance?

When defining the structure and inheriting Interface and/or Abstract Class, which one is the best practice? And why? Here are 2 examples: Here is the example for [Interface] -> [Abstract Class] -> [Class] Interface DataInterface { public…
user702300
  • 1,211
  • 5
  • 22
  • 32
11
votes
1 answer

Can an activity have two implements?

Can I implement OnClickListener and SurfaceHolder like this : public class MainActivity extends Activity implements SurfaceHolder.Callback,OnClickListener
Ahmad Jouni
  • 185
  • 1
  • 1
  • 4
11
votes
11 answers

Should I still code to the interface even if I am ONLY EVER going to have ONE implementation?

I think the title speaks for itself guys - why should I write an interface and then implement a concrete class if there is only ever going to be 1 concrete implementation of that interface?
non sequitor
  • 18,296
  • 9
  • 45
  • 64
11
votes
3 answers

Mutex implementation and signaling

When a mutex is already locked by T1, and T2 tries to lock it, what is the process for T2? I think it goes something like this: -T2 tries to lock, fails, maybe spinlocks a bit, then calls yield... -T2 is scheduled for execution a couple of times,…
NoSenseEtAl
  • 28,205
  • 28
  • 128
  • 277
11
votes
4 answers

Implementation of Friend concept in Java

How does one implement the friend concept in Java (like C++)?
FirstName LastName
  • 1,891
  • 5
  • 23
  • 37
11
votes
3 answers

Java: Implementing a Unsigned 128bit Integer

first off I should ask: Does anyone knows of a current implementation 128b UINT for Java? I need something to hold natural cardinal values. ie: A huge counter. I know of BigIntegers, which are slow and immutable. A 128b UINT makes sense ... I was…
Ande Turner
  • 7,096
  • 19
  • 80
  • 107
10
votes
2 answers

How to print an object's implemented class

During debugging without the aid of an IDE(Integrated Development Environment), I would like to determine an object's class. The catch is that the object is defined as an interface and I would like to determine the Object's class that is…
Vivek
  • 461
  • 1
  • 3
  • 13
10
votes
4 answers

How is Perlin-noise in flash implemented?

Over at gamedev.SE we discovered that the flash implementation of Perlin-noise seems to deviate quite a bit from other implementations. I didn't find any implementation details online, but I wondered if anybody can tell which algorithm is being used…
bummzack
  • 5,805
  • 1
  • 26
  • 45