5,862 reputation
31849
bio website chrisaycock.com
location New York, NY
age 33
visits member for 3 years, 11 months
seen 2 days ago

May
10
comment Writing a Compiler Compiler - Insight on Use and Features
I assume you've seen ANTLR 4. That does a really nice job of simplifying things. Anyway, about the one thing I would really want is an automatically created (and filled) AST. I.e., I don't want to have to define my own since it will just mirror my grammar anyway. If I could list my productions and then know that I'll get an AST back (with line numbers for error reporting!) then I can get to work a lot faster.
Apr
1
comment Are “normal order” and “call-by-name” the same thing?
This Wikipedia article states that, in contrast to normal order, "a call-by-name strategy does not evaluate inside the body of an unapplied function". No specific citation is given though.
Mar
28
comment How does understanding computer architecture help a programmer?
@Stargazer712 Now who's advocating computer organization knowledge? ;) Linux uses a linked list of task_struct to store process info. The for_each_task macro at the bottom of sched.h shows how to iterate through this list.
Mar
28
comment How does understanding computer architecture help a programmer?
@Stargazer712 Isn't the PCB part of the kernel?
Mar
27
comment How does understanding computer architecture help a programmer?
@parsifal By overhead, I was referring to allocating on the heap vs merely placing a variable on the stack.
Mar
27
comment How does understanding computer architecture help a programmer?
@Stargazer712 The segments are code, data (namely heap), and stack. What you're referring to are tiers in the memory hierarchy.
Mar
24
comment Why many programming languages have only 2 data-structures: arrays and hashes?
@DonalFellows Good point. I notice that counter machines require "obscure coding" rather than indirect addressing. As for SKI combinators, how would one represent state changes in that?
Mar
23
comment Why many programming languages have only 2 data-structures: arrays and hashes?
Plenty of languages in the ML family have lists rather than arrays (head/tail semantics instead of random access). Also, q/kdb+ has a table container that mimics an in-memory SQL-like container. And C doesn't have built-in hashes at all. So I think your premise takes a narrow views of what's out there.
Mar
18
comment What is the maximum value of index of an ArrayList?
A computer doesn't have "endless memory"; it has, at most, an amount that can be referenced by the memory-address register. So if you have a 64-bit machine, then you can access 2^64-1 bytes of addressable memory.
Mar
14
comment A good C Variable Length Array example
@MikeBrown The question/answer you link to is asking about cache effects of accessing the stack or heap after the array has been allocated. The OP here (hyde) is asking about performance differences during the allocation. The stack is always faster to allocate on than the heap because it's just a movement of the frame pointer. std::vector can't use VLAs because the frame pointer will have been moved back once the constructor returns.
Mar
14
comment A good C Variable Length Array example
@Lundin Does C++ scale the vector by powers of ten? I just got the impression that Mike Brown was really confused by the question, given the linked list reference. (He also made an earlier assertion that implied C99 VLAs live on the heap.)
Mar
14
comment A good C Variable Length Array example
Why would a std::vector need scales of arrays? Why would it need space for 10K elements when it only needs 101? Also, the question never mentions linked lists, so I'm not sure where you got that from. Finally, VLAs in C99 are stack-allocated; they are a standard form of alloca(). Anything that requires heap storage (it lives around after the function returns) or a realloc() (the array resizes itself) would prohibit VLAs anyway.
Mar
14
comment A good C Variable Length Array example
Wow, my system shows a 30% improvement in the VLA version over std::vector.
Mar
14
comment A good C Variable Length Array example
A bit speculative (since this is a hammer looking for a nail), but perhaps alloca() would really outshine malloc() in a multithreaded environment because of the lock contention in the latter. But this is a real stretch since small arrays should just use a fixed size, and large arrays will probably need the heap anyway.
Mar
9
comment Connection between programming language and solutions
The Wikipedia article on the Sapir-Whorf Hypothesis mentions applications to programming languages.
Jun
8
comment Is version history really sacred or is it better to rebase?
@DanLyons I'm curious how you found this question and answer, given that both were posted several days ago. I don't mind that you downvoted something you disagree with, but I do find it odd that you, Pete, and Martin Geisler each cast your first-ever downvote against this in the span of 24 hours. Was this answer linked somewhere?
Jun
1
comment Why do some programmers think there is a contrast between theory and practice?
@MasonWheeler First result from Google: Quicksort in Haskell.
Jun
1
comment Where do you turn for code base improvement on a multi-project scale?
This is a really odd way to phrase your question. Are you trying to gauge the market potential for starting a business in this space?
May
31
comment Efficient Bus Loading
This sounds like the knapsack problem, which is NP-hard. In practice, your search space for a given route should be pretty small.
May
21
comment Why did the Haskell committee choose monads to represent I/O?
Clean is lazy too.