[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: 320
Thread images: 44

File: manga_guide_to_calculus.png (387KB, 492x650px) Image search: [Google]
manga_guide_to_calculus.png
387KB, 492x650px
Calculus edition

Old: >>55058705
>>
File: it's a trap.png (873KB, 1275x677px) Image search: [Google]
it's a trap.png
873KB, 1275x677px
First for programming traps
>>
File: 1465700695183.jpg (80KB, 482x424px) Image search: [Google]
1465700695183.jpg
80KB, 482x424px
What are you working on, /g/?
>>
File: kaneki.png (197KB, 500x503px) Image search: [Google]
kaneki.png
197KB, 500x503px
>>55071499
Reading through K&R but not doing many exercises because I am not that good with C yet.
>>
>>55071562
>I am not that good with C yet.
Maybe that's because you've not been doing many of the exercises
>>
>>55071562
How else do you want to learn.
>>
I'm working on one of them timesink projects
>>
>>55071585
I am not understanding them.
>>
>>55071613
Well I plan on reading the book, then looking at source code then understanding it from experience. The excercises make me feel dumb and weak when i don't understand them so I feel that me being different I have to power through the book and learn that way then apply my knowledge.
Sounds like a cuck but I can't help it.
>>
>>55071627
Post some then
>>
>>55071585
Like I feel that I am not learning enough from the past section to actually make a program. I attempted them and failed miserably. Don't think I don't try anon.
>>
I just wrote fizzbuzz in Emacs lisp
(defun fizzbuzz ()
(interactive)
(let ((counter 1)
(fizz nil)
(buzz nil))
(dotimes (counter 101)
(when (not (= counter 0))
(insert (format "%s%s%s\n"
(if (setq fizz (= (mod counter 3) 0))
"Fizz" "")
(if (setq buzz (= (mod counter 5) 0))
"Buzz" "")
(if (not (or fizz buzz))
(number-to-string counter) "")))))))

It's probably shit, but my previous version was even worse.
>>
>>55071772
who cares
>>
>>55071499
I'm at work, reverse enginering 1200 lines long legacy postgresql procedure responsible for managing documents in clients office. Kill me allready.
>>
>>55071772
That died a couple months ago
>>
>>55071772
Yep
Your "let counter" is superfluous: dotimes binds it anyway, it's also the reason it starts at 0. You could also get rid of this habit of binding all of your variables at the top, then you wouldn't need that setq. In short: just _let_ it be!
>>
I just found out that based haasn (from mpv) actually knows haskell and used it frequently a few years ago
>>
>>55071499
If I want to get into AI, what language should I use? Imperative languages preferred.
How are resources vs performance for each language?
I tried to start with Prolog but after programs start getting bigger, adding just one parameter propagates too much and needs to many changes.
>>
>>55072250
use ocaml, its pretty imperative
>>
>>55072250
python because of normies
there are a lot of libraries for it as well (as well as scipy, numpy, etc.)
>>
>>55071772
>>55072119
mine:
(dotimes (n 100)
(let* ((n (+ 1 n))
(d3 (= 0 (mod n 3)))
(d5 (= 0 (mod n 5))))
(message "%s" (concat
(if d3 "Fizz")
(if d5 "Buzz")
(if (not (or d3 d5)) (prin1-to-string n))))))


Praise Emacs!
>>
TRying to make an exercise work.
I am almost finished with it and it shows me the correct time.
Currently trying to pack the condition for leapyears into my code and somehow be retarded.
So a leapyear can be divided by 4, but years which can be divided by 100 yet are not dividable by 400 no leap-year.
something like this should suffice ,no?:
((year/4) || ((year/100)&&(year/400)){
lea pyear
}
right?
sadly, java doesn't accept conditions like these, so I do not know how to express them :(
>>
File: cpp_vs_java_diagram.png (21KB, 800x600px) Image search: [Google]
cpp_vs_java_diagram.png
21KB, 800x600px
What to use for unit tests in Lua?

>pic unrelated
>>
File: ddd.jpg (36KB, 562x269px) Image search: [Google]
ddd.jpg
36KB, 562x269px
Who else uses based DDD?
>>
>>55072427
No you're wrong
>
2000/4 == 500

>
2001/4 == 500

How do you expect n/4 to be an indicator for n being divisible by 4?
You need to test the remainder of the division. In Java, it's the percent sign that does it:
2000%4 == 0

2001%4 == 1

As for java not accepting your condition, yep, I think the error is pretty clear:
ERROR: bad operand types for binary operator '&&'
first type: int
second type: int

It wants booleans for && and ||. Luckily,
(year % 4 == 0)
does yield a boolean, so your problem is solved.
>>
>>55072431

Did you already try the options listed here?
http://lua-users.org/wiki/UnitTesting
>>
>>55072544
It's the first page you get when you Google it but which of the ten should I pick? Looking for recommendations.
>>
File: 1io_original.jpg (10KB, 300x186px) Image search: [Google]
1io_original.jpg
10KB, 300x186px
I'm writing something in C++ and it's working even though I've included just header files in main.cpp. I thought I had to include the respective cpp files which have the definitions for the functions? When I do I get some duplicate definition error which doesn't make sense to me. What am I doing wrong?
>>
>>55072565
In your main.cpp you include Foo.h
and in your Foo.cpp you also include Foo.h
>>
>>55072553

That's the problem it depends on your use case and what you're comfortable with. There isn't a catchall answer. In general you should pick the library that is simplest to use and won't be too much of pita when you have the code your testing change.

Personally I found luaunit to be adequate for my small random projects.
>>
>>55072565
If your tutorial doesn't explain it, just accept that you're not meant to understand it. Given that you probably compile with a magical compile button, it is not our place to explain it on an imageboard. Just try compiling something with 3-4 files manually and google it.
>>
>>55072565
The linker will find the .cpp files for you
>>
>>55072565

Cpp files are added to the finished executable via linker. You don't need to include them to your main.cpp. As for the weird errors it is probably because you didn't add include guards to the header files.

This is most likely a way oversimplified answer
>>
>>55072621
Googling header files in general actually gave me the answer.

http://www.learncpp.com/cpp-tutorial/19-header-files/

Protip: Sometimes it's easier to solve a problem by making sure you understand the basics, than just googling the specific problem.
>>
File: captainbanana.jpg (204KB, 520x520px) Image search: [Google]
captainbanana.jpg
204KB, 520x520px
>>55072670
Good! I almost asked you the clue question: what would headers be for if you included the cpps? That would have been on point then.

>Protip: Sometimes it's easier to solve a problem by making sure you understand the basics, than just googling the specific problem.
110% agreed

Here is a random pic for your success
>>
If assembly is known to have portability issues, how come rollercoaster tycoon works on any processor that meets or exceeds requirements despite being made in x86 assembly.
>>
>>55072631
>linker will find
these webshits still dare to speak in 2016
>>
>>55072947
Because it runs on x86 processors.
>>
>>55072947
>If assembly is known to have portability issues
it doesn't
>>
>>55072956
I've been told that not every x86 program will work on all processors because some interpret the instruction set differently.
>>
>>55072974
No.
>>
>>55072962
Before x86 became dominant, there were portability problems, that's one of the reasons C was made.

>>55072982
OK, so as long as I use x86 and none of the instructions I use are obsolete, it will work on any x86 processor that's equal or greater without issues?
>>
>>55073011
t. dumb fuck
>>
>>55073038
If you're such a genius, please point out what I'm saying is wrong.
>>
>>55072982
What about SSE?
>>
>>55071499

Recommend me some good Java books for beginners to learn from /dpt/

Thank you.
>>
>>55073103
>>55073112

www.google.com/search?q=self+help+books
>>
>>55073112
http://fms.uofk.edu/multisites/UofK_fms/images/pdf/C._Thomas_Wu_An_Introduction_to_Object-Oriented_BookFi.org.pdf
>>
If I want to go into creating software for CGI and animation, what should I learn?
glsl? Why?
>>
File: image008.jpg (13KB, 439x228px) Image search: [Google]
image008.jpg
13KB, 439x228px
Do you even SIMD /g/?
>>
>>55073141
>C._Thomas_Wu_An_Introduction_to_Object-Oriented_BookFi.org.pdf
Stop being funny, this is serious

>>55073129
You could just post as well
www.google.com/search?q=404

On top of that, do you have any recommendations for the online video tutorials? Especially for Object oriented design to grasp on. Youtube free courses are a bit vague and outdated.
>>
>>55073193

Deitel then. It's good enough for Cambridge.

https://drive.google.com/file/d/0By4GdMmzUrGAWjRJYVo4NUd6WEk/view?pref=2&pli=1
>>
File: 1464632537832.png (152KB, 1948x858px) Image search: [Google]
1464632537832.png
152KB, 1948x858px
>>55073193
Pic related explains OOP design perfectly
>>
>>55073162
I use Mpir.NET (GMP fork for Windows)
>>
>>55073206
Thank you for the book, gonna read through it.

also

That wasp logo of Deitel looks high af.
>>
File: nnnnn.png (111KB, 1948x858px) Image search: [Google]
nnnnn.png
111KB, 1948x858px
>>55073214
>>
File: diy.jpg (2MB, 2100x1400px) Image search: [Google]
diy.jpg
2MB, 2100x1400px
>>55073214
>>55073331
>>
>>55073364
I don't get the Java one
>>
Does anyone know where you can read about good procedural API design? Because I keep writing shit code (imo) and want to fix it.
>>
>>55072431
>C++ vs java
>there's programmers making charts that don't understand that all C/C++ does is give you control over performance.
>>
>>55072982
You're wrong, assembly is the most un-portable language of all time. Your code will only work for that specific processor.
>>
Is there a way to use 'getch()' in C, but have a time limit? As in, only accept input for 5 seconds and then move on?
>>
>>55073602
threads (not portable)
>>
Learning Haskell senpai
at' (x:[]) 0 = x
at' (_:x) k = at' x (k-1)

Code for accessing the k-th element in a list, seems alright to me but doesn't work, why?
>>
>>55073626
For a start, it doesn't cover all cases

Empty list - at' [] _
0th item of a non-empty list - at' _ 0
>>
>>55073626
>>55073695

So for the first pattern
at' (x:[]) 0 = x
You should generalise it - the 0th item of any list is going to be the head
at' (x:_) 0 = x
>>
>>55073387
I don't think any of them make sense.
>>
>>55073602
Simplest solution would be to do a spinlock and read stdin.
#include <time.h>
clock_t startTime =clock();
clock_t currentTime=startTime;
while((currentTime-startTime)/CLOCKS_PER_SEC<5)
//5 for 5 seconds could convert this to floatingpoint if you want better precisions
{
//do your reading of stdin using char *gets(char *s) or something
if(/*condition based on input to determine if I got the input I wanted*/){
break;
}
}
//use input
>>
>>55073747
All but Java make sense to me
>>
>>55073775
Right forgot to update currentTime inside the while
so just do currentTime=clock(); once per loop. Probaby at the start of the loop. Doesn't matter to any significant extent.
>>
>>55073778
It's quite possible that your tolerance level for making sense is very low.
>>
>>55073778
It's just "everything but Java is underwhelming".
Also there should be a step before starting position which is 'goal' or something. Because As(s)embly C and C++ are obviously building something far greater than a shelf. And haskell isn't doing anything that has to do with a shelf but somehow constructed a unicorn using nothing but a blackboard and chalk.

Also the 'import everything in python' meme is so damn old. It's just dumb. Practically every language has plenty of libraries to use to similar ends.
>>
whats a project i can do in .NET to put on my resume?
>>
>>55073832
Maybe learn enough about .net to figure out what you want on your resume?
>>
Why is /dpt/ so dead?
>>
>>55072250
Python/Tensorflow
Lua/Torch

Those were used to build alphago

But programming is the easiest part, it is harder to learn the math and read the research papers
>>
File: Programming Shelves.png (952KB, 2100x1400px) Image search: [Google]
Programming Shelves.png
952KB, 2100x1400px
I've fixed it
>>
>>55074076
Why do you ask this every morning when most Americans are asleep?
>>
>>55074241
>Americans

Burger = shit.
>>
File: dos.png (153KB, 1280x1024px) Image search: [Google]
dos.png
153KB, 1280x1024px
Working on a small DOS clone. Still writing the bootloader (second stage) that gathers all of the system info.
>>
File: 1465878918154.jpg (484KB, 1280x720px) Image search: [Google]
1465878918154.jpg
484KB, 1280x720px
>>55074503
>Visual C++ 2005
>>
>>55074235
LOL us Haskell users am I right???

kys
>>
>>55074503
wow that's gotta be pretty useful
>>
>>55074530
If your interpretation of that image is that Haskell is bad, you're a moron
>>
I've been understanding Haskell, but I have some questions.

Why arguments sometimes are wrapped by () and sometimes by ()?
Also, what's the difference between [a] and a in a return value?
>>
File: vc2005.png (146KB, 1281x1024px) Image search: [Google]
vc2005.png
146KB, 1281x1024px
>>55074517
Yeah, it can output a really stripped PE Executable, which imo is much nicer than getting an ELF. I've used GCC for this shit and it's a massive pain in the arse, this just weks.

The first stage is all asm (kill me).
>>
>>55074552
I'm not the femanon you're replying to, but the interpretation is "Haskell is so deep, and you have to be so smart to use it."

It's pretentious and wrong.
>>
>>55074552
The image definitely paints Haskell in a bad light. All stages feature overly complex designs and the end result is nothing like was requested.
>>
Haskell pioneered puzzle-oriented programming paradigm. It is a language that attracts attention of autistic-but-not-bright users that happen to like to solve puzzles while programming.
>>
>>55074582
>Why arguments sometimes are wrapped by () and sometimes by ()?

what
>>
>>55074538
It's just a bit of fun. You learn a heap of cool stuff on different platforms and how to interface with hardware. Plus you get
>muh freedom
Because there's no APIs to deal with haha.
>>
>>55074582
Mostly for patterns, a pattern decomposes a single argument

[a] is a list of a
>>
>>55074605
Sorry, [] and ()

Example:
len [a] = 1
len (x:xs) = 1+ len xs

len [x:xs] gives me error and so does 1+len [xs]
>>
>>55074612

IMHO creating your own simple ISA and a CPU that implements it (in verilog), and then creating a simple OS to run on it would be cooler.

I have done only the first half of this though.
>>
>>55074612
But you are dealing with closed source hardware. Your code is being executed by a closed source firmware. This is not much more freedoms that alternatives.
>>
File: turtling.png (126KB, 795x717px) Image search: [Google]
turtling.png
126KB, 795x717px
Has programming gone too far?
>>
>>55074599
no not even that
the end result is a fairy tale, i.e. it doesn't exist and can't exist
>>
>>55074552
The image is a wink wink nudge nudge "our language is sooooo hard haha. not easy being a genius who Fucking Loves Science :P"

in reality Haskell and all ML languages are the wrong way to approach functional programming, and their userbases are 100% pretentious redditors who have no idea what they're even trying to do

they're not even homoiconic
>>
>>55074631
dude you are just going in blind? Read this
http://www.seas.upenn.edu/%7Ecis194/spring13/lectures.html
then this
http://www.scs.stanford.edu/14sp-cs240h/

(or Learn you a haskell I guess, or haskellbook)
>>
File: euphoric tip.jpg (42KB, 479x720px) Image search: [Google]
euphoric tip.jpg
42KB, 479x720px
>>55074590 >>55074599 >>55074637 >>55074641

We did it reddit! We proved functional programming is shit!
Fuck those elitist 1%IQ haskell elitists
Uploading a pic to celebrate
>>
>>55074637
You can't say that unicorns can't exist. They don't exist now, but at the rate that biological sciences are developing, I wouldn't say that at some point there won't be an engineered unicorn created out of a horse.
>>
>>55074636
wtf link this shit
>>
>>55074633
Very true, emulator programming is much more fun than OS dev, especially for smaller architectures like the GameBoy. I think Markus Persson did something like this with the DCPU.

>>55074634
Didn't think of that...
>>
>>55074661
You are not a very smart person.
Read my comment again, and pay attention this time.
I make no statement about Haskell itself, only about how the picture paints it.
>>
>JOB DESCRIPTION

>JUNIOR URBIT DEVELOPER
>REQUIREMENTS:
>EXPERIENCE WITH HOON, ARVO OS, AMES NETWORK PROTOCOL, JAM/CUE SERIALIZATION
>FAMILIARITY WITH NOCK DESIRABLE BUT NOT REQUIRED
>COMPENSATION: 150000$ WITH BENEFITS

tfw haven't learned urbit can't get a job
tfw learned java instead
no java jobs only urbit

I'm a failure? I'm a failure. A fuckin failure.
>>
>>55074667
https://fsharpforfunandprofit.com/posts/13-ways-of-looking-at-a-turtle/
>>
>>55074661
FP is good

Haskell and ML are harmful as fuck
>>
INSTALL URBIT
>>
>>55074696
>F#
>apply yourself
>>
>>55074693
what does "with benefits" mean

are they talking about sex?

Im not American so I dont understand how contracts work there
>>
File: functional_freedom.png (88KB, 675x967px) Image search: [Google]
functional_freedom.png
88KB, 675x967px
>>55074722
This means dental insurance and free catered food.
Also there are other perks.

Sadly I haven't learned Urbit, I'm not even eligible for this job...
>>
>>55074696
ah Scott Wlaschin is based
check out his talks as well, Dr Frankenfunctor and the Monadster was cool
>>
BITCOIN IS MONEY

ETHERIUM IS LAW

URBIT IS LAND
>>
>>55074722
Health insurance, dental, vision, retirement plans, free gym memberships, free-beer fridays, etc.
>>
>>55074770
wtf

what does any of that have to do with work?

especially beer....

In my country we say American programmers are lazy and arrogant, and now I know why
>>
post songs to shut up the voices that won't stop talking inside your head
>>
>>55074823
>not instituting the mental death penalty
>>
>people make a fuss about how Amlogic S912 has released specs
>thinking of buying Poodroid C2 board for hobby osdev
>everything is open goyim but just include this firmwary binary with your kernel that has no source code teehee
l0l
no wonder ARM is going nowhere, even Intel has more open firmware
>>
>>55074827
nice try, but the voices can't post on /dpt/ yet so stop trying to mess with me

just post some calming songsplease
>>
File: average dpt poster.png (147KB, 500x281px) Image search: [Google]
average dpt poster.png
147KB, 500x281px
>>55074850
This thread is for programming discussion and shitting on Java
>>>/mu/
>>
>>55074795
Some of those things are actually required.

For example, while the US doesn't have socialized health care, employers in most places must offer a health care plan to their full-time employees.

I'm not sure about retirement plans, but I'm almost positive that's required for full-time employees, but why would I work somewhere that doesn't offer one? It's commonplace.

As to the things like free food, free beer, gym memberships and whatnot, those are to attract our more highly-skilled members of the workforce. In my case, a job interview is me seeing if I want to work for that company, not the other way around.

If you have the right skills, a company will bend over backwards to 'win' your services.
>>
File: output.webm (819KB, 1920x1080px) Image search: [Google]
output.webm
819KB, 1920x1080px
>>55071544
something where I can put this in.
>>
File: 1455164976021.png (285KB, 514x500px) Image search: [Google]
1455164976021.png
285KB, 514x500px
What's the best way to make an installer binary for a Python-based program (and dependent libraries)? It would be nice if it wouldn't install more stuff than the minimum required to run the program.
>>
>>55074867
music to listen to while programming is most /dpt/-worthy than pretending to be a woman on the internet
>>
>>55074748
>Also there are other perks.

is he talking about sex?

Im not American so I dont understand how contracts work there
>>
File: code bloat.jpg (99KB, 630x655px) Image search: [Google]
code bloat.jpg
99KB, 630x655px
>>55074895
daily PROGRAMMING thread
NOT
daily PROGRAMMING tunes
>>
>>55073503
Bump?
I've only find Casey Muratoris (thanks for whoever posted to handmade hero by the way) 'write the usage code first' but it seems like something appropriate to more experienced developers who have an idea about the system they're implementing.

For instance I've decided to write my own OpenGL renderer. It's aim is very basic. You're allowed an object (mesh+texture+shader program) and deferred rendering.
i.e. the API does a drawLater(Mesh,texture,shaderprogram) call and some render() function renders it.

But I'm too uncertain of how to do that well. Because the drawLater call can either take an ordering or it can simply be in order (first drawLater call is drawn first). I just don't know how to make these decisions. And this is just an example.

So I'd like some principle to follow which leads me the right way. Or at the very least some way to figure out if an API I'm looking at is good or not.
>>
>>55074693
Just apply and see if they take you.
Like with all jobs.
>>
Guys, i have job interview for junior java developer tommorow and there will be test.
What should i spend my time improving?
>java 8
>JEE
>Spring
>hibernate
>sql and reactiveX (and other rest server shit)
>drink beer
whatcha think?
>>
>>55072340
It's ugly as fuck.
>>
>>55074926
Your looks.
>>
>>55074887
I have a similar question but I'd like to compile the python and QtGui(4) into a single executable or a single executable and a few DLL's.
>>
>>55074907
shut up shut up shut up shut up

at least have a name so I can filter you out, I will fucking kill you
>>
File: Sad-Frog-Meme-Enough-14.jpg (21KB, 600x630px) Image search: [Google]
Sad-Frog-Meme-Enough-14.jpg
21KB, 600x630px
>>55074909
Just do it!

>>55074925
b..but I don't know urbit, I'm worthless
all I know is C and Java
They say they are not interested in these technologies...
>>
>>55074939
It's got to be something he can improve

>>55074946
Back to >>>/mu/
>>
Thats not how it is supposed to work. Offer them pip instructions and you are set
>>
>>55074957
Yeah. And suggestion is not any worse than any of his.
>>
>>55074954
Apply and see if they take you. If they take you and don't train you that's their fault.

Just don't turn down a more suitable job for this job when they say 'omg anon we really want you, can we offer you your personal cumslut to sit under your desk while you work if you take this job? We will do anything to have your C expertise at our company, here's 49% of company shares up front. What? you want 60%? Fine. you get the 60% when your first week is done'

Or whatever. Have some balls.
>>
>>55074962
Presuming it's a response to >>55074941
I want a single executable. Why would I want to have users have to go through an annoying installation process?
>>
Will lurking this thread eventually make me a proper, employable programmer?
>>
Hey g, i have some problems with doing my own research and investigation.
I am not that good at english, so sorry in advance.

I want to do the following:
have an int 4557
and then pull the digits apart:
4+5+5+7 = 21
What should I look for and how do I learn to look for something I need?
>>
>>55075006
allow me to bestow upon you the secrets of /dpt/

>proper programmer
>employable programmer
pick one
>>
>>55073112
Manga Guide to Java Programming
>>
File: 1463271993622.png (339KB, 744x713px) Image search: [Google]
1463271993622.png
339KB, 744x713px
>>55074981
>omg anon we really want you, can we offer you your personal cumslut to sit under your desk while you work if you take this job

It's more like I am the one who is going to be someone's personal cumslut just to survive...
>>
>>55075006
Eventually. That's the slowpath though. Going through some learncpp or whatever basic shit and eventually working your way towards programming something you can put on your resume.

Just ask questions as soon as you have them and don't hesitate. Respect your own time more than DPT. Because most people here start shitposting because they wanna talk programming.
>>55075012
Assuming you don't want a solution directly. Look at the results of the modulus and division operations when you mod by or divide by 10.
>>
>>55075012
Yeah, why bother mentioning the programming language you're going to use.
>>
>>55075012
X%(N+1) - X%N
>>
>>55075059
oh, sorry it is in JAVA.
>>
>>55075044
>implying it won't be your dream job
>>
>>55074979
How is improving in any of listed a bad idea?
Like JEE, how is learning more of JEE a bad idea in any situation.
Do you even java? lmao
>>
File: smug_sakura.jpg (29KB, 337x404px) Image search: [Google]
smug_sakura.jpg
29KB, 337x404px
>>55075088

>He learns JAVA in 2016 instead of learning URBIT

haha what a pleb you are!
>>
>>55075088
I meant to say
>And my suggestion is not any worse than any of his.

And my reasoning is you won't get any better in just a day preparing for interview in any of areas he listed.
>>
>>55075103
>implying
>>
>>55074641
>>55074661
>>55074706
Functional programming was a mistake. Processes with message passing are a lot more powerful than lambda calculus.
>>
>>55075116
1/10 bait
Here's to (You)
>>
>>55075012
parse the int into a string
go over each char and parse it back into an int, add it to a total variable
>>
File: 1439903334301.jpg (226KB, 850x1201px) Image search: [Google]
1439903334301.jpg
226KB, 850x1201px
Does your waifu even compute?

Is your computer a waifu?

My other computer is a WAIFU !
>>
>>55075107
>In just a day
A day is a shitload of time.
Not saying you can become an expert, but improve? sure.
We are programmers man, you should be able to learn a whole new technology in under a week without a sweat.
>>
>>55074641
you are so retarded, that image is meant to give a bad image of haskell
the last section gave it away easily
>>
>>55075136
This is a terrible fucking idea
This is like the people that store bigints as strings (people actually do this)
>>
>>55075123
How is that bait? Translate lambda calculus to pi calculus and then try doing it the other way around.

The only way to do it is by inventing made up metaphors like "passing the world around" and the metaphor still falls apart for distributed computing and concurrency.
>>
>>55075157
Lambda calculus is turing complete
>>
>>55075149
You can improve your looks a lot in a day also.
>>
>>55075155
how would you pull the digits apart then
>>
>>55075155
You don't even need to turn int into a string. You get input from user as a string. Just work on that without needlessly converting it into an int.
>>
>>55075193
Obviously >>55075060 or using % and /=
You seriously can't be this retarded.
How the fuck do you thing numbers are converted to strings? Fucking magic?

Are you one of those Python programmers I keep hearing about?
>>
What should I try first after "Learning Python the Hard Way"? My interests lie in security
>>
>>55075060
>>55075235
Whoops, should be (B^(N+1) and (B^N)
>>
File: Screenshot_2016-06-14-17-18-56.png (2MB, 1080x1920px) Image search: [Google]
Screenshot_2016-06-14-17-18-56.png
2MB, 1080x1920px
>>55074823
>>
>>55075157
>lambda calculus to pi calculus
what? >>55075188 is right, you can't
>>
>>55075188
>>55075268
Processes with message passing are also Turing complete.

So is Brainfuck.

So are plain old mathematical functions on natural numbers.

The reason to use something isn't because it's Turing complete, but because it solves a problem and is good at describing programs and programming patterns.

Most programming concepts have a simple translation into processes with message passing, which do not require fictional concepts like passing the world around.
>>
Is there a list of recommended programming projects to work on?
>>
>>55074887
Anyone? Creating just a single exe with no installation would be nice too.
>>
>>55075340
Looking through this at the moment
>https://github.com/karan/Projects
>>
>>55075315
The point is you can implement Pi calculus in Lambda calculus.

The advantage of lambda calculus is that it gives the best simple but nice abstraction of computation. ("simpler" would be raw combinatorics, e.g. universal combinators)

x | λx.e | x y

The whole nature of stuff like IO monads is that the program evaluates to an IO value that describes how the program will be run. Kind of like how you could write a pure program that simply evaluates to a string of C source code, then compile & run the source code
>>
>>55075379
>Pi calculus in Lambda calculus
& vice versa, I should have added, hence why I go into the advantage of lambda calculus
>>
>>55075315
I'm not understanding your point

You are criticising lambda calculus because it's hard to use in your personal opinion. Okay?
Then you tell us to use pi calculus in its place. But that's not as powerful, so okay?

But now that I think about it, whether something is turing complete or not doesn't actually matter, seeing as no current programming language's implementation is turing complete.
>>
>>55074823
https://www.youtube.com/watch?v=4qagaaZfwXA
>>
>>55075235
this?
X%(4557+1) - X%4557

gave an error
>>
>>55075192
I think you just don't know what you're talking about. But then again, it's 4chan and it's 2016.
Im surprised /dpt/ still exist here.
>>
>>55075401
But you literally can't. Pi calculus is not turing-complete. Lambda calculus is. Non-turing complete languages can't simulate turing-complete ones.

Am I misunderstanding some fundamental thing about what you 2 are discussing?
>>
File: smuggo01.jpg (105KB, 551x600px) Image search: [Google]
smuggo01.jpg
105KB, 551x600px
>2016

>Writing a software that doesn't learn from experience

plebe-tier
>>
>>55075454
where's yours then?
>>
>>55075379
>the best simple but nice abstraction of computation
What makes it the best? The fact that you have to invent nonsense to do simple things?

>that the program evaluates to an IO value that describes how the program will be run
Then something else has to run that program.

>simply evaluates to a string of C source code, then compile & run the source code
In this case, the "something else" is a C compiler. Lambda calculus + C compiler is a lot more complex than processes.

>>55075410
>because it's hard to use in your personal opinion
No, I'm criticizing it because it requires lies and fictions. You're not really passing the world around, you're performing actions on the world.

>Then you tell us to use pi calculus in its place. But that's not as powerful, so okay?
Pi calculus is Turing complete and can implement all of lambda calculus including being able to distinguish between eager and lazy evaluation.

>>55075449
>But you literally can't. Pi calculus is not turing-complete.
As I already said, it is Turing complete.
>>
>>55075488
>Pi calculus is Turing complete and can implement all of lambda calculus including being able to distinguish between eager and lazy evaluation.
>As I already said, it is Turing complete.

It seems like I got confused then.
>>
>>55075442
1) you're using it wrong
2) I meant

X%(B^(N+1)) - X%(B^N)

X is the number
B is the base
N is the digit you want, 1 being the first
>>
File: 1463281463867.png (235KB, 422x424px) Image search: [Google]
1463281463867.png
235KB, 422x424px
>>55075477

On my hard drive.

If you ever knew how hard is it, mai boi...
>>
>>55075512
def sum_digits(n):
s = 0
while n:
s += n % 10
n //= 10
print s

sum_digits(4321)



>>55075519
sure you do you fucking weeboo
>>
>>55075488
>What makes it the best? The fact that you have to invent nonsense to do simple things?
The conciseness of the definition of the calculus, combined with the capability for abstraction which is not present in combinatrics

>Then something else has to run that program.
All programs need to be run, outside of theory

>In this case, the "something else" is a C compiler. Lambda calculus + C compiler is a lot more complex than processes.
That's not the point, the point is "PARALLEL F G H"
is a perfectly way of "running F G and H" in parallel in lambda calculus

>>55075542
I gave a function to extract an arbitrary digit in an arbitrary base, but thanks for doing his homework
>>
File: 1463270110222.jpg (60KB, 248x232px) Image search: [Google]
1463270110222.jpg
60KB, 248x232px
>>55075542
>Not believing me

As if I claimed to have something really special. Is /dpt/ so plebe-tier as to consider learning software something super special?
>>
>>55075512
>Exponentiation
Why?

#include <stdio.h>

//supposing a is positive
int main(void) {
int a;
scanf("%d", &a);

int i, result = 0;
while(0 != a) {
result = result + a%10;
a = a/10;
}

printf("%d\n", result);
return 0;
}
>>
>>55075567
>>55075549
>I gave a function to extract an arbitrary digit in an arbitrary base, but thanks for doing his homework
>>
>>55075549
>>55075569

Oh and FYI you'd need to do something like y*(10^-floor(log10(y)))
>>
>>55075569
You literally just threw a function at him without explaining your reasoning. That's barely helping the lad.
>>
>>55075569
You're welcome :^)
>>
>>55075589
He should be able to look at it and see what it does, if he can't then he can't hope to complete the task anyway.
>>
>>55073512
Can you write a good kernel in Java?
>>
>>55075512
int n = 4117;
for (int i = 1; i <= 9; i++) {
int val = n%(10^(i+1)) - n%(10^i);
System.out.println(val);
}

still wrong
>>55075542
oh this works
>>
>>55075555
sure you do.
>>
File: categorised monad 3.png (28KB, 771x287px) Image search: [Google]
categorised monad 3.png
28KB, 771x287px
>>55075012
Use this monad I invented a while ago

>>55075604
>oh this works
you don't understand the solution, do you
>>
>>55075604
^ is not exponentiation http://www.tutorialspoint.com/java/java_basic_operators.htm

It's bitwise xor
>>
>>55075555
What you have kid?
MLP that can learn how to multiply?
>>
>>55075595
Ok bud.
>>
>>55075627
Addendum: there's no pow operator in java, (but operators are a fudgy concept anyway), but you have the method Math.pow. I googled.
>>
>>55075641
>operators are a fudgy concept
Java >engineer<s actually believe this

I really like Haskell's `func` infix notation
>>
File: 1463275757922.png (207KB, 780x405px) Image search: [Google]
1463275757922.png
207KB, 780x405px
>>55075631
I have:

* MLP that gets a decent (for MLP) error rate on MNIST

* A tabular Q-learning with eligibility traces working on some basic tasks

* An evolved RNN controlled obstacle avoiding simulated robot

* Evolved triangle image approximator

I have more ideas though, will do something cooler soon.
>>
>>55071627
Then do some online C tutorial first.
>>
>>55075656
Infix notation is cancer

Prefix is notyey
>>
>>55075656
Lad I AM a lispfag, I'm trying to inslut the concept of giving certain operation a complicated “““““shorthand””””” syntax for no good reason. It just creates tension because you WANT to have operators that look pretty, but it has no actual semantics. Ok I admit I'm not native and I don't actually know whether “fudgy” actually means something in this context, but you get the point.
>>
>>55075012
int n = 4557;
int sum = 0;
while (n != 0)
{
sum += n % 10;
n /= 10;
}
>>
File: DCGAN_plus.png (596KB, 1095x611px) Image search: [Google]
DCGAN_plus.png
596KB, 1095x611px
>>55075673
>>55075686

Agree.

But the whole programming language debate is so 1990-ish.

Machine Learning >>> Programming-By-Hand
>>
>>55075673
>>55075686

x + 2*y = 3 + z^4

(= (+ x (* 2 y)) (+ 3 (^ z 4)))
>lisp will defend this
>>
>>55075701

Every lisp programmer has infix macro he may use to write down equations, if he really wants.
>>
>>55075707
>>55075686
>>
>>55075701
Yah why not? at least we know from the get go that it's basically a comparison between two numbers, without resorting to arcane conventions. I can do that, but why burden oneself? Also >>55075707
>>
>>55075726
If you seriously can't see why you would want infix operators, I hope you stick to Lisp
>>
>>55075627
int n = 4557;
for (int i = 1; i <= 9; i++) {
double val = n%(Math.pow((i+1), 10)) - n%(Math.pow(i, 10));
System.out.println(val);
}


well it works for summing, but not for getting the individual digits which >>55075542 does
>>
>>55075701
But the second one is completely unambiguous, the first one requires you to have prior knowledge of operator precedence. There's literally no reason to use the first one over the second one.
>>
>>55075738
>the first one requires you to have prior knowledge of operator precedence

The second one requires you to have prior knowledge of operator precedence
>>
>>55075542
>>55075694
Wouldn't it be quicker for large inputs to parse characters to ints and do math on those?

Example:

int sum = 4557.ToString().Sum(x => x - '0');
>>
>>55075737
>>55075585

Literally you want the EXACT ANSWER to your problem to be straight up GIVEN TO YOU. You have NO competence WHATSOEVER. Just fucking give up.
>>
>>55075734
WHY? WHY? WHY? You know there are supplementary operations that your compiler must perform in order to transform this supposedly human friendly format into something actually usable? Therefore every infix operation has a prefix equivalent, so how are infix operators in any way necessary? I don't see, show me the path, O Enlightened One!
>>
What's the best way to become codan master?

Exercises + spaced repetition?
>>
>>55075778
You're right, and that's why mathematicians everywhere never use infix operators
>>
>>55075760
?
It absolutely does not. The operator will always be applied to whatever comes to its left at the same depth.
>>
File: emerson.jpg (14KB, 280x280px) Image search: [Google]
emerson.jpg
14KB, 280x280px
Hey /g/ post some programming related videos I can watch as I eat my dinner.

Can be anything from talks, to discussions to showcases to whatever.
>>
>>55075800
Parentheses are an operator
>>
>>55075789
>we've always done it that way?
So? Why should we apply it to programs, despite the fact that it's in every way unnatural?
>>
>>55075813
are You (about right that)
>>
>>55075810
Rite, well maymayed friendo. now get out.
>>
>>55075810
oh, you're right anon, that's such a good argument, how did I not think of please kill yourself
>>
>>55075778
>You know there are supplementary operations that your compiler must perform in order to transform this supposedly human friendly format into something actually usable?
There aren't. A compiler can generate code directly from infix forms and some compilers from the 1950s did this, but compilers don't anymore because they usually parse, check, and optimize the whole file first.

>Therefore every infix operation has a prefix equivalent, so how are infix operators in any way necessary?
You can also flip that around to say there's no reason for prefix operators when you have infix.
>>
>>55075825
Played you well. Knew you (were there VSO languages actually)?

Also an analogy isn't enough
>>
>>55075776
don't know what you mean, doesn't seem to work with that equation
>>
>>55075828
>>55075830
>muh lisp metaprogramming
>w-what? brackets aren't an operator!
>>
>>55075860
you fucking retarded shit monkey cunt, that's not our problem, the problem is that yes you need to know what parentheses do but that's not comparable to memorising an entire table of operator precedences and application orders

god damn you're getting fucking reported you troglodyte
>>
File: composure.jpg (95KB, 960x720px) Image search: [Google]
composure.jpg
95KB, 960x720px
>>55075884
>>
>>55075884
Generally you're expected to know what you're doing when you program
>>
>>55075839
>>Therefore every infix operation has a prefix equivalent, so how are infix operators in any way necessary?
>You can also flip that around to say there's no reason for prefix operators when you have infix.
It answers anon's argument, that's what I wanted to do.

>There aren't. A compiler can generate code directly from infix forms and some compilers from the 1950s did this, but compilers don't anymore because they usually parse, check, and optimize the whole file first.
The parenthesed forms are still closer to the essence of the language. That's why, even in infix languages, when you metaprogram, you get presented an AST. I know there are compiler shortcuts, but they're just that: shortcuts.
>>
>>55075891
and you lost your right to engage in conversation with me you cretin, bleach your fucking throat and put us all out of the misery of participating in the same thread as you

>>55075897
again, it's not comparable.
>>
>>55075907
>closer to the essence of the language
Yeah, less abstraction.
>>
>>55075928
>less abstraction
Good point. Huge operator tables with complicated precedence rules and 100% inflexibility are a shit abstraction tho. Define a weird macro-based embedded domain-specific language if you really can't go without, but don't bake in some forced exhaustive, stupid operators list into your language, that's retarded.
>>
>>55075666
You can find all of that by typing 4 words in google.
I've wrote NN for mnist on my freshman year. It was fun, but then again, there're many tools to do it. Python is probably most supported language for ML.

RNN controlled robot may be cool, if you actually made one.

Its good that you're interested in Machine Learning tho, it's a fun path, especially now with this new Tensor Flow from google, didn't have chance to have fun with it yet.

I was in a project from ML once, trying to recognize cancer, bone illness and other stuff from x-ray photos. I left them cuz i had no time tho, it was amazing and they're still working on it.
>>
>>55075928
more abstraction isn't necessarily better
>>
Added some fancy rendering for SSHFS records
>>
>>55075963
http://www.ducksters.com/kidsmath/order_of_operations.php
>>
>>55072565
>spongeposter
>>
>>55075989
please
KILL

YOURSELF


WORTHLESS FUCKING VERMIN
>>
>>55075963
Some languages have variable operator precedence and you can make them all the same if you want.
>>
File: fnins-08-00111-g001.jpg (117KB, 453x557px) Image search: [Google]
fnins-08-00111-g001.jpg
117KB, 453x557px
>>55075965
>You can find all of that by typing 4 words in google.
Sure you can, but as it turns out even a tiny bit of math is too hard for /dpt/ dwellers

>I've wrote NN for mnist on my freshman year. It was fun, but then again, there're many tools to do it.
Tools are boring, to understand it better I wrote it competely from scratch

>RNN controlled robot may be cool, if you actually made one.
I have made one but it wasn't rnn controlled, RNN controls only simulated ones so far. But I will improve on it.

See ya later.
>>
>>55075989
lad, I know my +*^ precedence rules and I have nothing against them, but any actual general-purpose programming can't expect to have just that, see the number of operators in all of the columns in https://en.wikipedia.org/wiki/Operator_(computer_programming), it's not negligeable. Now given that the set of operations we're going to express in computer programming is open and infinite, why should we limit ourselves with such a closed set as some operators? Think of all the thinking that goes in "do I have to parenthesis in this case or is it the prefered order?" again and again, think of vectors with two kinds of products, octonions with non-associative product, etc...

>>55076002
0/10
>>
>>55076013
>tiny bit of math is too hard for /dpt/ dwellers
And that's surprising?
I come here every 2-3 months and every time i see people asking people what language to learn for their first language + people disscussing how to write better fizzbuzz + few people who actually tell what they're working on and it's usually some student level shit tier.
/g/ is shit m8. At least today. I remember a guy in 2010 who was writing graphic engine in asm in fucking notepad, and he was doing well.

Maybe i'll catch you someday here, keep improving. ML is the future, too bad im too old for this shit.
>>
>>55076049
variable scope
>>
>>55076060
>ML is the future
ML "is" always the future. Funnily enough, we never get to the point where that future becomes the present.
>>
Reminder that MLfags will be the death of us all when they develop decent programmatic programming
>>
>>55076095
But how do we stop them
>>
>>55076095
So they'll never be our death?
>>
>>55076107
By developing decent programmatic programming before them, thus ridding them of their jobs
>>
File: kszksz.png (47KB, 1280x666px) Image search: [Google]
kszksz.png
47KB, 1280x666px
>>55076095
Who gives a fuck about that man.
Im writing a whole new structure to create virtual girlfriend that will trully love me.

That's my fetish, i want to make my PC conscious so i can fuck it later.
>>
>>55076140
You will never get a virtual girlfriend so long as you program in Java
>>
>>55076153
Urgh, that hit hard.

So you're saying that if i success and my PC becomes conscious it'll think im lame because i coded it in java and never go out with me?

Fuck my life boys...
>>
>>55075776
>>55075854
yea getting nothing here
>>
>>55076166
get a bf instead. lower maintenance, better genitals
>>
>>55072947

The problem is the application can't be compiled for other ISAs. Also, unless you're calling into portable C libraries, you're going to have an OS lock in, because Linux will not understand Windows syscalls and vice versa.
>>
>>55076196
But will he say he loves me after i stick it into his usb port?
>>
File: trop.png (1MB, 1280x720px) Image search: [Google]
trop.png
1MB, 1280x720px
>>55076196
Why not get the best of both worlds?
>>
File: top.png (249KB, 358x358px) Image search: [Google]
top.png
249KB, 358x358px
>>55076215
holy fuck this got me good, im dying
>>
>>55072340
You should use (when) instead of (if) if there is no else statement, and you can assign variables when you're doing checks, because assigning a variable returns its value (just like in C). Also, (message) is a bad idea, because you'll be only able to see only one line of output.
>>
>>55076140
[spoiler]g-give me a call when you finish, brother[/spoiler]
>>
>>55071499

> writing a program to map pixels of a PNG to cells of a XML document
> realize what I'm doing is actually kind of similar to writing an interpreter or compiler kind of because I'm reading code with code

neat
>>
>>55076387
>You should use (when) instead of (if) if there is no else statement,
I know, but it's shorter and when is a macro.

>and you can assign variables when you're doing checks, because assigning a variable returns its value (just like in C).
I know but it's not necessary here, and fuck mutating bindings, it's not functionnal.

>Also, (message) is a bad idea, because you'll be only able to see only one line of output.
As it stands, I don't even see it, I have to check it in the *Messages* buffer. It's the simplest thing to do, and it was what anon was doing. (I know it doesn't honor *standard-output*) Besides, princ doesn't add a newline, and it's one function more to add it, prin1 adds the double quotes on top of that, and print adds TWO FUCKING newlines on top of that, so there's no other simple option.

Thanks for your feedback tho.
>>
>>55076481
>I know it doesn't honor *standard-output*
I think it would honor it if you ran it through emacs --batch or something, so maybe you were right.
>>
>>55076523
I happen to have its help open right now...
>In batch mode, the message is printed to the standard error stream, followed by a newline.
I think that it could mean either stderr or the file descriptor 2, but not the lisp variable *standard-output*... also the prin* explicitely mention it. Guess I'll test rn
>>
>>55076590
$ emacs --batch --eval '(let* ((standard-output (function ignore))) (message "yolo"))'
yolo

Guess that wraps it up. It would probably break code if messages started getting in the way of those who customise *standard-output* only in batch-mode, now that I think about it. Also why do I keep writing standard-output in stars even tho Emacs doesn't use this convention?

Praise Emacs!
>>
>>55076244
A reverse trap?
>>
>>55072947
It only runs on x86 Windows.
>>
File: ayy.png (46KB, 1919x1080px) Image search: [Google]
ayy.png
46KB, 1919x1080px
>>55075977
Why is noone commenting on how fancy that looks?

I also had a drawer on the left and a navigation bar at the top, but I liked your drawer better so I changed mine a bit. Looks cleaner now.
>>
>>55076733
It looks like windows 10 GUI.
It looks like shit.
>>
File: output.png (44KB, 120x187px) Image search: [Google]
output.png
44KB, 120x187px
500 triangs & 2000 candidates each. The result is pretty good, actually.
>>
>>55076679
That was almost 2 hours ago, didn't you already eat dinner?
>>
Want to learn Assembly, which books should I get?
>>
>>55076808
where can i learn to do this?
>>
>>55075977
What is this beautiful thing?
>>
>>55076808
That's pretty neat

>>55076844
Google genetic algorithm
>>
>>55076840
Programming from the ground up
>>
>>55076750
brb upgrading to Win 10
>>
>>55076861

I think the result is better due to variable transparency. During candidate generation, a triangle might have anywhere between 0 and 127 alpha value. If there's no triangle with a really good fit, it's likely to just select the triangle with the highest A value, since it'll have the least impact on the final product.
>>
What's a good microcontroller to into embedded?

>inb4 rpi
>inb4 arduino
Those aren't embedded, they are power monsters
>>
>>55077272
atmega, stm32.
Arduino isn't a microcontroller, it's a microcontroller board that contains a bunch of stuff that you can use to develop stuff for the microcontroller on the board. In a final product you wouldn't have an Arduino in there, only the Atmega, or something similar.
>>
>>55077272
MSP430

also this >>55077312
>>
C++ casting help.
I have this:
class A{ /* class shit*/ };
class B : public A{
void uniqueFuncToB();
}

How do I call the function if I store them as A pointers in a vector?
>>
>>55077272
Didn't we recently decide embedded isn't worth getting into?
>>
I'm thinkin about focusing on Java but is it true that I'm cucking myself, by whatever definition, if I do?
>>
File: 1465922029438.jpg (662KB, 1296x968px) Image search: [Google]
1465922029438.jpg
662KB, 1296x968px
>>55071499
tried to do the first example in Lua

names = {}

print("Give me 5 names!")

for i = 1, 5 do
names[i] = io.read()
end

table.sort(names)

for i, v in ipairs(names) do print("\n"..v) end


man look how fucking clean it is. Hot damn.

Why didn't Lua become the next meme language?
>>
>>55077272
I used PIC in university. Not sure how it compares in terms of features or price, but for learning it was pretty good because it has very good documentation.
>>
>>55077542
At least where I'm from, there are more/better jobs for .NET devs.

Also based on intuition/anecdote, the mid-sized companies that hire for MS platform jobs are less prone to handing your department over to pajeets.
>>
>>55077570
>lua
>pl
choose one
>>
>>55077450
Something like this?

A *a = new B();
static_cast<B *>(a)->uniqueFuncToB();
>>
>>55077450
B_instance->B::uniqueFuncToB();
>>
>>55077598
pl as in perl?
>>
>>55077570
I love Lua. There is no cuter language in existence.
>>
>>55077625
you gotta be kidding
>>
>>55077450
Why are you asking /dpt/? Are you looking for a snippet that Just Works® or do you want to do it The Right Way®? What have you tried?

>inb4 Meme® it was ironic
>>
>>55077570
python
names = []
print("Give me 5 names!")

for i in range(5):
a = raw_input()
names.append(a)

names.sort()

for i in names:
print
print i
>>
>>55077639
I'm asking what he means by "pl"
>>
>>55077674
that is me and pl means programming language
Kappa
>>
>>55077697
Lua is undeniably a programming language.
>>
>>55077697
yes Lua is a programming language.

your point being?
>>
>>55077697
Oh, so it's just a "not a real programming language" shitpost.
Carry on then
>>
Ok let's say I have a list of strings in C, and I want (for the sake of the example) to print those strings.
I have:

void printList(struct list *Top, int size){
int i;
struct list *Print;
Print=Top;
for(i=0;i<size;i++){
printf("%s\n",Print->string);
Print=Print->next;
}
}


This function just prints the first string of the list and then crashes, I suspect because the Print pointer doesn't move properly on the next elements of the list after Top.

Anyone willing to help an inexperienced guy out?
>>
>>55077702
c is a programming language, c++ also is
lua is script
if you type like talk, that is low level shit script
>>
>>55077748
you're right. sorry.
>>
>>55077761
New thread
>>
>>55077737
You should consider having the final element in your list point to NULL instead of keeping track of its size, it'll also make iterating slightly easier. Did you try running it in a debugger to see what's happening?
>>
>>55077748
you type like chinaman

also scripting is programming, you filthy parasite :^)
>>
>>55077737

void printList(struct list *Top)
{
while (Top->next) {
printf("%s\n",Print->string);
Top = Top->next;
}
}

>>
>>55077775
I have set it to null, you are right it is probably better if I build the loop based on that.

>>55077792
The thing is I don't want Top to not point on the top of the list because I use it in multiple functions, that's why I use Print.
>>
>>55077862
"Top" is a local variable to the function, changing the pointer will no take effect in the original list.
>>
>dead thread
>dead language(s)
Thread posts: 320
Thread images: 44


[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.