[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math


View post   

File: 39 KB, 495x214, 1549754558349.png [View same] [iqdb] [saucenao] [google]
10379047 No.10379047 [Reply] [Original]

CS fags, exactly how BIG is a 'piece of code' ?

>> No.10379094

>>10379047
10 lines?

>> No.10379127

>>10379047
Depends on the code... In terms of KB MB GB or in terms of lines? What is the measurement?

>> No.10379164

>>10379127
it seems too arbitrary to measure code in bits, i was thinking more in terms of lines, or does 'piece of code' even have to be a direct measurement, could it mean accomplishing a certain task ?
I always thought it meant that you wrote a commit/div and not how much you wrote - be it 10 or 100 lines

>> No.10379182

>>10379047
Is this actually a real thing? Being the "right amount" of drunk improves your programming ability?

>> No.10379183

A "piece of code" is not a quantitative measure in any way. How much is a bucket of water? That depends on how large you make your bucket.

>> No.10379191

>>10379182
No. What there is is a level of drunkenness where you are still capable enough to produce working shit, while no longer caring about quality considerations, which allows you to crank out a lot of working but useless shit quickly.

>> No.10379193

>>10379164
about 30 lines I'd say, the 10 lines previously stated by another anon is a bit low.

>> No.10379195

>>10379191
Makes sense.

>> No.10379207

>>10379182
>>10379191
I don't know about you but reading cs material is much easier after 1/2 or 1 Asahi can, I think when you do more then one bear your gonna get to lose and won't remember half you learner/wrote

>> No.10379208

>>10379207
>Asahi
Tokyo-chan, is that you?

>> No.10379210

>>10379047
i'm not sure if this is what you're asking.
i think "a piece of code" is a term whose referent depends on the context of the discussion.
if you're doing homework for a class "matlab for jocks" and you ask your buddy to "look at this piece of code", it might only be two lines that initialize a matrix.
if you write software for commercial aircraft avionics, and you told your boss that the piece of code he sent you from the other department was riddled with errors, it might be several hundred of lines long, no?

>> No.10379220
File: 9 KB, 234x215, that 30-year-old boomer.jpg [View same] [iqdb] [saucenao] [google]
10379220

Let [math]\mathscr M[/math] be the set of all 2-one-sided-strip binary random-access Turing machines which correctly implement the 'piece of code' for any correct context in a set of contexts [math]\mathscr I[/math]. For any [math]M\;\in\;\mathscr M[/math] and [math]I\;\in\;\mathscr I[/math], [math]T\left(M,\;I\right) \;\in\; \mathbf N[/math] denotes the number of transitions involved in the execution of [math]M[/math] with their input corresponding to context [math]I[/math].

For any [math]M\;\in\;\mathscr M[/math], define [math]M[/math]'s complexity as
[eqn]T\left(M\right) \;=\; \sup_{I\;\in\;\mathscr I}\, T\left(M,\;I\right).[/eqn]
Since all [math]M\;\in\;\mathscr M[/math] terminate and [math]T\left(M,\;I\right) \;\in\; \mathbf N[/math], the supremum is a maximum, i.e.
[eqn]T\left(M\right) \;=\; \max_{I\;\in\;\mathscr I}\, T\left(M,\;I\right) \;\in\; \mathbf N.[/eqn]
Define the complexity of the 'piece of code' by
[eqn]T \;=\; \inf_{M\;\in\;\mathscr M}\, T\left(M\right).[/eqn]
Since for all [math]M\;\in\;\mathscr M[/math], [math]T\left(M\right)\;\in\;\mathbf N[/math], the infremum is a minimum, i.e.
[eqn]T \;=\; \min_{M\;\in\;\mathscr M}\, T\left(M\right) \;\in\; \mathbf N.[/eqn]
In other words, the size of a 'pice of code' is its Kolmogorov complexity with the language being that of 2-one-sided-strip binary random-access Turing machines.

>> No.10379227
File: 16 KB, 200x303, doubt_la_noir.jpg [View same] [iqdb] [saucenao] [google]
10379227

>>10379220
>Let [math]\mathscr M[/math] be the set of all 2-one-sided-strip binary random-access Turing machines which correctly implement...

>> No.10380649

>>10379047
Anywhere between 5 lines and ten thousand

>> No.10380822

Just a bit of bits

>> No.10380907

>>10379047
Noone says a "piece of code" ever. Whoever said it is a fucking idiot.

>> No.10381888
File: 68 KB, 644x573, VUWFVXj.png [View same] [iqdb] [saucenao] [google]
10381888

>>10379164
>it seems too arbitrary to measure code in bits
>arbitrary
>when computation is literally just a network of on and off switches

>> No.10382455

>>10379220
Let [math]I_n[/math], [math]n\in\mathbb N[/math], be a sequence of inputs.
If [math]T(M,I_n)=n[/math] for all [math]n[/math], then the supremum is not a number.

>> No.10383457

>>10379047
How long is a piece of string?