[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 318
Thread images: 34

File: Linear_Programming.jpg (18KB, 420x603px) Image search: [Google]
Linear_Programming.jpg
18KB, 420x603px
What are you working on, /g/?

Old thread: >>58656123
>>
>>58661484
>non-americans
Why are americans so fucking dumb?
Holy shit.
>>
File: part2_img.jpg (88KB, 300x440px) Image search: [Google]
part2_img.jpg
88KB, 300x440px
>>
>before bumplimit
no
>>
>>58661525

Fuck off, fucking anime retard.
>>
File: Delphi.png (108KB, 1024x616px) Image search: [Google]
Delphi.png
108KB, 1024x616px
What went wrong, /g/?
>>
>>58661674
The change to a subscription-based business model.
>>
>>58661674
Not opensourcing old versions like they did to InterBase.
>>
Reminder that this happened:

>>58657185
>>58660223
>>
>>58662153
>"functional" programming
Not even once!
>>
>>58662167
That's not functional programming. That's JavaScript parodying functional programming.
>>
>>58662177

>"functional programming has never been tried!"

>"hey javascript, whatcha doin'?"
>"functional programming"

>"hey scala, whatcha doin'?"
>"functional programming"

>"hey f#, whatcha doin'?"
>"functional programming"

>"my specific, perfect, entirely infallible brand of FUNCTIONAL PROGRAMMING HAS NEVER BEEN TRIED"
>>
>>58662229
What are you talking about?
>>
>>58661502
While I think linear programming is amazing, and every CS and engineering major should learn it, you do realize it has absolutely nothing to do with computer programming. Right?
>>
>>58662253
I think it's a hilariously weak attempt at trolling
>>
>>58662253
I get the feeling a lot of the posts are replies to things in the last thread.
>>
>>58662315
>>58662318
Fair enough. 'Functional programming has never been tried' seems like a complete non-sequitur.
>>
>>58662304
>absolutely nothing to do with computer programming
Next you'll tell me sorting and factoring have absolutely nothing to do with computer programming.
>>
>>58662404
It's one class of algorithms that were designed for human computers, during WWII. They improved then slightly, for digital computers, but barely. They're a solved problem*, and when it comes down to it, more pure math than just about anything else you touch in CS courses.

*Admittedly, it's useful to study solved problems, it's just that this one isn't computer programming related.
>>
File: gommunism.jpg (541KB, 793x1400px) Image search: [Google]
gommunism.jpg
541KB, 793x1400px
>>58662329

That's a meme, famalam.
>>
>>58662229

hehehe..
>>
File: meme_on_rails.jpg (48KB, 465x365px) Image search: [Google]
meme_on_rails.jpg
48KB, 465x365px
Is this just a meme or is it actually good, /dpt/? Sh-should I learn it?
>>
>>58664739
Ask here: >>58661514
>>
>>58664763
Stop memeing your failed anime thread, Rajesh.
>>
>>58664790
Clam down, Pahjeet Kumar.
>>
>>58664014
>spelled infallable wrong
tsk
>>
File: magnets_c.jpg (17KB, 640x359px) Image search: [Google]
magnets_c.jpg
17KB, 640x359px
>>58666009
>infallable
>>
I'm going to try and relearn C by going through the MIT algorithms book and doing all of the examples/problems with C.

Is there a better way?
>>
>>58664014
So it was /pol/. Glad I didn't know.
>>
/dpt/, is this OOP or FP?
http://www.ccs.neu.edu/course/cs2510/lecture13.html
>>
File: dwerwet3223.png (7KB, 597x150px) Image search: [Google]
dwerwet3223.png
7KB, 597x150px
How would you modify the code to make the spaces inverted?
>>
>>58662153
map() passes more than one argument to the lambda.
parseInt() optionally accepts more than one argument.
How do you propose to fix the problem?
>>
>>58666687
if the spaces are increasing and you started the loop in 1

you have to start the loop at the maximum value and decrease from that

something like
for (int pres = i-1; pres >= 0; pres--)
bla bla
>>
>>58666836
That doesn't work, as I need to have maximum value of spaces at the top and minimum at the bottom.
Do I need another for loop for that?
>>
File: lolthistoo.png (183KB, 1040x738px) Image search: [Google]
lolthistoo.png
183KB, 1040x738px
>be me
>keep workin on project euler
>try to use C, because I will need it someday
>somehow get stuck with a shitty problem
>mfw the problem takes just a few lines in python
>no face

Why is python such a beauty?
I really love it when you need it for math crap. SciPy, too.
>>
>>58666920
Think about it very carefully
How many spaces do you currently have on the first line?
How many spaces do you currently have on the last line?
How many spaces do you want on the first line? How about the next line? How about the next line?
How about the last line?
What mathematical expression could get us to that number based on the current index (which starts at 1 and ends at 8)?

What are you using to generate spaces? What is that determining how many spaces? How could we change it to use that mathematical expression?

Do not reply unless your reply is answering all these questions to the best of your ability
>>
>>58666738
By using a language that isn't broken.

And remember: 'map' isn't just for lambdas; it's for named functions, too.
>>
>>58666997
I'm not that "always use a lambda" guy, but the only language design at fault for the parseInt fuckery is the fact that javascript lets you omit arguments that you don't care about.
>>
>>58666966
By spaces I assume you mean the spaces I created with the for loop, not the others.
Currently theres 1 space on the first line, with each line adding one extra, so on the last one, that's 7.

I want 7 spaces on the first line and one less for each of the other lines, so 6 on the next, 5 on the next, and 1 on the last.
Subtracting, but I don't know how to write code to subtract from the current code, or even i, since i starts at 1.
Using the for loop for spaces, and I honestly don't know if I have to make another for loop, or change the code completely for it to work.
>>
>>58667039
Also that map() passes more than one argument for some reason and that somehow subsequent list entries get passed as additional arguments. This behaviour is completely unprecedented (well, the fact that it's retarded is precedented by the fact that we're talking about JS, but beside that).
>>
>>58667098
You should just subtract i from 8 rather than subtracting 1 from i.
i = 1; 8 - 1 = 7 spaces
i = 2; 8 - 2 = 6 spaces
i = 3; 8 - 3 = 5 spaces
for (int pres = 1; pres <= (8 - i); pres++)
Console.Write(" ");
>>
>>58666300
>public
>private
>instances
>classes
>methods

It's probably FP.
>>
>>58667098
Also, I'm guessing if I changed the code so that it wouldn't take i for calculating and just for counting, it would work, but that means I have to make another variable and I'm not sure even if it's gonna work.
>>
>>58667099
It's supposed to help so that you can pass functions to map that doesn't have to have the list in question in scope.
>>
>>58667154
correct
>>
>>58667164
Why would you want to do that?
>>
>>58666300

It's faggotry, that's what it is.
>>
File: emma-stone-la-la-land-770x470.jpg (30KB, 770x470px) Image search: [Google]
emma-stone-la-la-land-770x470.jpg
30KB, 770x470px
How do I learn coroutines in python?

Are they the same as generators? Or are they more like threading?
>>
>>58667193
>he isn't writing generic fold and map in his second semester Java course
why even try wew
>>
>>58666943
>try to use C, because I will need it someday

this mentality doesnt cut it for me. I'd rather learn something if it piques my curiosity or if it's useful in the immediate moment. Trust me this way is a better way of learning programming.

By all means continue with python, it's a fun language
>>
File: nice1.png (153KB, 1137x847px) Image search: [Google]
nice1.png
153KB, 1137x847px
>>58667236
>By all means continue with python, it's a fun language
I did and it didn't took me long to solve the next problem.
Python is really fun for math shit.

I'll "just" need C for embedded stuff later on. Will learn this really hands on, I guess.
>>
>>58667148
But that would mean that I know how many rows there are, what if I later on would want user input?

Also, I somehow can't seem to press the > sign in visual studio, how do I change this? I'm using alt + . for it, but it's not working.
>>
>>58667213
Coroutines are a slight generalization of generators. Generators simply yield outputs, whereas coroutines yield outputs and accept inputs when they're resumed.
>>
File: mfw.jpg (58KB, 820x470px) Image search: [Google]
mfw.jpg
58KB, 820x470px
>>58667229
>stuff that have no real-world use
>>
File: 1484973457026.jpg (110KB, 497x640px) Image search: [Google]
1484973457026.jpg
110KB, 497x640px
>>58667039
>>58667099
>>58667164
>JavaScript
>>
>>58667265
>what if I later on would want user input?
You should definitely then store this in a variable, maybe naming it 'n'.
Then you would do 'n - i'.
>>
>>58667279
>tfw too smart for object oriented java
functional programming in java is lit senpai
>>
File: python.png (8KB, 200x200px) Image search: [Google]
python.png
8KB, 200x200px
>>58661502
I've learned Python to an upper-intermediate level and now I'm looking at C. I've been doing it a couple days and I gotta say, it doesn't look that hard.

Maybe it's because Python is built on C and implements stuff from it, like string formatting, the break/continue in a while loop, etc.

I'm learning about memory management and that's pretty cool, but as far as difficulty I'm not seeing it. Is C supposed to be hard? or is that C++ I'm thinking of
>>
>>58667271
Ah okay, so what would be a situation where you might use a coroutine instead of a generator?
>>
>>58667338
C is easy to understand, hard to master. Try to do a big project with C. You'll understand.
>>
File: INBvStO.png (312KB, 506x662px) Image search: [Google]
INBvStO.png
312KB, 506x662px
>>58667321
>mfw
>>
>>58667338
Just wait. Clusterfuckery is exponentially related to codebase size.
>>
>>58667341
I'm sure you know how generators can be used to do traversals of data structures. Imagine a hypothetical binary tree traversal that, instead of being post-order or in-order or something, picks one of the two branches and doesn't go back up. This can be done with a coroutine that yields and accepts a boolean (false = left, true = right) when it is resumed.
>>
>>58667354
>Try to do a big project with C

I"m guessing that's why C++ was invented - the classes / object oriented approach makes big projects easier
>>
>>58667338
Write a function that takes a list of lines from the user, stopping at the first empty line. Then print out every word from every line (space seperated) but sorts them from longest words to shortest words.
This is like 20-30 lines of python, but I can't even visualize how to structure this properly in C, let alone how long the implementation would be
>>
>>58667368
Just employ the eXtreme Go Horse software development methodology, senpai.
>>
>>58667389

Reminder that C++ is useless, C already would let you put function pointers in structs anyway.

OOP is a meme anyway.
>>
>>58667389
>the classes / object oriented approach makes big projects easier
Only for code monkeys. But they shouldn't be allowed to code on real projects.
>>
>>58667422
c fags are the biggest cucks
>i'm willing to inconvenience myself to get a subpar solution in C because I can brag about it on the internet
>>
>>58667341
>>58667378
Another use case would be async I/O. The coroutine would yield some async I/O request and accept the result when it is resumed. This would allow you to have multiple coroutines working concurrently in a cooperative manner - when one is waiting for an I/O operation to complete, another one can be doing work. That way, all the actual async I/O work which might need another thread, inter thread communication, etc. would be relegated to a scheduler and the coroutines don't have to know exactly how it works.
>>
>>58667394
Yeah my plan is to switch to C to learn how programming / memory management actually works. Once I have this "deeper understanding" of what's happening, I'm going back to Python
>>
Good night, guise. I'm not working on anything actively at the moment, but I'm learning Go, enjoying it very much so far, especially if it's B. Kernighan holding my hand. Nothing like the co-creator of C to implicitly tell you how much there is wrong with his own language.

I'm also considering learning Rust too. Should I bother?
>>
>>58667645
Rust is interesting if you willing to work with the type and lifetime system.
>>
>>58667662
From what I gather, Rust seems like a very vehement response to C's weak typing and "liberal" memory management system. Like the creators of Rust are obsessed with type safety and data ownership to the point it seems autistic.

I love C and am quite into low-level development and kernel hacking but it'd be nice to know that there is something else that I could potentially use, that would pretty much fill in the same gaps C is meant to do: device drivers, kernels, embedded devices... Could Rust or Go ever aspire to attain that?
>>
>>58667730
>Like the creators of Rust are obsessed with type safety and data ownership to the point it seems autistic.
Rust is designed around the guarantee that safe Rust code can never cause a memory error. Everything follows from that.

>Could Rust or Go ever aspire to attain that?
Rust is a systems language. Go is not, because it has garbage collection.
https://www.redox-os.org/
>>
>>58667773
>Rust is a systems language. Go is not, because it has garbage collection.
Go's GC is non-blocking though, isn't it? I'm just learning the lang now so I may be terribly wrong. Plus, Go's concurrency seems pretty well designed, I don't know if Rust's is as good...

Anyway, that OS seems pretty interesting, I'll give it a look.
>>
I'm working on a Arduino robot. It utilizes an ultrasonic sensor to detect objects. If one gets ~2" in front of it, it turns left & right to "see" which path is better and chooses the better path.
>>
>>58667827
I suppose you could use Go for low-level stuff like that as it is compiled to native code, but its support for manual memory management is virtually non-existent. Rust is designed around manual memory management.

Go's concurrency story is nothing special, it's just coroutines. Rust's concurrency story is that its memory safety guarantees extend across threads and make it far easier to write correct multithreaded code.
>>
void setBit( size_t * const src, const size_t index, const bool to ) {
size_t value;
if ( to ) {
value = 0xFFFFFFFF;
} else {
value = 0x00000000;
}

const size_t prev = *src;

size_t mask = 1 << index;

*src = value & mask;
*src += prev & (~mask);
}


should i do anything differently?
>>
>>58667394
def get_input():
user_input = []
while True:
ask = input('Enter a line: ')
if ask:
user_input.append(ask)
continue
return separate(user_input)

def separate(user_input):
sep_list = []
final_string = ''
for item in user_input:
split_str = item.split()
for word in split_str:
sep_list.append(word)
sep_list.sort(key=len, reverse=True)
for item in sep_list:
final_string += f'{item} '
print(final_string)

if __name__ == '__main__':
get_input()


Some of this looks like crap (e.g. no list comprehension, could've split into more functions) but it's quick and dirty
>>
>>58667901
void setBit(size_t *src, size_t index, bool to) {
size_t mask = 1 << index;
if (to) {
*src |= mask;
} else {
*src &= ~mask;
}
}
>>
>>58668001
void setBit(size_t *src, size_t index, bool to) {
size_t mask = 1 << index;
*src = to ? (*src | mask) : (*src & ~mask);
}
>>
>>58668062
the ? : combination is disgusting
>>
File: sandiac.jpg (62KB, 450x542px) Image search: [Google]
sandiac.jpg
62KB, 450x542px
What's the difference between a character and a special character?
>>
no goiug back now lads, its dvorak time.
>>
Anyone know good regex to filter out mass spam via 4chanx?
>>
>>58668062
wow amazing change my man!
>>
/^*$/
>>
Can someone who uses vim try this out for me and tell me if it works? It's a proof of concept and I promise that it doesn't actually do anything bad.
http://codepen.io/iamevn/pen/WRZaae
>>
File: as_if.jpg (60KB, 540x405px) Image search: [Google]
as_if.jpg
60KB, 540x405px
>>58668867
>unironically pasting code from 4chan into your computer
>>
>>58668886
the best part is that this is intending to show that you absolutely shouldn't do just that.
the linked article says
>So, the lesson here is, make sure that you paste code snippets from untrusted sources onto a text editor before executing it.
and I thought it'd be fun to show how easy it is to break out of a text editor
>>
>>58668904
>this is intending to show that you absolutely shouldn't do just that.
thanks mate!
now i know :D
>>
>>58668867
>paste this into vim using the terminal
Who actually does that? "+p, not for safety reasons but because a paste like that usually breaks the autoindent.

Only exception I use is pasting from tmux a value I just yanked, usually something short like a memory address.
>>
>>58669009
>paste usually breaks the autoindent
:set paste
>>
>>58669009
Watching people (especially new people) use vim, I see it all the time.
>>
>>58669050
Yes, that's much much shorter.

:set paste<cr>I<S-Insert>

Thanks for the tip dipshit.
>>
>>58667259
(defun collatz (n)
(length (loop as i = n then (if (evenp i)
(/ i 2) (+ (* 3 i) 1))
collecting i until (= i 1))))

(time (let ((longest 1) (highest 1))
(loop as i from 1 to 1e6
do (format t "doing ~a~%" i)
do (let ((curr (collatz i)))
(when (> curr longest)
(setq longest curr)
(setq highest i)))
finally (print highest))))


and
837799 
Evaluation took:
7.532 seconds of real time
7.533333 seconds of total run time (5.860000 user, 1.673333 system)
[ Run times consist of 0.134 seconds GC time, and 7.400 seconds non-GC time. ]
100.01% CPU
15,779,655,408 processor cycles
2,134,962,544 bytes consed

how much time for you?
>>
>>58669194
What esoteric programming language is that?
>>
File: i saw that.png (731KB, 499x499px) Image search: [Google]
i saw that.png
731KB, 499x499px
>>58669205
>esoteric
>>
yeah ocaml really is the best lang ever.
>>
>>58669236
t. person with no standards
how's that syntax going along
>[10 ; 5 ; 20]
>let
>letrec
>>
>>58661502
I'm learning Forth

I don't know why but I think I love it
>>
>>58667394
>Write a function that takes a list of lines from the user, stopping at the first empty line. Then print out every word from every line (space seperated) but sorts them from longest words to shortest words.

def get_input():
user_data = []
while True:
entry = input('Enter a line: ')
if entry:
user_data.append(entry)
continue
return separate(user_data)

def separate(data):
separated = []
for entry in data:
words = entry.split()
for word in words:
separated.append(word)
separated.sort(key=len, reverse=True)
return combine(separated)

def combine(data):
final_string = ''
for entry in data:
final_string += f'{entry} '
print(final_string)


if __name__ == '__main__':
get_input()
>>
>>58669205
looks like racket
>>
>>58669269
dude wtf, that's chicken scheme
>>
>>58669299
no it's common lisp you fucking retard.
sage
>>
I would unironically use akarai-bbs
just needs boards I guess
>>
>>58668867
apparently it selects this text instead:

 ls :!clear; echo -ne 'h4cking \#\#                        (10\%)\r'; sleep 0.3; echo -ne 'h4cking \#\#\#                       (20\%)\r'; sleep 0.3; echo -ne 'h4cking \#\#\#\#\#                     (33\%)\r'; sleep 0.3; echo -ne 'h4cking \#\#\#\#\#\#\#                   (40\%)\r'; sleep 0.3; echo -ne 'h4cking \#\#\#\#\#\#\#\#\#\#                (50\%)\r'; sleep 0.3; echo -ne 'h4cking \#\#\#\#\#\#\#\#\#\#\#\#\#             (66\%)\r'; sleep 0.3; echo -ne 'h4cking \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#     (99\%)\r'; sleep 0.3; echo -ne 'h4cking \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#   (100\%)\r'; echo -ne '\n'; echo 'Hacking complete.'; echo 'Use GUI interface using visual basic to track my IP';sleep 3
i -lat

>>
>>58669194
>))
>))))
>)))
>))))

is this language for real? it works but aesthetically it looks like cluttered shit.
>>
File: lisp.png (106KB, 600x551px) Image search: [Google]
lisp.png
106KB, 600x551px
>>58669334
>>
>>58669334
the parenthesis make it hotter desu
im not kidding!
>>
>>58667556
>going back to Python
After C you'll never go back
>>
Spoonfeed me resources to learn C# or whatever non-Ruby, non-Python language you think is best for beginners.
>>
>>58669560
Lies!
C is tedious!
C doesn't have good features!
C doesn't have polymorphism!
>>
>>58669560
Oh I bet I will for some things.
Different languages are best suited for different problems. I can already tell there's no way I'd ever write a web scraper in C when I can do it in about 12 lines of Python.
>>
>>58669587
http://www.open-std.org/jtc1/SC22/wg14/www/docs/n1548.pdf
>>
>>58667773
>Go is not, because it has garbage collection.

It has never been true that garbage collection prevents you from writing an OS. At the very least you can just use object pools for everything and turn of the GC.
>>
File: jelly doughnut.jpg (67KB, 700x984px) Image search: [Google]
jelly doughnut.jpg
67KB, 700x984px
>>58669636
What language is the most polymorphic
>>
>>58664739
It's a meme.

It's shit.
>>
>>58669636
>C is tedious!
I'm not going to say it's the most concise language, but there are worse when it comes to tedium, Java particularly.
>C doesn't have good features!
Sure it does. Also, C's apparent "lack of features" is actually a feature in itself.
>C doesn't have polymorphism!
Who cares? You can no polymorphism in C, but it's not worth it most of the time.
>>
>>58669725
>can no
can do*
>>
>>58669697
haskell
>>
>>58669697
LISP
>>
File: videnie-eskaflona-film.png (324KB, 704x384px) Image search: [Google]
videnie-eskaflona-film.png
324KB, 704x384px
>>58669778
>>58669864
Well which is it
>>
Anyone know SDL_gpu? I have a simple hello world and I can't see the line, just black screen. I used some arbitrary values in places for the line and line color.

#include "SDL.h"
#include "SDL_gpu.h"

void main_loop(GPU_Target* screen) {
while (true) {
GPU_Clear(screen);
GPU_Line(screen, 0.f, 0.f, 123.f, 123.f, SDL_Color({ 123,255,255 }));
GPU_Flip(screen);
}
}

int main(int argc, char* argv[])
{
GPU_Target* screen;

screen = GPU_Init(800, 600, GPU_DEFAULT_INIT_FLAGS);
if (screen == NULL)
return -1;

main_loop(screen);

GPU_Quit();

return 0;
}
>>
>>58669882
Lisp you can't do shit in haskell because it's PURE shit.
>>
>>58669905
That's a bold claim
>>
>>58669905
This, no haskeller can solve>>58667259
because it requires mutation
>>
>>58669989
>Collatz sequences require mutation
wat
>>
>>58669989
import Data.List   

problem_14 = j 1000000 where
f :: Int -> Integer -> Int
f k 1 = k
f k n = f (k+1) $ if even n then div n 2 else 3*n + 1
g x y = if snd x < snd y then y else x
h x n = g x (n, f 1 n)
j n = fst $ foldl' h (1,1) [2..n-1]
>>
>>58669989
>something requires mutation
and?
>>
>>58669989
What mutation?
>>
>>58669989
put me in the screencap
>>
How much do I have to know to develop on Android?
>>
>>58670532
Mutation is when you mutate.
>>
My mom won't go out in public with me anymore
>>
File: 1483655558042.jpg (126KB, 2048x1536px) Image search: [Google]
1483655558042.jpg
126KB, 2048x1536px
>>58670614
Did you lend her your copy of SICP?
>>
>>58669989
So, to summarize:

1) Collatz doesn't require mutation
2) Haskell can handle mutation anyway
3) You can implement Collatz with Haskell regardless of whether or not you decide to use mutation

Now we can continue with the thread.
>>
Netbeans or Eclipse?
>>
so i'm working on a problem focused on math and optimization: basically, given a huge integer (say 100 digits) that has exactly two factors that aren't 1 and itself, find the two factors. i could use some theory help with it.

what i've got so far is that at least one of the two factors will have at least half the number of digits as the original number, so i made the program start at 10^(half the digits - 1)

also, if one factor is found, all you have to do to find the other is divide the original number by the found factor (obviously)

another is that if the original number is even, at least one of the factors will be even, and if its odd, both factors will be odd. given this, if the number is odd, i will start iterating with an odd number and increment by 2 each time.

so i've already implented all of those, but as you can imagine its barely made a dent. the last thing is the the 2 factors have to be prime numbers. my idea with this was to get a list of prime numbers with 50-100 digits, but i couldn't seem to find one. so right now im looking for something to maybe generate them quickly if possible, but if anyone knows of a premade list, let me know. what else could i do to speed this up?
>>
>>58670414
how could anyone think this doesn't look like shit

do you even make any non-trivial software with haskell or do you just do babby tier puzzles all day?
>>
>>58670844
eclipse
>>
>>58670853
>has exactly two factors that aren't 1 and itself
>if the original number is even, at least one of the factors will be even
more like exactly one of the factors will be even (2) and the other will be odd.

>generate primes quickly
that's the right direction imo.
read up on sieves
>>
I finally figured out how to do the thing earlier. Deletes the Nth number of an element in a list. Is there a list comprehension way to do this?

deleteNth :: (Eq a) => Int -> a -> [a] -> [a]
deleteNth n y [] = []
deleteNth n y (x:xs)
| (n == 1) && (y == x) = deleteNth (n-1) y xs
| (y == x) = x:deleteNth (n-1) y xs
| otherwise = x:deleteNth n y xs
>>
>>58670853
>10^(half the digits - 1)
floor(sqrt(n))
>>
>>58670844
Delphi
>>
>>58670870
It most definitely does look like shit.

That was actually what went through my head as I copy-pasted from https://wiki.haskell.org/Euler_problems/11_to_20#Problem_14

Generally, Haskell looks much nicer than that example.

Oh, I forgot:
(You) RREEEEE how dare you insult Haskell, etc
>>
>>58670870
>>58670927
>I finally figured out how to remove an element from a list
>>
>>58670927
Is this what you were going for?

dropNth n l = take (n - 1) l ++ drop n l
>>
>>58670953
Why do you have to be so mean. I just started learning haskell.
>>58670971
My function takes in 3 elements, why does yours only take 2.
>>
>>58670870
It looks like shit but it's also terrible Haskell.
>>
Here's a weird question

I have an old pc with WinXP on it. In it i have one obscure software that my dad bought license for and that he wants to use. Unfortunately the guy who made the software quit working on it and refuses to answer.

Now the weird part. Considering dad bought new pc i transfered the software to win7 and realized the license used doesn't accept being inserted twice. Ok, i made VHD of entire drive and inserted it in vmware workstation and the drive works but THIS FUCKING SHIT STILL DOESN'T WORK

I think it checks for hardware, that's the only way i can explain this. Wat do /g/, how do i unlock this shit?
>>
>>58670994
>My function takes in 3 elements, why does yours only take 2
I don't know, I was asking what your function was supposed to do. The example was to demonstrate what I thought you meant.
>>
>>58671020
Example:
deleteNth 2 4 [1,4,1,4]
Deletes the 2nd 4 in the list to give [1,4,1]
>>
>>58671027
Oh, I see. I don't think you're going to be able to avoid passing an accumulator in that case, since the recursion step requires knowledge of what has come before it.
>>
>>58671135
That's what I was thinking, but wasn't super sure since I'm new to functional programming.
>>
>>58667394
There's nothing complicated about doing it in C.

Continue to read user input while the last line isnt equivalent to a verbatim newline. Once it is, use a regex lib to split the input in whatever fucking way you want (or write your own function that read a string till a space/endofline and dumps out a pointer for that), and then you can easily make a function that gets the length of the strings.

PS Its shorter written code than the python version

PPS this may or may not be because c doesnt have fucking whitespace as syntax.
>>
>>58671163
I suspect that is the case, but I could be wrong.

Perhaps your best bet for avoiding explicit recursion would be to use mapAccumL or similar.
>>
File: 1446712273015.png (221KB, 368x379px) Image search: [Google]
1446712273015.png
221KB, 368x379px
>>58671165
>use a regex lib to split the input
>>
>>58671165
>PS Its shorter written code than the python version
Narp.
>>
File: 1482385962346.png (269KB, 870x870px) Image search: [Google]
1482385962346.png
269KB, 870x870px
Why is it so hard to import a dark theme for Eclipse that just works?
>>
>>58671165
>>58671200
>He can't split words without regex
Yeah, it's fucking easy. Even if you don't want to use strtok, you just write a very simple state machine and use a couple of pointers.
>>
>>58671227
what's the problem?
>>
>>58661502

Had an interview. Way easier than expected. Still bombed it horribly.
>>
>>58671292
Some text like like under Task List is still black on dark background, and selecting text in menus highlights it with a dark blue highlight, and the text itself changes from a nice white on dark to black on dark.
>>
>>58671356
i use this theme and it works fine

http://www.eclipsecolorthemes.org/?view=theme&id=383

you should be able to customize it as well like if the theme author neglected something you can fix it yourself
>>
Would it be better to learn lower-level programming languages like c or objective-c and then move on to higher level ones or the opposite?
>>
>>58671529
Objective-C is a bit weird. I'd recommend you learn C and then some OO language before trying Obj-C. Do what you like overall though. As long as you're willing to keep learning you'll be fine
>>
>>58671593
Thanks for the info!
>>
>>58671611
It's got two well-done ideas kinda separate from eachother. It's a superset of C and it's also got it's weird smalltalk-y OO
>>
>Java for everything not cpu/ram intensive
>C for embedded/optimization
>JS for client webdev
>PHP for server side webdev
>Scheme for AI
what about sysadmins? im stuck between bash, perl or python.
>>
Ok I've got text working by rendering the text via SDL_TTF then taking the surface and creating an OpenGL texture from it


Why is it that if the text is long (as in two many characters to fit on the screen) it shrinks it horizontally and then also flips it over, so the text is backwards and going the opposite direction? I don't want it to shrink, i want it to be cut off by the edge of the window

How can I accomplish this?
>>
>>58671884
Anybody?
>>
>>58672001
Art of Assembly Language.
>>
about to start learning java

what compiler should I use? Just downloaded eclipse
>>
>>58672059
it's built in, just make a java project and run it
>>
>>58672036
Is it really a good book though? I don't want to sound ignorant, but I read through the first few pages and the author uses a language he invented himself called HLA (High Level Assembly), instead of using any real Assembly language. Most reviews on Amazon are not satisfied with this approach either. I'm looking for learning x86/x64 Assembly, not some pseudolanguage that the author came up with because he deems his readers too dumb to start with the real deal.
>>
>>58671974

Why are you trying to create an opengl texture from the SDL_TTF? If you want text rendering in opengl you should be using your own bitmap font

https://learnopengl.com/#!In-Practice/Text-Rendering
>>
>>58671974
sounds like an SDL-specific quirk. are you doing the transformations yourself like in a vertex shader or by passing in a transformation matrix?
>>
Need to learn how to build a small database for work. What books should I read? I mostly use excel, thinking of building a db using sql/excel
>>
>>58672150
What would the advantage be?
>>
>>58672564
pros: better performance with frequently-changing text
cons: lower quality (kerning etc)
>>
Who Ada, C, and Fortran in one project here?
>>
>>58672689
y tho
>>
>>58672689
Why wouldn't I just do the whole thing in Ada?
>>
>>58672806
Cause the retard that made the library uses a macro so you can't make a thin binding without C. And Fortran's hip, man.
>>
File: steve_jobs_is_angry.jpg (98KB, 546x522px) Image search: [Google]
steve_jobs_is_angry.jpg
98KB, 546x522px
>>58669262
>posted this code hours ago
>thought it was pretty clean
>no one has said anything
>>
>>58673071
> looks too easy
> you are cheating
> coding should be brutal
> field is over saturated
> scare people away with programs written in C and D
> you will never win on /g/
>>
Anyone have a link to a land of lisp download?
>>
>>58673071
Your code is shit thats why
words = []
while True:
line = input("enter line: ")
if line == "":
break
else:
words += line.split()
for w in sorted(words):
print(w)
>>
>>58673071
>python
>clean
have a (You)
>>
>>58673390
The instructions said to
>Then print out every word from every line (space separated)

Aka they are joined into one string and printed on one line. You are iterating through and printing each word on its own line.

Having said that your way is definitely better than mine, IF you had followed the instructions. You failed this assignment, anon.
>>
File: 1484334193780.jpg (17KB, 256x352px) Image search: [Google]
1484334193780.jpg
17KB, 256x352px
>>58673390
>>58674287
Also you don't print them out from longest words to shortest words.

I'll stop replying now, I was just looking at the code trying to figure out how you did it with so little, then I realized it's because you did it totally wrong.

Again, you failed this assignment, anon.
>>
Is there a performance cost to type conversion in C? For example if I assign an int to a char will that take longer than assigning an int to an int?
>>
>>58674434
Depends on the implementation
>>
>>58674447
I see. If I write something like "char c=1;" will this statement be treated differently from "char c='CHARACTER_WHOSE_VALUE_IS_ONE'; "?
>>
>>58674434
Complex answer and ultimately pointless for almost all cases.
>>
>>58674466
>'CHARACTER_WHOSE_VALUE_IS_ONE'
Char literals are actually ints in C to begin with.
However, this is no something you need to be concerned with at all.
>>
>>58661502
Shat are these books and where can I access more of those?
>>
I made a C# file for backend stuff for my website. I'm using visual studio and the .NET framework. How do I run just the C# file to make sure its working properly?

I put a main method in the file, but I can't seem to find how to set up the properties so nothing runs but the C# file when I click the debug button.
>>
>>58674470
>>58674488
I'm writing an extremely write-intense program. An AI. It writes the entire state to a set of variables and then manipulates that state in various ways to score the result a few millions of times. This takes 4 or so seconds on a typical home computer. A typical use case will see it running every 20 or so seconds so the runtime adds up. I want to minimize the amount of time the user has to wait for it.
It only uses a few LSBs in each variable. To cut down on the writing time I want to use chars for these variables. If type conversion has a meaningful cost though it might be a net performance loss.
>>
>>58674523

You probably know the quote about "premature optimization being the root of all evil"?

First you need to identify the bottleneck, THEN you can worry about micro optimization. Still I think type casts are so irrelevant, I doubt that there isn't a better place to start optimizing. A single function call is way more interesting than worrying about int/char. Or maybe try to reduce the amount of reads/writes?

And if you really worry about such stuff you can still use inline assembly to get the very last bit of performance out of it.
>>
>>58674434
>>58674523
it depends. it might worsen performance if you have to mask off bits and sign-extend, but it might improve performance if you get fewer cache misses from having a smaller memory footprint
>>
>>58674573
You're right that there are probably bigger things I could do better. I'm not that good of a programmer. I'm essentially brute-forcing a solution after narrowing down the space a bit because finding better heuristics is beyond me. This just seemed like a simple first step to take to improve the information density of my reads/writes.
>>
>>58674607

I see.
Well, go ahead then and benchmark the differnce!

Do it 10,000 times with the int, then do it with the variable.
Then come back and report what you found out.

This might come in handy:
#ifdef WIN32

#include <windows.h>
double get_time()
{
LARGE_INTEGER t, f;
QueryPerformanceCounter(&t);
QueryPerformanceFrequency(&f);
return (double)t.QuadPart/(double)f.QuadPart;
}

#else

#include <sys/time.h>
#include <sys/resource.h>

double get_time()
{
struct timeval t;
struct timezone tzp;
gettimeofday(&t, &tzp);
return t.tv_sec + t.tv_usec*1e-6;
}

#endif
>>
File: Its ogre.jpg (18KB, 400x386px) Image search: [Google]
Its ogre.jpg
18KB, 400x386px
Autistic 20 year old on disability who will no longer be able to support himself because parents are done working, this is me.

Do I learn python, java, or C# first (will learn all three) in order to get a job and do side stuff?
>>
>>58674741
How much do you get for disability?
>>
>>58674741
Clearly, I hate this industry for being the new gold rush for people in need. Your kind is not welcome, reee~
>>
>>58674741
>20
>parents done working

Did they give you autism by getting pregnant too late?
>>
The power is out. Though yesterday I added image unthumbnailing to wakaba.
>>
>>58667099
>>58666997
>>58662153

anyone who programs JavaScript professionally/seriously/on a regular basis, and has more than half a brain cell would know not to do that.

It's a complete misuse the methods involved, nothing more. Or rather, the example gives a predictable, reasonable output, given that the demonstration is completely malformed, and isn't actually intending to accomplish what it purports to.

In sum: parseInt() takes two arguments. Don't call it unless you know what the fuck you're doing.

Stupid monkey brain "omg computar language theorizers" are the only ones who take umbrage with this.
>>
File: 1484944738532.jpg (35KB, 500x375px) Image search: [Google]
1484944738532.jpg
35KB, 500x375px
>>58675298
>map silently produces garbage output when used for its intended purpose
>Stupid monkey brain "omg computar language theorizers" are the only ones who take umbrage with this.

People like you are why JavaScript still exists.
>>
>>58675359
No. It's because you're trying to 'catch-all' some idealized behavior you want to happen, inside a method that doesn't do that.

There are many ways to do 'looping' within JavaScript (see for/of loops, traditional for loops, while loops, etc. etc.)

A .map() has it's purpose, but it's not whatever OP was trying to do, not by a long shot. If you really want to use that method for some reason, break it apart into a multi-line function and specify the exact parameters you want fed into the callback, instead of dumbly calling it on one-line and taking the defaults. Idiot fucking ass pleb newbs, goddamn it.

That's all I'll say. You people are just moronic.
>>
Whats the difference between
void *ptr = ((void**)array)[0];

void *ptr = (void*) array[0];


im getting different results
>>
>>58675395
Map is for mapping functions over containers. The fact that JavaScript's map is not capable of doing this correctly epitomises the language.
>>
>>58675465
You already lied in your first sentence, by massively oversimplifying, and should stop posting. 'Container' is not even a commonly used concept in JS, so you're obviously coming from some other paradigm and don't know the slightest bit wtf is going on.

t. someone who has written JS for several employers, deployed several of my own apps myself with it, etc.

A map in JS *CAN* iterate over an ARRAY of elements and perform a specified operation (THAT YOU DEFINE) on each item of said array in sequence. It is intended for idempotent, state-less, side-effect free operations. Operations are not necessarily "functions" btw, as you idiotically asserted. The operation given to the items can be simple assignment, calls to other functions, etc.

The problem, as I already stated above, is that you are calling a function during the map, while paying ZERO attention to the other lines of code you are implicitly calling in doing so. If you want to do that, you can deal with the consequences of your own blunder, it's no one else's fault. Mapping in itself is just one thing. Now on top of that, you want it to magically intuit what arguments you want passed as parameters for each item of loop. Well sorry, but it doesn't work that way, was never meant to, and your silly example of misusing the language proves nothing. If you want to continue "programming" in this way, then fine, you'll just continue to paint yourself a buffoon.

What you're doing essentially is like saying
>"LOOK!! The code below got the letters out of order! Doesn't JS know how to alphabetize omfg wtf lulz!!?1!?! "
['a', 'b'].toString().split(',').join('c') //'acd'
>>
File: sec362.jpg (73KB, 429x750px) Image search: [Google]
sec362.jpg
73KB, 429x750px
Anyone have that picture with programming problems? Like dozens of them?
I need to practice my skills.
>>
>>58675870
http://better-dpt-roll.github.io/
>>
>>58675888
Thanks familia.
>>
>>58675751
I don't think you understand what 'map' means. The fact that JavaScript implements a broken version of this concept does not change said concept.
>>
Daily reminder to use hashmaps for everything.
>>
>>58673357

>>58673357
>>
>>58676183
I don't usually say this, but honestly, it was the first result for 'land of lisp pdf'.

ftp://ftp.micronet-rostov.ru/linux-support/books/programming/Lisp%20-%20Scheme/[No%20Strach]%20-%20Learn%20to%20Program%20in%20Lisp,%20One%20Game%20at%20a%20Time%20-%20[Barski].pdf
>>
>>58670414
wow pretty unreadable
>>
>>58676311
Read the thread.
>>
>>58675427
Did you enable some optimizations? This effect could be explained by a violation of the strict aliasing rule.
>>
>>58669697
ML
>>
>>58675427
I didn't even know the first one was legal syntax.
>>
>>58676131
why
>>
>>58677789
Because.
>>
>>58677822
Not
An
Argument
>>
>>58677836
Neither is 'not an argument' :)
>>
Learning Python by reading bassicly a textbook.

Should I keep a notebook?
Any tips?
What should I expect?
>>
>>58677850
so try again
why use hash maps for erverything
>>
>>58677886
Because I've posted the daily reminder to use hashmaps for everything.
>>
>>58677863
have you actually tried and hit a wall or do you need someone to read the book to you
>>
>>58677975
I'm 200-300 pages in and I still feel like I can't do anything
>>
>>58674741
What do you envision yourself doing at a programming job? There are better easier jobs out there for autistic people.
>>
>>58677990
You should try writing some programs.
>>
>>58677990
What do you even know? 200-300 pages of the book by John Zelle is getting towards the end where you learn about OOP.

This is why I recommend Automate the Boring Stuff - even if you don't have any interesting ideas, Sweigart gives you the ability to play around with Excel, do some minor web scraping, and write to text files at the bare minimum.
>>
How do I make a correct table with two for loops? Let's say I ask user input for number of rows and columns.

for (int row = 0; row < rows; row++)
{
int rnd = r.Next(3);
for (int col = 0; col < columns; col++)
{

if (rnd == 0)
Console.Write(" ");
else if (rnd == 1)
Console.Write("*");
else Console.Write(".");
rnd = r.Next(3);
}

Is this correct that rows come first, columns second?
>>
>>58678077
We beat this horse to death and back yesterday (or the day before?).

How in the world are you still confused?
>>
>>58678107
I went out the thread quite early, sorry.
>>
Is there some generally accepted SQL book that's considered the best for getting into whole database world?

I am learning Entity framework and i realized i really need to learn more about databases in general
>>
>>58678137
Go back and read: >>58662622
>>
>>58678143
https://www.amazon.com/dp/0321884493/
I'm not sure if it's generally accepted but this guy is pretty good at the whole "get into [x]" thing. I have his book for SQL and I've been considering buying/seeing if I can download it somewhere just to have as a reference.
>>
Trying to learn Java
All of a sudden all of my projects in my Eclipse workspace have stopped working.
If I try running them I get the error
Error: Could not find or load main class Application

If I switch to another workspace though I can run programs.
I've searched but there are lots of solutions that seem to work to resolve this error message, and none of the ones I've tried work for me.

Any solution short of manually copying all my projects into the new workspace?
>>
>>58678224
true pdf available?
>>
>>58678290
Dunno, haven't looked into it.
>>
File: e325345t.png (920B, 187x66px) Image search: [Google]
e325345t.png
920B, 187x66px
>>58678175
Okay, I'm confused because it's not in my native language. Anyway, this does what I initially wanted, I'm just trying to get better and coding, and just so that I understand this correctly, I don't put anything else in the first for loop, right? Just in the second? Because if I print 1 in the inner for loop and 2 in the outer, but after the first loop, I get this.
>>
>>58678328
Set a breakpoint, use F11 to step through your code, and look at what it does.

This isn't something anyone can really help you with. You should be able to look at that simple block and see what happens line-by-line.
>>
any web developers in here?
>>
>>58678381
>>>/wdg/
>>
In C, what's the point of unions when you can just cast shit the way you want?
>>
>>58678341
No, I know what it does, I just want to know if I'm correct in printing with two for loops. It starts with the first loop, then it goes to the second, it repeats itself x times, then the rest of the first loop happens, here is where you want to go into a new line. The first loop repeats itself n times. If you put the new line in the first loop but after the second, the second loop is going to pring one row.
How do I print the same number in one column though?
>>
if i try to learn assembly and c will i become autistic/aspergers?
>>
>>58678424
They just make it easier. Without unions, you'd have to declare an array of chars that's large enough to hold each variant and do all the aliasing with pointers yourself. This may not sound too bad, but factor in alignment and it would be a major PITA.
>>
>>58677990
>I'm 200-300 pages in and I still feel like I can't do anything

That's because you don't learn programming by reading, you learn by writing programs
>>
>>58678610
I think I don't get the "factor in alignment and it would be a PITA" part. Could you provide an example?
>>
>>58678424
>>58678610
Structs are also technically not needed since they're just a buffer that you access at certain offsets. Really, a union is just a struct where all the fields are overlapping.

That's why I'm kind of pissed about how Rust ended up handling "unsafe unions". The language already has attributes for different struct layouts, so all they really needed to do was add a new one for unions that would also make accesses unsafe and disallow fields that may be dropped. But they ended up introducing a whole new language construct instead.

>>58678637
C doesn't have a standard way to force alignment. That means you would have to pad the buffer yourself to account for it and round off pointer addresses when casting the pointers between target types.
>>
>>58678680
>That means you would have to pad the buffer yourself to account for it and round off pointer addresses when casting the pointers between target types.
I really must be missing something because I don't understand what you just said. What kind of padding and rounding do I need to do if I have the following:
typedef struct _node {
int type;
} node;

typedef struct _nodeA {
node parent;
char a;
} nodeA;

typedef struct _nodeB {
node parent;
float b;
} nodeB;

void myfunction (node *n) {
if (node->type == 0)
((nodeA*)n)->a = 255;
else if (node->type == 1)
((nodeB*)n)->b = 1.1;
}


Wouldn't it work? Why is worse than doing, say
typedef struct _nodeA {
char a;
} nodeA;

typedef struct _nodeB {
float b;
} nodeB;

typedef struct _node {
int type;
union {
nodeA nodea;
nodeB nodeb;
} content;
} node;

void myfunction (node *n) {
if (node->type == 0)
n->content->nodea->a = 255;
else if (node->type == 1)
n->content->nodeb->b = 1.1;
}


Sorry if I sound stupid, I'm very new to all of this.
>>
>>58678680
Actually, I suppose you wouldn't have to cast between pointers, because you'd make them all the address of the most aligned variant.

Still, having structs and unions makes composing aligned things together much more efficient, not to mention convenient. Otherwise, to not waste space on extraneous padding, you would have to have to compute the offsets for every different composition yourself.

>>58678835
It's fine when you can work with the data behind a pointer. But you don't always want to do this, for efficiency purposes. When you want to work with a union by value, you have to deal with size and alignment.

Just writing the code once is not that bad, I guess. But maintaining it and changing it is awful.
>>
>>58678445
So?
>>
>>58678908
>you don't always want to do this, for efficiency purposes
What's inefficient about my first example? (or why is the second example more efficient?)
>>
>>58678957
Neither of your examples is more efficient than the other since they both work behind pointers.

The second example could be changed to this, though:
typedef struct _node {
int type;
union {
char a;
float b;
} content;
} node;

node myfunction(node n) {
if(node.type == 0) {
node.content.a = 255;
} else {
node.content.b = 1.1;
}
return node;
}

Where a node can be used as a value.

Actually, because a float* can always be used directly as a char* (char will never have larger size or alignment requirements), you can change the first example to use a _nodeB by value. But this requires you to to do
*((_nodeA *)&node)
to use it as a _nodeA. And again, this assumes that the sizes and alignments will work out nicely.
>>
Is it backwards to learn to design a CPU before learning to program
>>
>>58679117
ya
>>
>>58679117
CPUs are designed to be programmed, so yes.
>>
>>58679127
Well I made a working ALU in logisim because that part interested me so I guess I have to learn backwards

How do I do that
>>
File: ProgrammingChallenges.png (302KB, 1920x1080px) Image search: [Google]
ProgrammingChallenges.png
302KB, 1920x1080px
rolling
>>
Anybody here have any experience with using genetic programming code for generation?
>>
>>58679117
No

The CPU was invented before programming
>>
>>58679195
Wrong
>>
>>58679117
Most wouldn't go that route yes.

I think you should probably keep the two fields completely separate mentally. That gap is just too large to try and gap meaningfully.
>>58679195
Computers were invented before programming. Not CPU's
>>
>>58679200
No

It's not
>>
File: device.jpg (251KB, 1598x1600px) Image search: [Google]
device.jpg
251KB, 1598x1600px
>>58679209
>Computers were invented before programming.
>>
>>58679219
And why are you presenting this modern machine in your picture? My mom used something like that.
>>
>>58679219
>>
>>58679239
I don't think that was programmable.
>>
>>58679239
To be programmable it has to be able to store and load programs
>>
>>58679249
'tis the point
>>
>>58679264
Why would it have to be able to store programs?
>>
>>58679270
Oh. Right.
>>
>>58679279
Because otherwise it's not programmable?
>>
>>58679279
>>58679314
oh store, nvm

it has to be able to load programs
>>
>>58679314
if it can execute your instructions then it's programmable.

in theory you could manually load the instructions each time and get the machine to do what you want it to do
>>
>>58679325
Anything is Turing complete with a human in the loop

>Have pile of rocks
>Arrange them to represent bits
>Move rocks
>>
>>58679325
In fact. It's not theory. You used to give computers punch cards in order which it then executed instructions from.
Arguably since it placed the programs in stacks again it stored it but it could just have dumped them on the floor.
>>
File: a_bunch_of_rocks.png (199KB, 675x1603px) Image search: [Google]
a_bunch_of_rocks.png
199KB, 675x1603px
>>58679349
Reminds me of a particular comic with no funny content in it whatsoever.
>>
>>58679325
So pressing 1, +, 1, = on a calculator is programming?
>>
Is there some kind of cheat sheet to help me remember how computer works starting from bit logics ending with application?
>>
>>58679388
computers don't work
>>
>>58679383
Someone has programmed the calculator, yes. How else would it add 1 + 1, or even know what that means?

Calculators work by following instructions.
>>
>>58679422
The calculator doesn't have to have been programmed. Even if it was, that's got nothing to do with using it.
>>
File: 1367709064020.gif (498KB, 490x270px) Image search: [Google]
1367709064020.gif
498KB, 490x270px
>Semantic
>>
nothing. Always wasting time. :(
>>
I have a full time programming job, but I'd still like to contribute to some open source projects.

Are there any that you'd recommend? I'd be most comfortable with C/C++/Python.

I can never quite decide.
>>
>>58671007
if you're still there then you should wrap the program up in an archive and maybe a wild anon will crach it or something

also the SQT thread is a better place for this
>>
is there anything useful written in Haskell?
>>
>>58675427
what is the size of an array element?
>>
>>58679510
Contribute to a Firefox fork so there's a useful and good Foss web browser that isn't Firefox
>>
>>58679680
Compilers for languages that aren't Haskell
>>
>>58679788
Also GHC.
>>
>>58679810
>useful
>>
>>58679821
Without a Haskell compiler you wouldn't be able to write compilers in Haskell for languages that aren't Haskell, duh.
>>
Trying to parse HTML with F#...

table.CssSelect("tr")
|> Seq.skip 1
|> Seq.map(fun tr -> tr.Descendants ["td"] |> Seq.map(fun td -> td.DirectInnerText) |> Seq.toArray)


Basically for each tr I want an array of the inner text of each td in it. Why is the type of this (unit -> string) [] instead of string[]?
>>
>>58679894
Maybe it's lazy?
>>
>>58679894
or maybe you need to call DirectInnerText like this ()

also you should combine your maps
fun tr -> (tr.Descendants ["td"]).DirectInnerText
>>
>>58679988
nope, toArray is eager
>>
>>58679994
>or maybe you need to call DirectInnerText like this ()

That's it! I never know what the fuck is a property and what's a function in F#...why in the name of the lord would that not be a property?
>>
new thread
>>58673352
>>
>>58680068
That's 17 posts away from the limit.

Why not make a new one and link it in both?
>>
>>58680094
>why not split the thread again?
Gee, I fucking wonder
You wouldn't happen to be the OP of this thread would you?
>>
>>58680104
The point is that it's not splitting the thread.

The other thread is about to die.
I suggested you link the new thread in both current threads.
>>
I want to learn about artificial intelligence, and make a program learn things. Something like this.
https://youtu.be/yci5FuI1ovk
What should I study?
>>
>>58680177
The point is I link that thread, we go to that thread, then that thread finishes, then we don't have two threads

baka
>>
>>58681113
New thread.
>>
>>58680237
Here, just for you:

>>58681113
>>58681139
Thread posts: 318
Thread images: 34


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.