Show newer

@freemo @namark @Lossberg a prime sieve would be more complex than the whole solution.

@freemo @namark @Lossberg It is a pragmatic solution based on a "process" where the process is more important than the solution. Think of it like Algebra.

Big numbers, small numbers... it is all a matter of time.

@freemo @namark @Lossberg I realize you enjoy different types of problems, and different types of solutions. So maybe even the suggestion of this is something you may find no interest in. I can accept that. I would encourage everyone, even you to give it a try (at that absolutely ridiculous level of pragmatically following the 3 laws and using the R-G-R workflow) Maybe you will get something out of it, maybe you won't.

And by pragmatically, I mean your first test would look like:

def test_factor_zero_return_empty():
assert factor(0) == []

----

and the first code that makes it pass is:

def factor(num):
return []

-------

That is the level or pragmatism I am speaking of.

@freemo @namark @Lossberg see if you see it generate an algorithm different from what you might have done not doing it that way.

@freemo @namark @Lossberg The factorization problem/kata is one that I particularly enjoy, because when I am done, and I look at the 6 lines of python that it generates... I always shake my head and say "I would not have written that no matter how long I sat there, or how many times I tried." Humor me, and let's see if you see similar things....

@Lossberg by the way, I do a here, you can look at the origination of it all the way back the 'Ninety-Nine Bottles of Beer" challenge. qoto.org/@Absinthe/10280565958

Feel free to play at any of them that interest you. There is no timebox on these. Watch for the tag and include it on any answers you offer to any of them.

@freemo @namark @Lossberg

When I say TDD, I mean it is the way of design and development. (maybe even a way of life :D )

This means following the 3 laws:

1. You are not allowed to write any production code unless it is to make a failing unit test pass.

2. You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures.

3. You are not allowed to write any more production code than is sufficient to pass the one failing unit test.

Using a Red-Green-Refactor work flow. Write just enough of a unit test for the simplest unit test. Then see that test fail(Red). Then write the SIMPLEST solution in the code to make it pass. (Green) Then refactor to remove complexity and simplify. Lather, rinse, repeat.

@namark @freemo actually, what would be interesting would be to just sit down and knock it out. Then do it again walking the steps of TDD and compare the results.

@freemo @namark one of the fun things about TDD is how it can organically create an algorithm that you might not do just by sitting down and hacking at it.

@freemo I am trying to get one started somewhere else, and in that particular place it will have to be FOSS.

However, I would have no problem doing it as a for profit thing, but that sounds more like the definition of a "Coding Business" I wonder if it could make any money? :)

@freemo I guess, why not? Adds another layer of complexity to things whenever money gets involved though. :)

@yisraeldov It's been a while since I did clojure but as I remember it, the REPL ran your tests. But I would agree just running your program in the REPL each time you save certainly doesn't constitute TDD :)

@yisraeldov Well, if you test first, you on'y need to really know the syntax of your test package... :) Since it is going to fail anyway, it might help you to get the syntax as well.

@freemo Here's the idea. A group of people gets together (well virtually)
1. Brainstorm a project
2. Design the project
3. Code the project
4. Release it to the wild
5. Start over

There is a little more to it, but that is the basic flow. Add whatever other fluff is involved in a club. :)

Okay folks, this should be simple, but maybe not.

The goal is to write a function that takes a positive integer and returns a list of its prime factors. So if you did 12 you should get the list [2, 2, 3]

As neither 1 nor zero are prime, as a result should return an empty list.

This is taken from a , so if you have not done this one I encourage you to do so. If you are not into then solve it however you like.

Is anyone interested in, or has anyone been a part of a programming or coding club?

@tomekw at work we have a very large code base and we use cxxtest (yes even for the C code) and I have used boost's tests for C++. There are quite a few out there. What have you tried?

@yisraeldov
One might posit that actually test_hello_world. should precede hello_world. :)

@sir googol or even googolplex? Both of them are pretty big not sure if any larger ones have names do they?

Show older
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.