Go to advanced search

by tufty
Tue May 22, 2018 5:38 pm
Forum: General programming discussion
Topic: Making readable modifyable code.
Replies: 309
Views: 38669

Re: Making readable modifyable code.

But it still fails a "clean compile" test because count and values are unused! Nope. thinkpad:Desktop simon$ cat > foo.c <<EOF > // Not guaranteed 100% correct, but very simple and efficient. > float average(float * values, int count) { > return 4; > } > EOF thinkpad:Desktop simon$ clang -c -std=c9...
by tufty
Tue May 22, 2018 1:04 pm
Forum: General programming discussion
Topic: Making readable modifyable code.
Replies: 309
Views: 38669

Re: Making readable modifyable code.

The argument that simplicity takes priority over correctness is interesting. Sounds wrong doesn't it - since correctness is an absolute. But simplicity engenders correctness, both now and in the future. // Not guaranteed 100% correct, but very simple and efficient. float average(float * values, int...
by tufty
Tue Dec 27, 2016 6:22 pm
Forum: Off topic discussion
Topic: Bad times, Sorry for my disappearance.
Replies: 14
Views: 3320

Re: Bad times, Sorry for my disappearance.

Aww, man, that's tough. My condolences.
by tufty
Fri Dec 16, 2016 6:23 pm
Forum: General programming discussion
Topic: Making readable modifyable code.
Replies: 309
Views: 38669

Re: Making readable modifyable code.

Brendan Eich gave a very interview, which covers the development of Javascript, https://devchat.tv/js-jabber/124-jsj-the-origin-of-javascript-with-brendan-eich I started looking at languages like Logo and Smalltalk and Self and HyperTalk which was Bill Atkinson’s language for HyperCard … people say ...
by tufty
Fri Dec 16, 2016 2:48 pm
Forum: General programming discussion
Topic: Making readable modifyable code.
Replies: 309
Views: 38669

Re: Making readable modifyable code.

Here you go. A bit cleaner. ;;; Basic Collatz for a number (define (collatz x) (let loop ((x x) (count 0)) (cond ((= 1 x) count) ((even? x) (loop (/ x 2) (+ count 1))) ((odd? x) (loop (+ (* x 3) 1) (+ count 1)))))) ;;; Collatz for a number, explicitly fixnum (define (collatz-fx x) (let loop ((x x) (...
by tufty
Fri Dec 16, 2016 2:25 pm
Forum: General programming discussion
Topic: Making readable modifyable code.
Replies: 309
Views: 38669

Re: Making readable modifyable code.

Seems to me it's ultimately a losing proposition whatever you do. Any real world calculation will involve messy things like PI, root 2, e, and the like. Never mind simple messy things like 1/3. Once you get into that your calculations are by definition not "exact". That's really not even close to b...
by tufty
Fri Dec 16, 2016 1:18 pm
Forum: General programming discussion
Topic: Making readable modifyable code.
Replies: 309
Views: 38669

Re: Making readable modifyable code.

Also, 2901s? If so, make yourself an Atari vector machine!
by tufty
Fri Dec 16, 2016 1:15 pm
Forum: General programming discussion
Topic: Making readable modifyable code.
Replies: 309
Views: 38669

Re: Making readable modifyable code.

Problem is you can't map "1/3" onto reality without more work. Namely a division. Keeping things exact until it's absolutely necessary to approximate them is good practice if you care about the correctness of your result. Perhaps my bias, which comes from, amongst other things, a mixture of financi...
by tufty
Fri Dec 16, 2016 10:47 am
Forum: General programming discussion
Topic: Making readable modifyable code.
Replies: 309
Views: 38669

Re: Making readable modifyable code.

A scheme version of the collatz problem above would be great. Hint, hint... A quick implementation. This is all tested on a mac, not on a Pi, under Chez scheme 9.4 Here's the trivial collatz step. Should be pretty readable, the only thing that might throw non-schemers is the use of `let name ....` ...
by tufty
Thu Dec 15, 2016 8:27 pm
Forum: General programming discussion
Topic: Making readable modifyable code.
Replies: 309
Views: 38669

Re: Making readable modifyable code.

I'm not quite sure what you mean Well, exactness is one thing, it's hairy and nasty and not helped by floating point. I read a very good paper on hardware accelerated ULP based representations, which allow one to keep a handle on the current (potential) inexactitude in a computation. As per usual, ...
by tufty
Thu Dec 15, 2016 6:56 pm
Forum: General programming discussion
Topic: Making readable modifyable code.
Replies: 309
Views: 38669

Re: Making readable modifyable code.

Of course your example is the equivalent of: > (/ 1 3) 1/3 It shows how one can side step the problem of number representation by not actually returning a number as a result! No, 1/3 most certainly is a number. It's an exact rational number, to be precise. Scheme provides for (at least) several num...
by tufty
Thu Dec 15, 2016 6:39 am
Forum: General programming discussion
Topic: Making readable modifyable code.
Replies: 309
Views: 38669

Re: Making readable modifyable code.

Makes me think that C did the best thing by working with number types the underlying hardware can deal with easily and efficiently and forcing you to do something special with libraries or whatever if you want something else. But you'd be wrong. Petite Chez Scheme Version 9.4 Copyright 1984-2016 Ci...
by tufty
Mon Dec 12, 2016 6:40 am
Forum: General programming discussion
Topic: Making readable modifyable code.
Replies: 309
Views: 38669

Re: Making readable modifyable code.

I'm wary of benchmarks as a way to measure anything other than the speed of a system when executing that benchmark.
by tufty
Sun Dec 11, 2016 7:35 am
Forum: General programming discussion
Topic: Making readable modifyable code.
Replies: 309
Views: 38669

Re: Making readable modifyable code.

Can you give examples of such tools and how they are helpful ? We're both in agreement, I think, that C++ code can be horribly unreadable, with the method definition you're looking for a million miles away somewhere else in something a thousand classes up the hierarchy. It's not a problem restricte...
by tufty
Thu Dec 01, 2016 5:41 pm
Forum: General programming discussion
Topic: Making readable modifyable code.
Replies: 309
Views: 38669

Re: Making readable modifyable code.

I think that's spelled "eventual call stack overflow"
by tufty
Mon Nov 28, 2016 5:32 pm
Forum: General programming discussion
Topic: Making readable modifyable code.
Replies: 309
Views: 38669

Re: Making readable modifyable code.

Hmm... Not where I come from. When you are creating software where it matters if it works or not, like avionics controls, or military or satellites, it's a different world: A good while back, I used to work for the IT department of the maintenance section of "an airline". I won't say who, but let's...
by tufty
Sat Nov 26, 2016 7:59 pm
Forum: General programming discussion
Topic: Making readable modifyable code.
Replies: 309
Views: 38669

Re: Making readable modifyable code.

OK, when I said testing was a fantastic tool, I meant it in terms of "part of the toolkit every developer worth their salt has at their disposal". I thought that was fairly evident from the wording, but apparently not. The real world issues found with testing approaches are largely caused by develop...
by tufty
Sat Nov 26, 2016 7:11 pm
Forum: General programming discussion
Topic: Making readable modifyable code.
Replies: 309
Views: 38669

Re: Making readable modifyable code.

Never rely on the language to catch your errors, that is a poor way around things, always *Whooosh* That's the sound of the point going entirely over your head. I wasn't suggesting that every programming language should have, and check, a full range of semantic types. That would be absurd. What I'm...
by tufty
Sat Nov 26, 2016 10:17 am
Forum: General programming discussion
Topic: Making readable modifyable code.
Replies: 309
Views: 38669

Re: Making readable modifyable code.

This is gonna have a load of quotes taken pretty much at random from the thread, and some of those quotes will be deliberately taken out of context to make a point. Sorry about all of that in advance. … Dijkstra was totally on the mark Dijkstra was famously rude. Some of his other quotes are fantast...
by tufty
Thu Nov 24, 2016 6:27 pm
Forum: Other programming languages
Topic: Solution to X-Toolkit and portability.
Replies: 161
Views: 16343

Re: Solution to X-Toolkit and portability.

I always though Objective-C is the hipster language Nah, it's been around for ages, and it's a very solid language, despite being tied to what's arguably *the* hipster platform(s). Semi-automatic garbage collection (fully automatic if you want), proper message passing OO as opposed to the "method c...
by tufty
Thu Nov 24, 2016 4:55 pm
Forum: Other programming languages
Topic: Solution to X-Toolkit and portability.
Replies: 161
Views: 16343

Re: Solution to X-Toolkit and portability.

Yeah, Javascript's pretty cool. The main problem with it, as far as I can see, is exactly that it is cool; everything needs to be buzzword compliant and using some utterly unstable hipster framework (usually version 0.1.7.3x pre-beta, or even better, a specific pull from github known only by its UUI...
by tufty
Thu Nov 24, 2016 7:00 am
Forum: Other programming languages
Topic: Solution to X-Toolkit and portability.
Replies: 161
Views: 16343

Re: Solution to X-Toolkit and portability.

My experience of leading teams of young C++ enthusiasts is that they leave you with a horrible mess of code that is so tightly interlocked to itself it's impossible to maintain afterwards. Changing anything requires changes everywhere. A nightmare. Not to mention being full of memory leaks! 110%. T...
by tufty
Wed Nov 23, 2016 7:39 pm
Forum: Other programming languages
Topic: Solution to X-Toolkit and portability.
Replies: 161
Views: 16343

Re: Solution to X-Toolkit and portability.

well I doubt templates and STL or similar were used before the standard, do not understand that one There's a lot of things you seemingly fail to understand, David. Now, I loathe C++ with a vengeance. Mainly by having been in on it when it was wee small, seen its youthful innocence violated, and ha...
by tufty
Tue Nov 22, 2016 5:04 pm
Forum: Other programming languages
Topic: Solution to X-Toolkit and portability.
Replies: 161
Views: 16343

Re: Solution to X-Toolkit and portability.

Also Heater, on the issue of safty of on server data: Maybe slightly off topic, though it is one we have debated many times before. I posted a thread asking for peer review of how to be sure code is readable. This was on these forums, explicitly in "Other Languages". That thread vanished from exist...
by tufty
Mon Nov 21, 2016 5:19 pm
Forum: Other programming languages
Topic: Solution to X-Toolkit and portability.
Replies: 161
Views: 16343

Re: Solution to X-Toolkit and portability.

AV Rule 208 C++ exceptions shall not be used (i.e. throw, catch and try shall not be used.) This one is for tufty :). Of course. Exceptions are just another form of goto. The reasons for that probably aren't about flow control, but rather about fear of the performance hit (despite that it usually o...

Go to advanced search