[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: 337
Thread images: 30

File: Xamarin.jpg (59KB, 600x800px) Image search: [Google]
Xamarin.jpg
59KB, 600x800px
Old thread: >>58876553

What are you working on, /g/?
>>
>>58882828
C#
>>
>tfw to intelligent to think in paradigms
I just use what works without considering how I'm fitting into some school of thought.
>>
Xamarin is shit and you shouldn't be wasting your time with it
>>
Reading the GNU C reference manual
Better than K&R desu
>>
>>58882848
this

>>58882850
not so much this

Xamarin is bretty easy to get up and running with. That being said, I'm a total whore for Azure which made the process 10x easier for what I was doing.
>>
File: 2013-12-14 11.46.45.jpg (384KB, 1600x1200px) Image search: [Google]
2013-12-14 11.46.45.jpg
384KB, 1600x1200px
Trying to make a modular synthesizer, currently working on a GUI (basically like picrelated, but not skeuomorphic or anything -- I'm not above programmer art).
>>
>>58882828
"The most powerful programming language is Lisp. If you don't know Lisp (or its variant, Scheme), you don't know what it means for a programming language to be powerful and elegant. Once you learn Lisp, you will see what is lacking in most other languages." -Richard Stallman
>>
File: radical centrist.jpg (101KB, 500x788px) Image search: [Google]
radical centrist.jpg
101KB, 500x788px
>>
>>58882910
"I enjoy toenail sandwiches after having sex with my pet bird" - Richard Stallman
>>
>>58882910
This is coming from the same man that thinks no other language has a REPL.
>>
>>58882910
Damn, Stallman is not only a political ignoramus, but a computer science one as well. Why do we like that dude again?
>>
>>58882943

We don't. He's a meme.
>>
>>58882939
No other REPL like a Lisp REPL :^)
>>
Working on a small art toy in LOVE. Though as soon as I run it with the particle update function all particles seem to have a position of (0,0). What do?

http://pastebin.com/8DBiEdUn
Line 60 seems to hate me.
>>
File: le_army_man.png (44KB, 140x167px) Image search: [Google]
le_army_man.png
44KB, 140x167px
>>58882828
>the colour of that hand
>>
>>58877860
This is a VM for my custom architecture, and programming it is getting very complex very fast.
>>
>>58883045
Should have modeled it after the Lisp Machine architecture.
>>
In my interpreter, should I run my devices asynchronously?
>>
File: IMG_20170210_131827998.jpg (3MB, 1836x3264px) Image search: [Google]
IMG_20170210_131827998.jpg
3MB, 1836x3264px
What does g think about it??
>>
>HTML and CSS have been regarded as unpleasant to use and flawed since they were first created
>UI libraries nowadays love to make the programmer use HTML and CSS
really sets my almonds on fire
>>
>>58883240
That's because everybody knows them, not because they're good.
>>
>>58883240
>video game renderers
>inherently hardware accelerated
>can reposition elements with 0 cost
>can scale, transform, anything
>designed to fit content well on nearly every screen size and aspect ratio
>can bake vector fonts into bitmaps, do subpixel rendering, dynamically load and cache images and videos
>instead we use cpu-driven garbage 99% of the time for everything that isn't games and it's broken as shit on all but one configuration
I don't get it
>>
>>58883240
Probably because the libraries use Chromium and leak that big implementation detail.
>>
>>58883240
>>58883287
This nifty little phenomenon is called a meme btw
>>
>>58883237
Look into the Bishop book or Murphy.
>>
Apparently removing all external hardware brings down time to run the dword write loop to 9ms.
>>
File: 1477570612660.png (339KB, 1000x800px) Image search: [Google]
1477570612660.png
339KB, 1000x800px
>>58882828
L'p pdnlqj d jdph!
>>
I know this isn't, like, /dspqt/, but I have a question for you guys.
React Native, Xamarin, NativeScript or Flutter?
>>
>>58882931
I really, really like this image.
>>
>>58882972
>expecting anything other than a sandnigger
>>
What are some small Rust projects I can study if I'm still relatively new to the language?
>>
How is your progress in project euler?
>>
>>58883715
Maybe https://github.com/BurntSushi/ripgrep ?
>>
>>58883755
meme / 10
>>
>>58883715
https://github.com/jwilm/alacritty might also be interesting.
>>
A porn browser and an operating system.
>>
>>58883240
that's because web standards are faster moving than most shitty toolkits.

also CSS has advanced quite a bit, especially with flex and grid design which basically makes making quality responsive content easy. I don't think any toolkit can even compete in terms of mobile responsiveness.
>>
Noob question but how the hell do I create an empty class? When I right click on the project and go to Add it just says Existing item and New item but the tutorial says there should be Add>New File.
When I try to add a new item there is no Empty Class in the general tab.
>>
>>58883715
https://github.com/Aaronepower/tokei is relatively small
>>
>>58883822
Call it OSxxx
>>
>>58883854
Why would I want "fast moving"? Nothing has fundamentally changed about graphical UIs since the 1980s except accommodating the introduction of (a) widespread multitouch screens and (b) head-mounted displays. I don't value shit that changes all the time, I value consistency and good design.

All I want to do is write a straightforward UI, but that's a pain on this game engine. It's a pain to even compile the libraries required to parse and render the fucking HTML.
>>
What do you guys legitimately think of Xamarin Forms? Starting it going from C# in class and so far only made a hello world app.
>>
>>58883934
What the fuck is it, and, more importantly, why the fuck is it?
>>
>>58883869
Seriously, anybody? I looked up on different sources and they all point to this Add>New File from solutions pad but I can't find neither that or the Empty class template.
>>
>>58883942
What is it?: A meme
Why is it?: See above.
>>
>>58883934
Had to use it for my internship, was good when I first started, became the biggest fucking pain in the ass once i had to start downloading from rest urls asynchronously, catching stuff, or anything more complicated then single threaded, hit button make happen
>>
I still code in C. Am I outdated and irrelevant?
>>
>>58884028
no
>>
>>58884028
No. C is fast and runs well. It is also somewhat close to metal, so it is applicable to lots of stuff.
>>
>>58884028
How many levels of indirection are you on?
>>
>>58884049
I'm a three-star programmer.
>>
Best C IDE?
>>
>>58884049
i dont know man ,, like 5 or 6
>>
>>58884028
Outdated? Yes. Completely irrelevant? No, but quite a bit.
>>
>>58884028
Dude. No. I never seen but i presume there is a lot of low-level works at Chipset companies?
>>
>>58884028
>outdated
It's half a century old, so yes.
>irrelevant
No.
>>
>>58884049
>>58884064
>>58884103
>Unironically quoting memes with very little context or reason

This is pretty damn autistic even by /g/ standards.
>>
>>58884143
>complaining about memes
Welcome to 4chan.
>>
>>58884103
You are like a child. Watch this.

template <typename S>
struct any_of_impl<S, when<Sequence<S>::value>> {
template <std::size_t k, std::size_t Len>
struct any_of_helper {
template <typename Xs, typename Pred>
static constexpr auto apply(bool prev_cond, Xs&& xs, Pred&& pred) {
auto cond = hana::if_(pred(hana::at_c<k>(xs)), hana::true_c,
hana::false_c);
return prev_cond ? hana::true_c
: any_of_impl::any_of_helper<k + 1, Len>::apply(cond,
static_cast<Xs&&>(xs),
static_cast<Pred&&>(pred));
}

template <typename Xs, typename Pred>
static constexpr auto apply(hana::true_, Xs&&, Pred&&)
{ return hana::true_c; }

template <typename Xs, typename Pred>
static constexpr auto apply(hana::false_, Xs&& xs, Pred&& pred) {
auto cond = hana::if_(pred(hana::at_c<k>(xs)), hana::true_c,
hana::false_c);
return any_of_impl::any_of_helper<k + 1, Len>::apply(cond,
static_cast<Xs&&>(xs),
static_cast<Pred&&>(pred));
}
};

template <std::size_t Len>
struct any_of_helper<Len, Len> {
template <typename Cond, typename Xs, typename Pred>
static constexpr auto apply(Cond cond, Xs&&, Pred&&)
{ return cond; }
};
};
>>
>>58884159
Oh god
>>
>>58884159
I threw up a little.
>>
>>58884097
Borland
>>
>>58884097
Visual Studio :^)
>>
>>58877497
>>58877528
Are you talking about this:
https://en.wikipedia.org/wiki/Curry%27s_paradox
>>
>>58884159
I approve of this Haskell (C++)
>>
File: K&R yuki.png (350KB, 500x492px) Image search: [Google]
K&R yuki.png
350KB, 500x492px
*ponders sign extension and floating point representation methodologies*
>>
Thank you for not using an anime image
>>
File: 1466114636206.png (3KB, 136x35px) Image search: [Google]
1466114636206.png
3KB, 136x35px
So I have a header file called Buffer.hpp which contains a single templated class. It has no corresponding source file and it is included in other files, yet I noticed that gcc outputted an object file for that header/template.
How did it do that?
>>
>>58884327
Probably because the templated code needs to be generated & substituted? I don't know though, just a guess.
>>
I have minimal python knowledge. What libraries/tools should I use to build a nice looking music player? I only have 3 days to finish.
>>
>>58884375
PyQt using QML
>>
>>58884390
What about the actual audio player? Does python have it built in?
>>
File: turtle eats turle pancakes.webm (446KB, 720x404px) Image search: [Google]
turtle eats turle pancakes.webm
446KB, 720x404px
/dpt/ please send help
I'm a couple years in my informatics degree and I feel like a fool
I always just wanted to program and work on projects, learn languages
even more so after those first years but at the moments it's all theory on every subject - and math
not the least bit of what I came for
how did you make it through uni without dropping out?
>>
Could anyone recommend a good reference python book? I don't need introduction to programming or introduction to python. I'm more interested in advanced stuff you can do in python in the pythonic way.
>>
>>58884290
Read the section on floating point maths from Intel's IA-32 reference manual and get back to work.
>>
>>58884408
Yes, QMultimedia module has audio stuff.
>>
>>58884410
>I feel like a fool
yeah, because you are one.
>I always just wanted to program and work on projects, learn languages
all of which you can do by yourself. too bad you're too much of a retard to either realize this or do it on your own.
>>
>>58884424
Python 201 by Mike Driscoll might fit the bill?
>>
Basic ass Java. I feel like a baby
>>
File: turtle saves turtle.webm (2MB, 1280x720px) Image search: [Google]
turtle saves turtle.webm
2MB, 1280x720px
>>58884430
but what can I do alone besides stupid project euler shit? No one needs another tea timer app or work flow organizer app, where else can a student contribute?
>>
Finally some use for my c# knowledge
>>
>>58884410
enter any club, for sure u have many of them around. find more people that think like you, do brainstorm, come up with idea and work it out
>>
>>58884465
yep, just confirmed my suspicions about you being a retard who is simply incapable of doing or even deciding things on his own. i hope you're still relatively young, otherwise things might already be too dire for you
>>
>>58884527
ok, I guess
>>58884520
good idea

https://is2.4chan.org/wsg/1485151911010.webm
>>
>>58882931
But rust isn't OOP. It should be scala in the bottom.
>>
>>58884465
those are not turtles
>>
>>58883237
machine learning and neural net is cool. i retwatched terminator 2 yesterday and it reminded me that machines will eventually kill us all
>>
>>58884616
every tortoise is a turtle
not every turtle is a tortoise

those are turtle
>>
>>58884622
>machines will eventually kill us all
That's the only thing that gives me hope, anon!
>>
>>58884424
Effective Python: 59 Specific Ways to Write Better Python
-Brett Slatkin
>>
File: badass.jpg (58KB, 625x483px) Image search: [Google]
badass.jpg
58KB, 625x483px
>>58884647
me too strangely haha, after the movie I felt like programming in the hopes I could do something to accelerate that future
>>
>>58884436
I briefly flicked through it and it seems this is the book I was looking for. Thanks anon.
>>
What does /dpt/ think of Go and what does /dpt/ think of Go compared to python?
>>
vv  <      <                                                                   
2
^ v<
v1<?>3v4
^ ^
> >?> ?>5^
v v
v9<?>7v6
v v<
8
> > ^
vv < <
2
^ v<
v1<?>3v4
^ ^
> >?> ?>5^
v v v ,*25 <<
v9<?>7v6 ,,
v >< ""
8 ><
> > ^ ""v
>*:.>0"!rebmun tupnI">:#,_$25*,:&:99p`|^< _0"!niw uoY">:#,_$25*,@
^ < >:99g01-*+^


I can't get it to work. Any tips?
>>
>>58884730
go is my go-to
>>
>>58884647
nah we're going to become machine hybrids

we just got to figure out how segmented mind uploading so we can ditch our meat suit without dying first
>>
THE FUCK IS THIS
>>58884735
>>
In java is there a method that gets a hexadecimal string and returns an integer?
So like the reverse of toHexString
>>
File: 1486684107443.png (511KB, 836x964px) Image search: [Google]
1486684107443.png
511KB, 836x964px
>>58884797
some sissylord has been trying to be clever and get (you)s by posting inverted or flipped text
>>
I have a bean with arraylists as fields of a certain object type. How in the FUCK do I iterate over all of them after putting myFuckingBean in the session? I can't even get the empty foreach to work I keep getting
An exception occurred processing JSP page
at the line where foreach begins. What the fuck am I doing wrong?
The code goes like this.
<c:forEach items="${sessionScope.myFuckingBean}" var="entry">

</c:forEach>

This is so basic, but I've been literally pulling my hair out over this bullshit, since SO and Google have been fucking useless and no solution works.
>>
>>58884001
>Seriously, anybody?
maybe give a minimum amount of context (i.e. language, editor, etc.) and someone would be able to help you, if they want to
the indignation over not being immediately responded to isn't particularly compelling either
>>
>>58884848
>>58884797
isn't that just some gay ass esoteric language no one gives a flying fuck about
>>
>>58884903
>>58884848
>>58884797
found it
seems like it's Befunge
I was right, just some gay ass esoteric language no one gives a flying fuck about
>>
>>58884887
Nvm, got it to work by changing the bean name. FUCK Java.
>>
File: 1453443948166.png (290KB, 1000x1000px) Image search: [Google]
1453443948166.png
290KB, 1000x1000px
>>58884946
naming is Javas biglyist problem
>>
How do I bash on Windows? I needed to switch over for Photoshop and Unity.
>>
I'm doing meme challenges in a bunch of different languages. Gotta say Haskell really is the best toy program language.
>>
>>58885016
WSL, cygwin
>>
It seems the engine I would like to use for my game got rid of the collisions on it's soft body physics with the last major update. Issue is that it was integral to my game that was ridiculously simple outside of that one bit.

Would it be realistic for me (A low-level amateur but I have made shit) to learn how to implement them myself or should I just move on? They do seem rather complex. If it is realistic for me to do so: What sort of parts and concepts in particular would I be looking into to start off towards that shit?
>>
>>58885016
Install bash on Ubuntu on Windows (10)
It's easy, anon
Don't use cygwin it's outdated now.
>>
>>58885080
>collisions on it's soft body physics
I certainly hope you are applying this to virtual boobs.
>>
>>58882828
>>58882850
>>58882865
>>58883484
>>58883934
>>58883942
>>58884022
Xamarin is advertised as a way to rape the universe with your amazing iOS+Android+Windows apps. It turns out even 10 minutes into their OWN introductions they can't say with a straight face that and they inform you "about 80% of the code will be common between platforms". What the actual fuck, anyone that has any shred of real programming experience that when the guy that tries to advertise it to you says "20% has to be hand-written and self-researched" you know you are in a world of pain before you even start.
Meh, I think I'll stay learning WPF for now on XAML and C#.
It's the most advanced UI platform in the world anyway when it's coupled with Blend. The other Windows APIs with XAML aren't really new, just subsets for the mobile. I think if someone doesn't have a team of 10+ others, multiplatform is either a pain in the ass or just for very simplistic shit.
>>
Working on learning Python. Any good tutorials or tips?
>>
>>58883288
servo uses the GPU :^)
>>
>>58882828
>What are you working on, /g/?
Trying to do object-oriented programming in C.

Currently I have implemented simple one-class inheritance by doing composite objects: http://pastebin.com/F2V852x7

The next thing on the list is to figure out a way to do virtual methods.

As for polymorphism, I don't think it is any way to do this implicit and it will probably require explicit casting in order to access specific members.
>>
>>58885385
you can read the gobject code to figure out how to OOP in C, they made some nice stuff
>>
>>58885333
dive into python
>>
>>58885398
I will probably check out how they've done it at some point, but for now I'm just curious if I can come up with a solution on my own as a mental exercise.

Thanks for the tip, will definitively have a look at some point.
>>
>>58885303
I think your concerns are valid, but at the end of the day, I don't know Swift or Java, and I was able to make an application that runs fine on Android/iOS for my company. It doesn't do many things, but it does them well.

I would imagine that if you have a highly complex application to create that needs to take advantage of various native features on a given platform, then you'd have resources who are familiar with the languages used on those specific platforms.
>>
>>58883484
I use NativeScript and I like it.
>>
given numpy array of binary arrays such as:
[0,0,0,0,1]

What does exactly does the None mean in:
array[:,None]
>>
File: 1486674591204.jpg (65KB, 557x865px) Image search: [Google]
1486674591204.jpg
65KB, 557x865px
>tfw realizing I made a coding mistake during sleep
>>
>>58885520
You can use your keyboard in your sleep?
>>
>>58884607
Scala is bad, though. I know the original implies the radical centrist is in between the other two but in this one I choose to make it mean that Rust is just doing its own thing.
>>
>>58883854
>css makes quality responsive content easy
>video games don't exist
what does he mean by this?
>>
How good do you think this is going to be
https://www.amazon.com/Hardware-Hacker-Adventures-Making-Breaking/dp/159327758X
>>
>>58885080
>physics
classical mechanics
>>
>>58885587
>soft body
>>
>>58885526
>he doesn't dream in code
newfag gtfo
>>58885520
I had a really fucking weird dream about arrays once that helped me with a problem
slept like shit too
>>
>C++
Why is C++ so strict about when you can use memset? I have a class with a custom destructor that just wraps a bunch of pointers-to-shit that need destroying (interfacing with a C library).

Because of the destructor I have to initalize every one of those pointers to nullptr explicitly, memset isn't allowed as it's non-pod (possibly it only needs to be trivially copyable, not sure on the exact wording, but it's not that either due to the destructor). What a load of bullshit.

The class *is* laid out as I expect in memory, but memset invokes undefined behavior according to the standard. Total bullshit.
>>
>>58885618
java doesn't have this problem :^^^)
>>
>>58885618
>I have a class
found your problem
>>
>>58885604
Springs and elacticity are certainly not a part of thermodynamics.
>>
Why do people use the for/while loop meme when they can use the recursion meme instead?

Don't give me the performance nonsense, it rarely makes a noticeable difference.
>>
>>58885944
it'll make LISP looking code
>>
File: normiesunwanted.jpg (464KB, 1131x1600px) Image search: [Google]
normiesunwanted.jpg
464KB, 1131x1600px
Where were you when the great functional programming revolution happened?
>>
>>58885944
I use recursive merge sort for my list implementation in C.
>>
>>58885944
Because recursion is literally a meme and iteration is almost always a more natural way to solve real problems.
>>
>>58885944
Because we ALGOL, not LISP.
>>
>>58882828
w2c book OP?
>>
>>58885944
>Don't give me the performance nonsense, it rarely makes a noticeable difference.
yes it does you're wrong

>>58886114
if you use this for production code then you're retarded
>>
>>58886153
recursion can be iterative, tard.
>>
>>58884845
parseInt
>>
>>58886202
>your brain on SICP
lmfao
>>
>>58886199
>if you use this for production code then you're retarded
explain
>>
>>58885944
Because stack overflows are a thing.
>>
>>58885794
it is if you have two water balloons colliding
>>
>>58886256
an iterative process doesn't overflow the call stack.
>>
>>58886286
Exactly.
>>
>>58886199
Merge sort is fine retard.
>>
>>58886243
use quicksort. it's better in every way and it's in the standard library.
>>
>>58886291
then what are you arguing about?

https://sarabander.github.io/sicp/html/1_002e2.xhtml#g_t1_002e2_002e1
>>
>>58886326
>
quicksort([1, 2, 3, 4, 5, 6, 7 , 9, 10])

>100 iterations
Yeah nah, quicksort is shit.

Timsort is the way to go.
>>
>>58885944
you are everything that's wrong with todays programmers
>hurr I understood recursion
>better use it everywhere
fuck you
>>
>>58886338

What esoteric programming language is that?
>>
>>58886326
it is parallelized?
>>
>>58886153
You should implement a stack manually in an iteration if you are trying to mimic a tree recursion instead of linear one.
>>
File: 1486428217595.png (1MB, 1600x3226px) Image search: [Google]
1486428217595.png
1MB, 1600x3226px
>>58885303
>WPF
substituting shit for shit.

WPF is completely unmaintainable, horrible to troubleshoot, the editor is temperamental, XAML is basically a more retarded version of html/css.

Everyone I've spoken to about WPF has told me to avoid it at all costs.
>>
>>58886368
scheme
>>
Just getting into data structures in C.
It took me all day yesterday to understand and barely program my first linked list using a struct for the list itself.
I am now trying to write a doubly linked list but I'm trying to write the functions one by one and test them out because the tutorial I was following doesn't have the doubly linked lists topic covered. Aaand I'm getting some seg faults.
The following is my try at implementing the insert function to insert a node to the beginninf of the list. Is there any problem with it?

void insert(list *list, int n)
{
dllnode *node = create(n);

node->next = list->head;
node->prev = NULL;
(list->head)->prev = node;

list->size++;
}
>>
>>58886338
>he doesn't compute factorials by prime factorization
pleb
>>
>>58886357
Use a sort for integers they can run in a linear time because some of them are not use comparison.
>>
File: 1408751367381.jpg (2MB, 3504x2336px) Image search: [Google]
1408751367381.jpg
2MB, 3504x2336px
>>58886368
Lisp, the only programming language that has been endorsed by Dr Richard M. Stallman (PhD)
>>
>>58885303
This, I read the book in the OP. Anything beyond a simple one page application will have you writing a huge amount of application specific code, reinventing the wheel to make the basic shit and hacking around just to customize some control. Just choose a platform and stick with that.
>>
>>58886433
>PhD
he's honoris causa
>>
>>58886368
It's not esoteric, it historicaly proved as shit on Von Neumann computers. Nonetheless pajeets like to use it on their Arch and Apple.
>>
>>58886326
better in every way?

what if i want a stable sort?

checkmate atheist.
>>
>>58885944
>Loading the callstack for no gains

Also, just wait for all the subtle differences between (un)optimised builds if you should ever need to debug a recursive function.

Recursion is a meme.
>>
Are there any sepples codemonkey jobs?
>>
>>58886484
how is it proved shit?

lisp is just a fucking AST, it can be whatever you want it to be.
>>
>>58886488
recursions are declarative, loops are imperative
>>
>>58886484
>It's not esoteric, it historicaly proved as shit on Von Neumann computers.
explain
>>
>>58886540
fp doesn't have side effects, you can't use pointers, it is a waste of time and space
>>
https://en.wikipedia.org/wiki/Von_Neumann_programming_languages
>>
>>58886545
May as well just be replying to a bot.

Name a single tangible benefit of using recursion over loops.
"Muh elegant code" doesn't count.
>>
>>58885944
Because they use languages where recursion is poorly supported and thus have to hack around it with an "iterative" solution that is actually just trampolining a recursive algorithm and copying the boilerplate every time they need something like that.
>>
File: crookedtrump.jpg (98KB, 700x700px) Image search: [Google]
crookedtrump.jpg
98KB, 700x700px
>>58886573
Lisp is not a functional programming language.

>>58886484
>it historicaly proved as shit on Von Neumann computers.
Where are those proofs?

>>58886478
>as shit on Von Neumann computers
C clang:                        9.971914301 seconds time elapsed
C++ clang++: 5.518077517 seconds time elapsed
C++ G++: 4.659448453 seconds time elapsed

Common Lisp SBCL: 3.015000773 seconds time elapsed

Racket: 3.618877176 seconds time elapsed

Scheme Bigloo: 3.604533288 seconds time elapsed
Scheme Chicken: 7.966139806 seconds time elapsed
Scheme Gambit: 1.932229635 seconds time elapsed

Haskell GHC: 0.454930841 seconds time elapsed

OCaml: 0.747779583 seconds time elapsed
>>
>>58886603
I don't give a shit how you prefer to implement your ideas in code.
>>
>>58886632
>SBCL: 1000000000000 hours
>Rust: 1ms
get fucked nerd
>>
>>58886632
Would Trump use Haskell or Lisp?
>>
>>58886632
Ok. It's not a shit.
>>
File: bigloo.jpg (26KB, 400x276px) Image search: [Google]
bigloo.jpg
26KB, 400x276px
>>58886632
>bigloo
>>
>>58886573
the fuck does any of that have to do with the fact that lisp is literally just an Abstract syntax tree?
>>
>>58886696
he would use D with the -Wall compilation flag
>>
>>58886696
Trump isn't a pajeet to use these shit languages, he also won't install Arch instead of Gentoo.
>>
File: gommie_faget.jpg (290KB, 675x900px) Image search: [Google]
gommie_faget.jpg
290KB, 675x900px
>>58886433
Good. I'm staying away from it then.
>>
>>58886632
Yeah but hillary's shit could start WW3. And don't forget that she's way better than Trump at being crooked. That's why she got caught way less. And don't forget she was an ex First Lady and senator, do you think the cops would dare to touch her?
>>
>>58886573
>fp doesn't have side effects, you can't use pointers
Says who? Side effects and pointers are fine as long as everything remains pure i.e. side effects cannot cause a function to return something different or have a different effect given the same input. Writing referentially transparent functions is still useful for constant folding and laziness but it isn't necessary.
>>
>>58886733
Are you a scholar?
>>
>>58886618
No, it's because there's always a more efficient iterative solution.

>is actually just trampolining a recursive algorithm
Haha, plebeian.

lrn2analysis of algorithms
>>
Can someone just help me understand something for a quick second. I've taken about 5 programming classes as part of a CS program I took when I was in college the first time, and I've never heard this said before.

I'm taking a C class right now and my professor prohibits the use of else-if statements. He says that you can always rewrite else-ifs as nested if statements and it's always more efficient. What does he mean by this?
>>
>>58886763
Your professor is a moron who's never heard of branch prediction. Do him a favour and kill him with fire.
>>
>>58886727
> And don't forget that she's way better than Trump at being crooked. That's why she got caught way less.
This alone should have qualified her to be president, over an incompetent cheeto-stained clown.
>>
>>58886775
Is he really a moron or is there actually any logic behind nesting all my ifs
>>
>>58886763
else if doesn't exist in the c standard.
>>
>>58886775
I heard of instruction level parallelism.
>>
>>58886815
I don't mean elif or elsif or anything. You literally should not use an if in your else block, it should be nested in your if block.

As in, none of this
if(something) {
//code
} else if(something else) {
//code
}
>>
>>58886762
>more efficient
Recursion with TCO, non-boxed closures for delimited continuations, and placement new to put these closures on your stack is identical to doing it with an iterative producer-consumer approach when it's run, except it actually resembles a recursive definition, doesn't require you to thread all the data through yourself, and allows you to run the algorithm with any trampoline implementation and doesn't require you to rewrite the trampoline boilerplate every time.
>>
File: screenshot.png (14KB, 571x269px) Image search: [Google]
screenshot.png
14KB, 571x269px
how do I format my for loop properly to make it like pic related
I can get the inside part right just not top row and left column showing those numbers from 1 to 100
>>
>>58886719
the fuck does an AST with the question about SICP and Scheme
>>
h-hey guys im second year CS student
am I welcome here :3?
>>
>>58886842

start using likely() and unlikely(), lad.
>>
>>58886871
Post your best fizzbuzz
>>
>>58886873
probably()
>>
>>58886842
"else if" doesn't exist in the c standard. only "if" and "else"
if (...) { ... }
else if (...) { .. .}
else { ... }

is actually read by the compiler as

if (...) 
{
...
}
else
{
if (...) { ... }
else { ...}
}
>>
File: 1476722175524.jpg (692KB, 1920x1080px) Image search: [Google]
1476722175524.jpg
692KB, 1920x1080px
Safetyfags are the cancer killing programming.
>>
>>58886850
No offense but if you don't know how then you're either very new to programming, or not really cut out for the job.
>>
>>58886896
high-level programming fags are the cancer killing programming
>>
>>58886895
I understand that. I do not see how that changes what I just asked. We are NOT to use an if statement in the else block, brackets or otherwise.
>>
>>58884317
This
>>
>>58886896
Safety means better self documentation and more aggressive optimization.
>>
>>58886908
im kinda new
and I can figure it out myself I just have a deadline in 3 hours
Ive done them before but it can take time to revise thought Id ask here for a faster solution
>>
>>58886896
>>58886913
Same diff.
>>
>>58886871
you must pass the initiation rite first anon
>>
>>58886811
This is definitely wrong. He is stupid.
>>
>>58886930
More aggressive optimization means nothing when your being weighed down with bounds checking, GC, and a billion other runtime bullshit.
>>
>>58886888

but.. there is no probably()
>>
>>58886875
>fizzbuzz
whats that
>>
>>58886915
then what you said doesnt make any sense.
>>
>>58886957
Safety in general does not require extra run time checks nor GC.
>>
>>58886944
w-whats that
>>
>>58886964
>then what you said doesnt make any sense.

else {
//if statements inside here are banned by my professor
}


Does this make it more clear?
>>
>>58886842
What the hell. This obviously depends on whether the predicate *should* be checked if the "previous" predicate failed.
>>
>>58886980
see
>>58886875
>>
>>58886968
No but it's much more difficult to do it all at compile time, and when you do it just gets too restricting and retarded. Take rust for example.
If I know what I'm doing then let me do what the fuck I want to do you stupid compiler, fuck off.
>>
>>58886980
I'll tell you after you shave that fine girly butt and put on these knee socks.
>>
>>58886982
this doesn't make sense

>>58886763
>He says that you can always rewrite else-ifs as nested if statements and it's always more efficient. What does he mean by this?
>>
>>58886982
That's very weird and arbitrary. That's like banning floating-point numbers because "they're not exact".
>>
Where do you guys work?
Are you happy?
What job should I look for when I finish studying cs?
Something that pays decent and is stable not too hard but not too boring either.
Oh and what English speaking Europe city is best to live and get a job in?
>>
>>58887002
>If I know what I'm doing then let me do what the fuck I want to do you stupid compiler, fuck off.
Rust lets you do that, and once you understand ownership and borrowing it's very easy to modify your code in a way that the compiler will understand it works. Also they are working on making borrowing less conservative.

Usually borrowing problems come about because of a poorly designed API that doesn't allow you to borrow disjoint parts of a structure separately.
>>
>>58887004
b-but im a 1.9m tall thicc dude?
>>
>>58887009
Let me give a better example he gave us in class.

He said that
if(a || b) {
if(a) {

} //no else here. next if should always run
if(b) {

}
else {

}


is more efficient than
if(a) {

} else if(b) {

} else {

}
>>
>>58885080
>Would it be realistic for me... to learn how to implement them myself
Since you aren't smart enough to know the difference between it's and its, I would say no.
>>
>>58886763
4 possible reasons here:

1) You misunderstood your professor
2) Your professor dun goofed
3) Your professor is insane
4) You are both insane

You can't replicate how an if-else chain works without using the else.

That would be like trying to use switch statements without breaks, it limits you to the point you can only ever have one condition.
>>
What should I use to terminate my program myself in java?
>>
>>58885080
Why not just use the old version? There's a reason you have ten thousand different versions of direct x on your computer for each game you own. You should only release your game for a target version of your libraries for compatibility
>>
>>58887093
A gun to the head
>>
>>58887046
it's alright, you look and sound feminine and curvy enough for this
>>
>>58886960
it is with a heavy heart that i must announce that the wewlads are at it again
>>
>>58887090
We are allowed to use else, there just can't be an if statement inside of it.

Its not hard to rewrite without the else if combination, but it sure as all fuck doesn't seem as efficient. But he has a doctorate and I have an associates and I don't speak Chinese or broken English so trying to argue a point across to him is difficult. I'm just checking with you guys to make sure I'm not completely retarded here.
>>
>>58887068
i think your professor is an idiot - although I'm not sure what happens at the compiler level.

In the first example you check if a or b is true, then you have to re-check a and re-check b

In the second example if a is true, the else if and else blocks should be skipped completely.

They might compile down to something similar, but I can't imagine the first example being faster than the second.
>>
>>58887090
he's not allowed to use nested if statements you literal turboautist wtf lmao
>>
>>58887101
well first i need to be able to buy a gun
to do that i need to get money from coding
to do that answer my fucking question
>>
>>58887068
He'd be better off teaching you about compiler optimisation flags than stupid shit like this.
>>
>>58887130
No I HAVE to use nested if statements. It has to be if inside of an if, you can't use an if inside of an else
>>
>>58887160
>not being able to write better assembler than a compiler

kill yourself my dude
>>
>>58887160
I agree.
>>
What do you think the syntax in my ML should look like?

I have something like

[node /font=something-not-shite/
text
]

in my mind
>>
>>58882828
>Pajeet shilling Micros**t C#
It's poetry
>>
>>58887178
how about this
{
'font':'something-not-shite'
}
>>
>>58887171
this actually makes no sense. Your first code example doesn't behave the same way as the second. If a && b, both code blocks will execute.

int i = 0;
bool a = true;
bool b = true;

if(a || b) {
if(a) {
i++;
} //no else here. next if should always run
if(b) {
i++;
}
else {

}
//i = 2


if(a) {
i++;
} else if(b) {
i++;
} else {

}
//i = 1
>>
>>58887160
>compiler crutch
>good programmer
choose one
>>
>>58887196
Lmao, sorry, I don't want to get eye cancer when using it, mind you, it's main purpose is for UI
>>
>>58887215
define a
>good programmer
>>
File: 15826138.jpg (25KB, 480x634px) Image search: [Google]
15826138.jpg
25KB, 480x634px
>>58887301
A programmer who follows good programming practices and watches YuruYuri
>>
>>58887220
>I don't want to get eye cancer when using it
>
[node /font=something-not-shite/
text
]

>that isnt absolute cancerous dogshit eyestrain
>>
If a function does not need to make any recursive calls, is it always better to just make it a macro to save you from the overhead of function calling
>>
>>58887068
thats completely retarded
if(a){
//foo
} else if(b){
//bar
} else {
//fucku
}


is completely different to
if(a || b) {
if(a) {
//foo
} //no else here. next if should always run
if(b) {
//bar
}
else {
//fucku
}


the first snippet, if a and b are both true, will run "foo" only
the second snippet would run "foo" "bar" which is wrong.

Fucking idiot.
>>
>>58887395
No, you still make it a function but ask for inlining.
>>
>>58887395
if your function can't be inlined as a simple ternary statement it's not worth trying to make it a macro
>>
Is bash a legitimate programming language?
>>
>>58887410
>>58887416
I was curious because the linked list implementation used in the linux kernel uses exclusively macros to add, delete, and get things from the list.
>>
Java question:

Can you have a block of code without a conditional statement?
>>
>>58887432
Nope.
>>
>>58887440
Is it an intrusive list? Then it would make sense to use a macro as that way to can use the functions generically for all types that have a field for a pointer to the next element. I mean, normally you would use generics/templates for that but C doesn't have it so macros are your only option.
>>
>>58887449
Nope. If you don't have an if statement in every block of code in your program, it will not compile.
>>
>>58885944
i used recursion once when trying to implenting pseudo-threads. with shitty results ofc
>>
Honestly, if you don't know at least 1 programming language, you shouldn't be allowed into a CS program.
>>
>>58887432
The language of Bash commands is a Turing-complete programming language, meaning that if it is even theoretically possible for a given computation to be performed, then it is theoretically possible to perform it in Bash.
>>
>>58887494
He didn't say anything about Turing-completeness.
>>
>>58887487
>implying CS programs are about training well and not profit
>>
>>58887503
I said it's a turing complete programming language. It's a programming language which is turing complete. Any confusion?
>>
File: 1486466683491.jpg (66KB, 766x740px) Image search: [Google]
1486466683491.jpg
66KB, 766x740px
>>58887479
>>
>>58887487
I'd say half of CS students with a 4 year degree don't "know" a single language
>>
>>58887521
The guy who asked the question never mentioned Turing-completeness. He just asked if it was legitimate.
>>
>>58887521
It's a bash complete language because it can be executed by bash.
>>
Is this lock-free stack correct? https://sstewartgallus.com/git?p=linted.git;a=blob;f=src/ada-core/src/linted-wait_lists.adb;h=8fb0e302feeb4223d598223622f9ec967909e299;hb=4fae1b1da5d7914d55b135ef73e9c0ae503343c0

How many bit should I have for the ABA tag?
>>
>>58887536
bash also has a tab completenes
>>
>>58887536
And I said it's a programming language and it's """legitimacy""" is proven by it's turing completteness.
Next question.
>>58887557
http://www.catonmat.net/blog/proof-that-sed-is-turing-complete/
>>
>try to write good code & contribute to open source projects
>it never breaks everything & people just revert my changes
why do I suck at programing
>>
>>58887582
There are programming languages that are not Turing-complete.
>>
>>58887590
Bash is not an example.
>>
>>58887583
I edit people's pull requests before merging because I don't like their code style.

Honestly, I don't even know why I add them on as a contributor, none of their original code is left when I'm done with it.
>>
>>58887601
Your point is irrelevant though. No one needed to know it is Turing-complete. Legitimacy is not defined by Turing-completeness, either. Otherwise, C++ and Java would be considered legitimate.
>>
>>58882850
I agree with this.

I use Xamarin every day at my day job. Go with React Native if you want to target mobile (until Safari mobile supports Service Workers).
>>
>>58887627
Where is this ""legislation of programming language"" you keep referring to?>>58887627
>>
>>58887583
just fork + make something better than what they have, gain popularity, overshadow their project
>>
>>58887650
I did not refer to legislation.
>>
File: 1461609301721.gif (3MB, 300x300px) Image search: [Google]
1461609301721.gif
3MB, 300x300px
>>58887526
This is pretty true. My alma maters do the whole "don't teach a language, teach concepts" so there are more than likely a bunch of 4 year post-undergrads who don't "know" a language. Some schools teach a language as part of the curriculum from what I've read from random /g/ posts. My community college makes a point to have an entire course dedicated to C alongside or after DS&A after two semesters of CS fundamentals.

Makes me a little curious/worried about what I'm gonna do after I finish my night classes when it comes to "knowing" a language. Wish I could have done this instead of my major but wishes fishes etc.
>>
>>58887678
Where is the "legitimacy" of a programming language defined?
>>
>>58887706
It is purely subjective.
>>
>>58887680
You can teach yourself C in an afternoon and get good at problem solving in any programming language in a few weeks of practice.

You have 4 fucking years to learn a skill, and your university has no business teaching you how to swing a hammer, enjoy mcdonalds.
>>
>58887714
lol
>>
>>58887680
I'm not sure if you're saying you wished you learned a language or not but the problem with a whole program focusing on one language is you're going to graduate with the expectation that you'll find a job using Java or something when you might end up working at google with Go or end up doing .NET applications for windows based companies.

Once you know the basics of programming you can pick up a language with a reference sheet and an hour of playtime. It takes a lot longer to learn the minor points about a language obviously, but you can start producing usable code nearly right away if you're a good CS student so focusing on a single language in school is quite silly.
>>
>>58884709
I hope you're a troll and don't unironically use that pic
>>
>>58885047
define toy
you realize code is made up of code snippets right?
>>
>people actually use lisp functionally and not the way it was meant to be used, procedurally
>>
>>58887930
Lisp was created before any programming paradigms at all.
>>
>>58887930
What does that even mean? Isn't functional programming a specialized type of procedural programming?
>>
>>58887930
you do realize that they aren't in any way mutually exclusive, right?
>>58887953
no. functional programming can either be procedural or it can be POO
same with imperative programming.
>>
>>58887742
>I'm not sure if you're saying you wished you learned a language or not
I believe the anon's post that I initially responded to was that an undergrad can leave university and know the basics of programming but know nothing about the language used to learn those basics.

I know Java from using it during classes but I don't really "know" it, i.e., I have no idea what the whole AbstractBeanBeanFactory complaint is regarding Java or what Abstract Factories are. I don't know if I'll learn about it but it seems like something that gets a fair portion of usage just looking at a google search for it.

I know C# from my own practice and usage at work and home but all I know about something like
using (something) { }
allows for automatic dereferencing once usage is complete, I think? Similarly for Python where I can POOINLOO out some script but I've yet to run (or know about via anything other than my own curiosity) unit tests, yet those are considered critical for work and necessary for hobby programming.

>you can pick up a language with a reference sheet and an hour of playtime
Yeah, other languages don't look like chex mix in comparison to years ago.
>It takes a lot longer to learn the minor points about a language obviously
I guess this is what I'm harping on more than anything else. I don't really have anyone I can ask directly about all of the little things or important things that aren't part of the standard curriculum of how to do things in {lang} either at work (no one to ask) or at college, which is why I expressed regret at my original major choice/wished I could do it all over again but in CS.
>>
>>58884735
this is my favorite programming language just because of how flow is controlled. It's absolute fuckin garbage for actual use though.
>>
can't even do
           (incf (funcall
(case x (1 #'first)
(2 #'second)
(3 #'third)) acc))

in lisp, wtf
>>
>>58888293
>incf
>funcall
>#'
Found your problem.
>>
>>58888293
>(setf funcall)
What are you doing nigger
>>
>>58886052
In my bedroom eating smegma butter getting raped by rms.
>>
>>58888409
>funcall #'first acc
>0
>incf 0
>1
wow so hard
>>
>>58888458
(setf 0 1)
pls don't do that
>>
>>58888458
incf is a macro which uses setf. macroexpand it to see your error.
>>
New thread:

>>58888510
>>58888510
>>58888510
>>
beginner here
how do I make that right column appear on the left under 0 where it should be?
>>
The thread was created and linked after the bump limit. It's not hard to see this. What the fuck?
>>
New thread:
>>58888613
>>58888613
>>58888613
>>
New thread:

>>58888616
>>58888616
>>58888616
>>
>>58888521
why was this removed wtf
>>
>>58888605
It's pure autism
>>
>>58888620
>>58888626
Oh, great.
>>
I have decided to write a *nix desktop framework entirely written in Rust and Golang.

The DE will be free for buffer overflows and memory leaks.

However writing a window manager for X is not a simple task.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <X11/Xlib.h>

int main()
{
Display *d;
Window w;
XEvent e;
int s;

if (!(d = XOpenDisplay(NULL))) {
fprintf(stderr, "Couldn't open display and I hate C.\n");
exit(1);
}

s = DefaultScreen(d);
w = XCreateSimpleWindow(d, RootWindow(d,s), 0, 0, 110, 20, 0,
0, WhitePixel(d,s));
XSelectInput(d, w, ExposureMask | KeyPressMask);
XMapWindow(d,w);

while (1) {
XNextEvent(d, &e);
if (e.type == Expose) {
XDrawString(d, w, DefaultGC(d, s), 5, 15, "Can you read me?", 16);
}
}

XCloseDisplay(d);
return 0;
}
>>
>>58888521
>>58888620
>>58888626
Thanks mods, you really made the situation better
>>
>>58888620
>>58888626
We did it mods!!!!
>>
take away the tab you are printing in the for loop
>>
>>58888644
lets all create one for the lulz
>>
>>58888627
>>58888605
It was created before the bump limit you fucking retard. Can you not count?
It was reply 310, which clealy means that the thread was created BEFORE 310.
>>
File: 1449512696958.jpg (140KB, 1552x1152px) Image search: [Google]
1449512696958.jpg
140KB, 1552x1152px
>>58888620
>>58888626
>>
>>58888665
Who gives a shit that it was made a minute or two before? Consider going back on your meds.
>>
File: 129958-004-C9B8B89D.jpg (18KB, 343x450px) Image search: [Google]
129958-004-C9B8B89D.jpg
18KB, 343x450px
MODS
>>
>>58888661
ok I did that but where would I need to input stuff to fill it all out
>>
File: 146738840786.jpg (95KB, 720x720px) Image search: [Google]
146738840786.jpg
95KB, 720x720px
>>58888657
>>58888665
We have a redditor jannie who wants to delete anime from anime website.
>>
>>58888715
>>>/a/
>>
>>58888688
>Who gives a shit that it was made a minute or two before?
Get out of here you fucking newfag.
It's extremely important that the bump limit is strictly enforced, as it leads to all kind of retardation with people posting multiple threads, such as right now.
It becomes a stupid race to see who can post the earliest.
>>
>>58888750
Whatever you say, mod. You made a good decision that will be felt here for the next decade. Btw, you deleting the first caused the other two.
>>
>>58888458
Actually I was teasing you for using CL. It's a mess.
>>
>>58887570
VERY underrated post, even with the grammatical issues
>>
Hi guys. Programming noob here. How can I edit a saved program? For example, I make a program in nano, then save it. Name of the program is (program.c). I try to compile it, but the compiler tells me there's an error in in the source code. How can I edit said program?
>>
>>58890018
just open the file in nano again, then save

is this your first time using a computer?
>>
>>58890042
Hey, no need to be a dick. It was just a simple question from a newbie. We all started somewhere.
Thread posts: 337
Thread images: 30


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