Questions tagged [representation]
291 questions
15
votes
1 answer
Why is the undefined function levity-polymorphic when using it with unboxed types?
I just got finished reading the paper Levity Polymorphism.
I had a question about why undefined can be levity-polymorphic when used as an unboxed type.
First, let's start with some definitions of boxity from the paper:
boxed:
A boxed value is…

illabout
- 3,517
- 1
- 18
- 39
14
votes
4 answers
C represent int in base 2
Possible Duplicate:
Can I use a binary literal in C or C++?
I am learning C and i recently found out that we can represent integers in different ways, like that:
(Assuming i has "human-readable" value of 512.) Here are the…
user562854
13
votes
5 answers
Generating a linear, timeline-based, representation from items that consume time and items which do not, but still need space to be drawn on
This is a question about generating an image, or any other representations, for a set of parallel data. Is is not about drawing or GUI programming but calculating positions.
First I'll explain a bit where I stand right now and the second image and…

nilshi
- 504
- 1
- 6
- 16
13
votes
5 answers
What is the binary representation of a boolean value in c#
I know that a boolean value is 1 byte (8 bits long)
But I would like to know is what is its binary representation.
e.g.
decimal => binary
4 => 100 (0000 0100)
8 => 1000 (0000 1000)
bool value => ???

emm
- 131
- 1
- 1
- 3
13
votes
4 answers
Nicely representing a floating-point number in python
I want to represent a floating-point number as a string rounded to some number of significant digits, and never using the exponential format. Essentially, I want to display any floating-point number and make sure it “looks nice”.
There are several…

dln385
- 11,630
- 12
- 48
- 58
10
votes
3 answers
Python proper use of __str__ and __repr__
My current project requires extensive use of bit fields. I found a simple, functional recipe for bit a field class but it was lacking a few features I needed, so I decided to extend it. I've just got to implementing __str__ and __repr__ and I want…
user130076
9
votes
1 answer
REST to my wife - can somebody explain this phrase from it?
I've been reading How I Explained REST to My Wife. Great article but I don't get the ending :D.
Wife: So this is what you and all the computer people are working on now? Deciding what the data should look like?
Ryan: Sadly, no. Instead, the large…

user2011
- 311
- 3
- 5
9
votes
0 answers
Representing polymorphism with unification-fd
I'd like to use the unification-fd package to implement a simple typechecker for a Hindley-Milner type system. This requires the representation of polymorphic ("forall") types.
What's the best way of representing these types? The variables provided…

Cactus
- 27,075
- 9
- 69
- 149
9
votes
4 answers
What does Canonical Representation mean and its potential vulnerability to websites
I searched on google for a meaning of canonical representation and turned up documents that are entirely too cryptic. Can anyone provide a quick explanation of canonical representation and also what are some typical vulnerabilities in websites to…
user130532
8
votes
4 answers
Does R have an equivalent of Python's "repr" (or Lisp's "prin1-to-string")?
I occasionally find that it would be useful to get the printed representation of an R object as a character string, like Python's repr function or Lisp's prin1-to-string. Does such a function exist in R? I don't need it to work on complicated or…

Ryan C. Thompson
- 40,856
- 28
- 97
- 159
8
votes
1 answer
representation format in web2py database
db.define_table('person', Field('name'), format='%(name)s')
What does this format do here?

Jensen
- 1,653
- 4
- 26
- 42
8
votes
8 answers
Display the binary representation of a number in C?
Possible Duplicate:
Is there a printf converter to print in binary format?
Still learning C and I was wondering:
Given a number, is it possible to do something like the following?
char a = 5;
printf("binary representation of a = %b",a);
>…

Paul Wicks
- 62,960
- 55
- 119
- 146
8
votes
1 answer
UnicodeDecodeError: 'ascii' codec can't decode
I'm reading a file that contains Romanian words in Python with file.readline().
I've got problem with many characters because of encoding.
Example :
>>> a = "aberație" #type 'str'
>>> a -> 'abera\xc8\x9bie'
>>> print sys.stdin.encoding
UTF-8
I've…

lilawood
- 2,263
- 5
- 22
- 27
8
votes
5 answers
REST API, why no HTML instead of JSON?
This is probably a stupid idea, but I would like to know why.
I'm reading about REST API's, and principles such as HATEOAS. All the time, I'm wondering why people don't just use HTML for the representation of their resources.
Sure, I can think of…

Willem-Aart
- 2,200
- 2
- 19
- 27
8
votes
1 answer
Haskell types with coercible representations identical to their C counterparts?
How can I determine if a Haskell type has an equivalent Coercible instance on a given platform?
I've just been told about Coercible in GHC 7.8, which seems great. In that context, I guess an equally good question to solve my specific problem is: Is…

gspr
- 11,144
- 3
- 41
- 74