[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 22
File: timetocode.webm (2 MB, 1152x648) Image search: [Google]
timetocode.webm
2 MB, 1152x648
This is /dpt/, the best subreddit of /g/

Umaru-chan edition, the best of all editions.

In this thread:
r/programming
r/compsci
r/ReverseEngineering
r/softwaredevelopment

code of conduct:
no racism
no insult
no sexual harassment
no gender discrimination

wat r u working on, anon-chan ?
>>
>>52048340
You have a start position on the map. It expands into several points. When you click a point, you have to solve a programming challenge. If you succeed, it expands into more locations. Challenges are from a variety of disciplines
>>
somebody pls answer to my question
>>52048266
>>
>>52048357
going to try this out
>>
Does anyone know where I can find more information about using dynamic parallelism for minimax algorithms?
>>
I want to write my own rasterizer.
Somebody stop me.
>>
How do I into projection matrices? My goal before the year is out is to conquer the Z axis.
>>
>>52048357
>requires flash
Into the trash.
>>
>no racism
>no insult
>no sexual harassment
>no gender discrimination

This ain't tumblr, you transgender nigger
>>
>>52048436
you GNU/NIGGER
>>
>>52048420
>poetically shitposting in CURRENT_YEAR
>>
Could someone explain the basics of github to me? I know it's for sharing and collaborating but that's about it.
I made a simple script to download the images from a thread. Is that the kind of thing I should upload? I'm not very experienced/good at programming so I don't have any big projects to put on there
>>
>>52048436
>2015
>not liking niggers
stay frosty, uncle ben
>>
>>52048409
why "stop me" ?
>>
>>52048477
It's also a handy tool for version control and getting updated with new projects. Seeing other people's commits can also add to your knowledge base
>>
>>52048357
do these competition websites help finding good jobs?
>>
File: 1425505520635.jpg (201 KB, 953x988) Image search: [Google]
1425505520635.jpg
201 KB, 953x988
What language should I do Project Euler in? Nothing insane, just something nicer than python.
Requirements: Needs to handle recursion well.
>>
>>52048627
racket
>>
>>52048627
GNU/Unix
>>
>>52048627
brainfuck
>>
>>52048637
C
>>
>>52048604
If you put it on your portfolio, it doesn't hurt
>>
>>52048627
fpc Objec Pascal.
>>
>>52048653
c is shit for euler: no repl, explicit typing, no builtin arbitrary precision arithmetic.
>>
>>52048497
It's probably not very useful or practical for me to use it right now then I suppose. It would be good to look at other peoples stuff if I find something though
>>
Does a language that has all the features of Haskell but lets you do whatever you want (I mean, something similar to F#) exists?
I find Haskell annoying at times but also really interesting...
>>
>>52048725
Yes, I'm sure having a visible portfolio that employers now look at is still useless
>>
>>52048740
A portfolio showing off my zero accomplishments as I move out of beginner coding script kiddie tier stuff. When I start uni and get better I'm sure having a portfolio would be nice though
>>
>>52048751
You misunderstimate how useful a portfolio of even simple programs is
>>
Reminder: if you're not using OCaml, you don't know what you're doing!
>>
>>52048769
I'll consider setting it up then. I really haven't done anything though. I'm trying to find stuff to try and tackle though.
>>
>>52048348
>no racism
>no insult
>no sexual harassment
>no gender discrimination

back2leddit
>>
>>52048348
Fuck off, nigger-fucker. Where is the real thread not made for faggots and womyn?
>>
>>52048786
ocaml is depreciated. F# is better.
>>
>>52048769
That's true actually now I think about it. Just having a github account at all puts you above 90% of others.

Words can not explain how depressing it is to look through CV's for potential new hires and see dozens of carbon copy CV's, which hardly say more than "I did CS in university, and I like... passed it. yeh" or "I like computers i guess". My mental image is some mongoloid who did CS because he didn't know what else to do, and decided he hates it but just finished it so he can get a shitty job to earn some money. When someone even went through the effort to make a github account, it shows a glimmer of interest in actual programming.
>>
>>52048812
Even before github, irl programmers have told me even the simplest shit they did when they started was all they needed to show off in their portfolio when applying for a job before getting the job. Most common example is people telling me how they made a calculator in visual basic and got in.
>>
>>52048841
yep, that's actually pretty good going for a lot of jobs. A lot of programming jobs really aren't very hard, they just require a lot of work to do well. It just happens there's huge demand for people who can do these jobs reliably. They key word being "reliably". Hiring someone who doesn't really give a shit is most likely to just fuck up the code base, and people who are competent at what they do are not as easy to come by.

And when i say competent, I don't mean incapable of making bugs, or even people know what design patterns are or know every feature in the language they use.. Just people who can take something that is broken, and make it work again, and ideally people who can learn new stuff, take critical feedback and work well with others.
>>
>>52048888
nice quads shame about the rest of the post
>>
>>52048925
What's wrong with the rest of my post? It's totally accurate.

Quads don't lie m8.
>>
>>52048935
dunno didn't read it m8
>>
>>52048824
OCaml is better than F# is virtually every single way.
>>
>>52048946
this m8 (mate) tbf (to be fair) m8 (mate)
>>
>>52048955
t. australia
>>
>>52048955
>better in every single way
>no multicore
>no type providers
>no computational expressions
>no quotations
>no async workflow
>no god tier .NET ecosystem
>no easy native code interop
>not nearly as portable
>better in every single way

ocaml sounds like F# for peasants desu
>>
>tfw it's christmas and you're spending it alone, on 4chan shitposting in /dpt/ for the third year in a row
Back to my retail job tomorrow. Maybe 2016 will be the year I get a programming job.
>>
>>52049049
God speed anon. And happy christmas.
>>
>>52049049
don't worry man, just a few more years until we all finally kill ourselves
>>
>>52048991
>>god tier .NET ecosystem
>>>/trash/
>>
>>52049088
>any support for functional programming at all
>>>/trash/
>>
Want to get back into programming, need a project to work on that needs a GUI or some sort of object oriented approach for practice. What do?
>>
>>52049116
F#
>>
>>52049116
A text editor
>>
>>52049129
>learn another language
nah.
>>52049136
ok
>>
>>52049149
F# is literally the best
Really simple syntax too
>>
>>52048404
What do you mean by _dynamic_ parallelism? Minimax is so useless that even with a supercomputer alpha-beta beats it. Parallelizing alpha-beta is not easy as it is inherently a serial algorithm.
>>
>>52049159
I bet it is. And Go. And Lisp too, right?
>>
>>52049169
Ignore F# posters and just learn C++.
>>
>>52049169
>And Lisp too, right?
Lisp is NOT A LANGUAGE, YOU FUCKING MORON.
>>
>>52049169
Go is shit and lisps are shit.

let sum arr = arr |> Array.fold (+) 0
// sum an array
>>
>>52049049
>got a rejection email for my latest application on christmas eve
>>
>>52049259
merry christmas
>>
>>52049226
Gross.
# Sum 1 to 10
(1..10).to_a.reduce(&:+)
>>
>>52049294
>&:+
>.to_a
>"reduce"

disgusting

but mostly valid F# if you wrote a library that way
>>
File: 1447513516708.gif (11 KB, 408x408) Image search: [Google]
1447513516708.gif
11 KB, 408x408
>>52049259
I know that feel bro.
>>
Does anyone knows how to get a interpreter/compiler for Scheme?

Not common Lisp, I want to do for example
(define ayy lmao)
>>
>>52049320
I also realized I don't have to declare it as an array, so it can be reduced to
(1..10).reduce(&:+)
>>
>>52049323
that's a really cute doggy
>>
>>52049338
type 'T ``[]`` with
member self.reduce x y = self |> Array.fold x y

[|1..10|].reduce (+) 0 |> System.Console.WriteLine
>>
>>52049324
Chicken Scheme is pretty nice. It compiles to C, and has fairly large range of libraries.
http://www.call-cc.org/
>>
>>52048409
The hardware is already there and will be much faster and better than anything you can make.

>>52048417
My understanding is that they basically end up dividing your X and Y position by some proportion of Z, so things that are further away end up closer to the vanishing point. They also deal with aspect ratio.
>>
I've got a method on my MainWindow in WPF/C# that does various things within that class, but I want to call that method from another window in order to pass an object for it to do stuff with.

Obviously I can't make the method static, so how would I go about achieving this?
>>
>>52048991
ocaml has multicore through multi processing. don't confuse multi threading with multi core computing.
>>
>>52049407
Yep clearly much better.
>>
>>52049226
Meanwhile in Haskell:
sum = foldl (+) 0
>>
>>52049419
That is why you use MVVM.
>>
Im in my 2nd year of university and the only thing i can add to my portfolio is a TRON game created in c++, what do?
>>
>>52049424
Multiprocessing is very heavyweight compared to multithreading.
>>
>>52049449
If only I had the first idea about MVVM. It seems to be cool for passing stuff around, but I specifically want to be able to call methods from either side.
>>
>>52049429
yeah, a whole two lines just to take a built in generic type and add a new method to it

>>52049431
>pure functional language
get out
>>
>>52049088
don't be salty
>>
>>52049461
Source? I love Tron games.
>>
>>52049471
What's wrong with purity?
>>
>>52049480
The code is extremely bad, it was so bad i barely got a pass for it despite it being fully functional.
>>
>>52049496
He's an F# faggot
>>
>>52049424
>ocaml has multicore through multi processing.
Which is pathetic.
>>
>>52048981
t. Alberto Barbosa
>>
>>52049419
What's the problem? just have a public method in the second window and call it from the first window.
>>
>>52049531
alberto barbosa isn't even a common portuguese name, retard
>>
let fold f z (a : 'T array) = Array.fold f z a
[|1..10|] |> fold (+) 0 |> System.Console.WriteLine
>>
>>52049582
>System.Console.WriteLine
not
>printfn "%i"
>>
>>52049582
>F# requires you to redefine standard library functions to get currying
Holy shit.
main = print . foldl (+) 0 $ [1..10]
>>
>>52049463
why ? multi processing is best for distributed computing.
>>
>>52049532
I do.

But
A. The method isn't static
B, The window isn't the owner of the other window

I can call a method down, but not up.

When I double click on the second window, I want the object I just double clicked on to be passed to the method in the main window and then it does a bunch of things.

I can't think of any other way to get this logic to work.
>>
>>52049497
Do you not code in your spare time or something?

That's like an artist only drawing when they have a uni assignment. You'll end up being terrible and unable to find a job.
>>
>>52049582
#!/usr/bin/env python
sum(range(10))

Why are you still posting?
>>
>>52049604
no, fold (for arrays) isn't in the main namespace
it's Array.fold

all that is just to save me typing Array.fold
>>
>>52049497
Fully functional, or fully "functional"?
>>
>>52049621
So what's up with this eta-expansion?
>>52049226
>>
>>52049582
that's so fucking ugly, god damn.
even worse than fucking Go Lang.

I'd never use F#.
Never.
>>
>>52049617
>A. The method isn't static
good
>B, The window isn't the owner of the other window
doesn't need to be. The main window just needs to have a reference to the second window.

>I want the object I just double clicked on to be passed to the method in the main window and then it does a bunch of things.
the main window needs to have a reference to you secondary window, and your secondary window need to have an event that the main window can subscribe to, which fired when that button is clicked and returns that object with it.

Look up .NET events.
>>
>>52049619
let range x = [|1..x|]
let sum x = x |> fold (+) 0

sum(range(10)) |> ignore

>>52049633
it's entirely possible that I want to sum an array again without doing the same fold
f# curries
Array.fold((+))(0)([|1..10|])
>>
>>52049259
you need more buzzwords and lies in your resume
>>
File: 1448940022844.jpg (42 KB, 512x288) Image search: [Google]
1448940022844.jpg
42 KB, 512x288
>>52049648
>Array.fold((+))(0)([|1..10|])
>>
>>52049637
The beauty of F# is you don't need to write it that way. Functional workflows are just a tool. You can also write it as:
[1 .. 10]
|> Seq.sum
|> printfn "%s"
>>
>>52049657
Array.fold (+) 0 [|1..10|] doesn't really show the point
>>
File: 1448915309686.jpg (28 KB, 499x499) Image search: [Google]
1448915309686.jpg
28 KB, 499x499
>>52049648
>Array.fold((+))(0)([|1..10|])
>>
>>52049667
printfn "%i"

rather
>>
>>52049675
>>52049670
>>
>>52049424
More importantly, ocaml is getting true multicore support in a few days. All code that uses LWT or async will automatically become multicore.
>>
>>52049729
then it will just need all this shit:
>>52048991
>>
>>52049729
>async isn't already multicore
>>
so what are you guys actually working on, aside from shitpotsing about f# meme
>>
>>52049781
learning F#
>>
>>52049781
nothing. I'm chronically i'll for the past 3 months. Not been able to do much coding in that time :/
>>
>>52049781
Monads
>>
learning python , the tutorial I am doing has me using print a lot , is there I way I can make print a var so I dont have to keep typing it as much? and yes I am that lazy I dont want to type print 40 times , I rather type 1 or some nonsense. I tired 1 = print and 1 = "print" and it did not work.
>>
>>52048991
>>no multicore
Soon
>>no type providers
First-class modules + functors are a much more powerful version of that (strict superset).
>>no computational expressions
Monad functor is this.
>>no quotations
Actually quotation. Was implemented as part of the extension point update. From what I understand, it's much more powerful than F# quotation since it can be manipulated by code on top of that.
>>no async workflow
Literally async
>>no god tier .NET ecosystem
>wanting bloated, slow garbage getting in the way
>wanting any foreign ecosystem beside the C one
>>no easy native code interop
>what is ctype
>>not nearly as portable
I'd say the opposite is true since there is no good non-M$ implementation of the .Net framework outside windows, yet the OCaml bytecode target can include the environment needed to run standalone on a multitude of platforms.
>>better in every single way
I rest my case.
>>
>>52049781
Studying a dead library written for a dead language so I can write a shitty video game on it.
>>
>>52049781
learning PHP
>>
>>52049670
>the point
Which is?
>>
>>52049861
stop learning python
>>
>>52048627
>Needs to handle recursion well.
Prolog
>>
>>52049774
Async is concurrent but not multicore because OCaml currently doesn't support multicore concurrency.
>>
Verilog or vhdl?
>>
>>52049872
Atari?
>>
>>52049226
This is also valid verbatim in OCaml. ML pride worldwide.
>>
>>52049882
As that is good advise I want to be that asshole at my work place who knows python. All the other nerds know useful shit.
>>
>>52049891
Why not though?
>>
>>52049338
(1--10) |> Array.reduce (+) 0
>>
>>52049861
no
thats like saying you're too lazy to type out "for" or "if"..
>>
>>52049916
They use a global lock for the GC and runtime (for better single core perf)
>>
>>52049916
Reentrant mutlicore parallel GCs are ridiculously complex. The great majority of languages surprisingly don't support multicore for the same reason unless they're built around a framework that already has that support, like the jvm or .net.
>>
>>52049951
for and if are short , print is long , I am lazy , so I will take it as a no and go type alot ,
>>
>>52049981
>>52049983

GC really does ruin everything
>>
>>52049781
Just set up github and uploaded my script to download images from threads
>>
>>52049996
Yet at the same time they make everything so much better. Stupid sexy GC.
>>
>>52050000
Nice quads!
>>
Does someone mind spoonfeeding me?

I don't understand how events work, and tutorials don't seem to be helping all that much.

I want to pass an object in my event but I don't really understand the "object sender, EventArgs e" thing. I want to send an object in that event, but I have no idea how it works.

I've been avoiding like the plague in my few weeks of programming, but now I have to do it and it's just not making any sense.
>>
>>52049996
Unless you're using a language with sufficient typing to control sharing/aliasing.
>>
>>52049996
Back in the 90s OCaml basically had the fastest GC around, but now it's shit tier because cpus went with horizontal scaling (i.e moar corez) instead.
>>
File: 1448702747822.png (415 KB, 1000x1400) Image search: [Google]
1448702747822.png
415 KB, 1000x1400
>>52050000
Dang, have a Twingo
>>
>>52049996
>>52050038
Then, it only ruins performance instead of functionality.
>>
>>52049861
python pisskids everyone

but can't you do something like

pr(foo):
print(foo)
>>
>>52050048
MERCI TWINGO

also merry christmas
>>
>>52049870
>First-class modules + functors are a much more powerful version of that
explain please. I'm interested.

>Monad functor is this.
So you can write ocaml in a code block, and have that specific code compile to GPU code and execute?

>since it can be manipulated by code on top of that.
Interesting, but how so? A quotation in F# is just sugar for creating an AST.

>Literally async
from what i can see you can't write this kind of code in ocaml
async {
let! dlString = downloadStringAsync "http://muhsite.org/file.txt"
let ints = JSONConvert.deserialise<int list> dlString
do! writeToFileAsync "muhFile.txt" (ints |> Seq.sum |> string)
do! uploadToServerAsync "ftp://muhsite.org/file2.txt" (ints |> Seq.max |> string)
printfn "all done"
| |> Async.start


>I'd say the opposite is true since there is no good non-M$ implementation of the .Net framework outside windows
Mono is actually pretty great and runs on Windows, OS X, Linux, Windows Phone, Android, iOS, Watch OS, PS4, PS Vita, 3DS, Xbox 360, Xbox 1 and others.
>>
>>52050072
def pr(foo):
print(foo)
>>
>>52049981
LOL, .NET has a global GC lock and GC works just fine across multiple cores. ocaml devs are just lazy.
>>
>>52050084
i'd assume that you'd use bind, return, etc, probably with an operator rather than using all those let! and do!

f# workflows are monads, it's just some syntax to save time
>>
>>52050091
p = lambda x: print(x)
>>
>>52050116
>it's just some syntax to save time
That's my entire point. Features that save time and make code more readable are nice.
>>
>>52050133
https://msdn.microsoft.com/en-us/library/dd233182.aspx
>>
>>52050000
>doesnt post script nor the git

k
>>
>>52050150
?
>>
>>52050158
Didn't think it was that useful as I'm still pretty much a beginner

https://github.com/MegaToastt/4chan-image-scraper
>>
>>52050150
Good lord, what the fuck. How can you justify this when a monad instance categorically (heh) should be able to get away with only return and join/bind?
>>
>>52049772
yeah, f# totally not missing the most intersting features of ocaml, amiright ? (modules, polymorphic variant types, high performances, ...)
>>
>>52050102
>LOL, .NET has a global GC lock
No it doesn't.
>>
>>52050182
they aren't /just/ monads but you can use them for monadic operations

>>52050178
it shows the relation between workflows and using functions manually (any function could be an operator)
>>
>>52050183
>modules
it has modules i think you'll find
>polymorphic variant types
granted
>high performances
F# has this. You can hardly claim high performance when it doesn't even support multi core threading.
>>
>>52049861
you can in python 3, yes
none of these idiots was able to answer this: >>52049882 >>52049951 >>52050072

/g/ surely knows a lot...
>>
>>52050185
no? My understanding what that all threads are frozen during GC events in .NET, which is what i gather a global GC lock is. Am i mistaken?
>>
>>52050228
>You can hardly claim high performance when it doesn't even support multi core threading.
that's why ocaml is faster and has a lesser memory consumption.
>>
>>52050241
>you can do it
>doesn't provide answer

talk about being an idiot.
>>
>>52050228
ocaml can often produce faster code
saw some benchmarks
normally it's like 20% or something, but it can get quite high
>>
>>52050253
>OCaml is faster because it doesn't support threads
Not that F# babby but seriously?
>>
>>52050253
>that's why ocaml is faster
BWAAAAHAHAHHAA
>>
>>52049996
learn Go then come back to say that
>>
>>52050262
>>52050265
ocaml utilises single cores really well and doesn't need to care about other shit that can affect performance (work distribution, locking, cache coherency)

f# is a better language tho
>>
>>52050241
Oh I am using python 2.7 , following the learnpythonthehardway how to.

First "real" programming language so kinda noobish. I know bash scripting but that is not real programming.

The answer would be appreciated : D
>>
>>52050255

>>52049861
>>is there I way I can make print a var so I dont have to keep typing it as much?

>>52050241
>you can in python 3, yes


>not an answer
/g/ surely knows a lot... see, /g/ is not even able to follow simple logic, let alone do something useful
>>
>>52050303
>python
>real programming language
>bash scripting not real programming

bash is a better programming language
>>
>>52050295
>work distribution, locking
Responsibility of the application.
>cache coherency
Entirely orthogonal issue, unless you're talking about false sharing. In that case, I don't see how either F# or OCaml will definitively help you as opposed to a MMM language (C, C++).
>>
>>52050323
bash is a meme
>>
>>52050262
>>52050265
http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=ocaml&lang2=fsharp
>>
>>52050179
If you want to improve upon it you can use the 4chan API. Instead of asking the user to input a whole URL you can ask for a thread ID.
>>
>>52050342
and python is shit
>>
>>52050345
I wasn't disputing it. Claiming that it's faster BECAUSE it doesn't support multithreading is just silly.
>>
>>52050265
He's right
OCaml:                          0.747779583 seconds time elapsed
F# Mono: 4.429195035 seconds time elapsed
>>
>>52050256
>20%
That's shit. If I want to start optimising F# for performance I can immediately blow the doors off ocaml by using multiple cores. Or using structs. Or pointers. Or SIMD. Or using unbound checked arrays. Or pulling in native code easily. Or having the entire .NET ecosystem to lean of for good libraries.

In any case both F# and ocaml are both built for safety of productivity. If performance is really important you should use C, but it you want good bang for buck performance on time constricted projects then F# and ocaml stand to be faster than C since they can be written faster, and give programmers more time for optimisations or adding more features. In this sense F# provides more productivity features and more opportunity for optimisation.
>>
>>52050345
http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=ocaml&lang2=go
>>
>>52050353
I assume he meant it's faster because it doesn't have to worry about certain multithreading issues or delays

with a big enough (optimizable) workload I'm sure f# would always win out
>>
>>52050379
>it doesn't have to worry about certain multithreading issues or delays
>>52050329
>>
>>52050345
>benchmarksgame
you realise those tests are completely arbitrary right?

It's literally like trying to get 2 anons to find out if PHP is faster than Java by getting both to write a prime number finder in both languages. Maybe the PHP developer is hot shit, and the Java guy is retarded and both language perform similarly on benchmarks. Would that convince you PHP was as fast as Java? That's what benchmarksgame is.
>>
>wat r u working on, anon-chan ?
First project in python to batch adjust the volume of video files to be nearly the same.
Its going pretty well, more successful than any other project iv attempted anyway.

What do you guys listen to when you program?
Iv found a few chill instrumental radio stations on google music that are working pretty well.
>>
>>52050370
What's the test?
>>
File: 1448728866428.jpg (848 KB, 2048x1536) Image search: [Google]
1448728866428.jpg
848 KB, 2048x1536
>>52050410
Initial D Eurobeat playlist I made
>>
>>52050405
>OCaml beating F# in everything
>IT'S JUST A FLUKE GUYS STOP BULLYING ME
>>
>>52050405
anyone can contribute, if you can write a faster program then do it or accept that the implementation of your programming language is slower.
>>
How do I combine my F# with my D to create the ultimate super language?
>>
>>52050457
Make the bridge in Go.
>>
what do i do if i want to copy base pointers that themselves inherit? clone comes to mind

struct GUIComponent : GUIPositioningBase<GUIComponent, GUIElementObject>
{
protected:
virtual GUIComponent* clone() const = 0;
};


struct GUICustomBackground : GUIComponent
{
GUICustomBackground(const vec2 &size, const vec2 &corner, uint theme, const vec4 &color)
: GUIComponent(size, color)
, m_theme(theme)
, m_corner(corner)
{ }
protected:
GUICustomBackground* clone() const { return new GUICustomBackground(m_size, m_corner, m_theme, m_color); }
};


but i also need to copy the shit that GUIComponent inherits. i can make a method in GUIPositioningBase to copy values or another constructor which passes this to base, but both solutions look bad.
>>
>>52050373
>If I want to start optimising F# for performance I can immediately blow the doors off ocaml by using multiple cores.
No you can't because fork() doesn't have much overhead over threads (on sane operating systems), and ocaml can utilize multiple cores just fine by forking + shm. And ocaml's better native code gen will more than enough make up the edge starting threads have over starting processes.
>>
>>52050457
insert the D from your F# in your A
>>
>>52050480
What you're doing is just about all you can do.
>>
>>52050439
look at the source code. The pi digits ocaml one uses an ocaml gmp library, while the F# one uses native interop to hook into a native code gmp library. They couldn't be more different.

The other ones after look like the ocaml was copy pasted to F# with the minimum changes made to make it work, and nothing done to optimise for F# language features.

>>52050451
>if you can write a faster program then do
What would the point be? Would that convince you personally that F# was faster? Are you that dumb?
>>
>>52050500
i could actually separate GUIComponent into a final base and then composite it into another object that inherits from GUIPositioningBase and has proper copy-constructor(which calls clone) but that once again adds more text.

i wish we could use virtuals in copy-construction.
>>
>>52050457
Pull out your D and F# yourself in the A
>>
>>52050241
>we aren't experts on one of the worst, least interesting languages in existence so we don't know anything
>>
>>52050571
Well, the thing is that if you're using polymorphism, you have to be using a pointer or reference. So copy construction doesn't really make sense, anyways.
>>
>>52050312
the autism is strong in this one

since i have to spell it out for you: >>52049861 wants to know HOW to do it
>>
>>52050571
>i could actually separate GUIComponent into a final base and then composite it into another object that inherits from GUIPositioningBase and has proper copy-constructor(which calls clone) but that once again adds more text.

C++ everybody

>i wish we could use virtuals in copy-construction
how would it know what constructor to call?
>>
>>52050532
>Would that convince you personally that F# was faster?
yes. otherwise, how would you convince me if you can bring on a faster program ? i only trust empirical evidences.
>>
>>52050596
presumably through wizardry
>>
>>52050585
1. he didn't ask how
2. even that noob knows how to do it, you fucking useless retard
>>
>>52050602
And if I wrote some PHP code that beat of some of the Java tests on that site, would you beleive PHP was faster than Java too?

If a 12 year old girl beat a 30 year old man in a 200m race, would you believe 12 year old girls were faster than 30 year old men?
>>
>>52050615
i have yet to reach 30 so i know nothing of wizardry
>>
>>52050628
if you can provides faster implementations for MOST of the benchmarks, then yes.
>>
why doesn't my program compiler?

#include "printf.h"

int main(vhar *argc, char *argv) {
printf("hi");
return 0;
}


it's in C
>>
File: 1415785682446.jpg (111 KB, 768x1024) Image search: [Google]
1415785682446.jpg
111 KB, 768x1024
>>52050655
>vhar *argc
>vhar
>>
>>52050655
>vhar
Should be varchar.
Also, you forgot to include <windows.h>
>>
>>52050084
First class modules are collections of types, functions and data that can be manipulated by code as any other object.
Functors are basically module-to-module transformers.
By applying a functor on a module, you get another module. This operation can be performed entirely in code to obtain a much more flexible version of a type provider. Just like type providers, the package delivered can change based on program logic, right down to types. Functors can be used for dependency injection, or to fill in skeletons for a method, or as pseudo-mixins. It's a superset.

>So you can write ocaml in a code block, and have that specific code compile to GPU code and execute?
Yes, just apply the monad functor to your module as a mixin.

>Interesting, but how so? A quotation in F# is just sugar for creating an AST.
I don't know the details exactly, I haven't played too much with it myself.
>>
>>52050655
I have no vdea
>>
>>52050655
Good one anon
>>
>>52050655
>#include "printf.h"
>"printf.h"
lolwat
>>
>>52050256
In a lot of cases, ocaml is around 2x-5x faster than the equivalent F# code. I saw a benchmark for digit classification, and the ocaml code was 3x faster than the equivalent F# for example.
>>
File: 1424476065145.gif (21 KB, 255x150) Image search: [Google]
1424476065145.gif
21 KB, 255x150
>>52050620
>>
File: 1426883219584.png (261 KB, 500x500) Image search: [Google]
1426883219584.png
261 KB, 500x500
>ICustomer
>CustomerImpl

Why the flying fuck do people still do this shit?

Of all Java conventions, this is by far the most retarded and unnecessary one
>>
>>52050228
It's not the existence of module, it's what a module IS in ocaml, which is vastly different than in any other language.
>>
>>52050726
>A cargo cult is a Melanesian millenarian movement encompassing a diverse range of practices and occurring in the wake of contact with the commercial networks of colonizing societies. The name derives from the belief that various ritualistic acts will lead to a bestowing of material wealth ("cargo").
>>
>>52049618
>That's like an artist only drawing when they have a uni assignment. You'll end up being terrible and unable to find a job.
that's not how it works faggot. more like an engineer that only design bridges when he has uni assignments -- perfectly reasonable. Only problem is that CS sucks at most schools
>>
>>52050670
>>52050668
now it says it doesn't know what varchar is

what's wrong with vhar anyway? argc is a variable, and I thought since argv is of type char, maybe argc would be vhar?
>>
>>52050720
>pot calling the kettle black
you are autistic, the retarded and useless type of autistic, not the genius autistic
>>
>>52050726
Muh fictional readability.
>>
>>52050700
i thought that was how you linked other classes in c?
>>
File: 1450978669866.jpg (49 KB, 400x438) Image search: [Google]
1450978669866.jpg
49 KB, 400x438
>>52050755
They're making fun of you. Do listen to them.
Use this:
import (
"fmt"
)

func main() {
fmt.Println("hi")
}
>>
>>52050674
I'm not sure how that's like type providers. Can you get that shit to run at compile time dynamically?

Say for example, in F# you can use the Swagger type provider to give you a type safe interface to a REST api with autocompletion and shit, like:
type muhSiteAPI = SwaggerTypeProvider<"http://muhsite.org/swagger.json">

muhSite.getPeople()
|> Seq.filter (fun p -> p.age > 20)
|> Seq.iter( fun p -> printfn "%s %s" p.firstName p.lastName)

all completely static types. All the type information is generated from the swagger file.

Can ocaml so things like that?
>>
>>52050755
This is the most retarded post on the whole of 4chan since 2003.
>>
>>52050711
source? I've been looking through the benchmark game benchmarks. All the benchmarks where ocaml is much faster have very different source code. When the source code is more of less copy pasted, the performance difference is 10-20%
>>
>>52050786
>Can you get that shit to run at compile time dynamically?
That's literally what I described it to do, yes.
>>
>>52050739
so Java was born from cultism?

alright
yeah
>>
>>52050785
error: expected declaration specifiers or '...' before string constant|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

>>52050795
maybe you could help me become unretarded instead of letting me stay like this then
>>
>>52050780
>classes
>c
this is how I know you are trolling

>>52050817
from cultism to C/C++, yes.
>>
>>52050811
I had trouble understand what you meant. It sounded like something that was done statically, and not based of data from outside the source code. What good examples of ocaml libraries use this stuff? I'm curious.
>>
>>52050799
https://philtomson.github.io/blog/2014/05/30/stop-the-presses-ocaml-wins/
Single-core ocaml is 50% faster than parallel F#, and 2x as fast as single-core F# - not 3x (mea culpa).
>>
File: rob.pike.jpg (26 KB, 500x335) Image search: [Google]
rob.pike.jpg
26 KB, 500x335
>>52050828
Did you try
go install
to build it?
>>
>>52050830
other files, other functions, other whatevers, you know what i mean
in java it's classes, and you bring them in with import
>>
>>52050811
I'm not finding any example of this. I presume your missing that F# is doing this dynamically at run time, and ocaml only does this stuff based off static code files already in the project. Could you actually write a Swagger type provider in ocaml? It doesn't look like it.
>>
File: 161017757_44042348.jpg (67 KB, 590x632) Image search: [Google]
161017757_44042348.jpg
67 KB, 590x632
>>52050755
this is /dpt/, a serious thread where noobs like you are not welcomed, try on /sqt/. no seriously, fuck this gay earth.
>>
>>52050817
>taking it as an attack against Java rather than an attack against retarded programmers
Stay classy, Javafag.
>>
>>52050879
>dynamically at compile time
rather
>>
>>52050881
Go weeb somewhere else, pedo
>>
>>52050841
I just google that, and no, I don't want to write this in the Go language, I want to write it in C, so thanks for wasting my time

>>52050881
can you just help me, ffs
>>
>>52050655
>>52050755
>>52050780
>>52050828
try this m8
#include <stdio.h>

int main(int argc, char *argv[]) {
printf("hi\n");
return 0;
}

note the differences.

#include "printf.h"

means "include the file called printf.h that is in the same directory as this source code", you need the header file from elsewhere in the system. also, printf is in stdio.h, not in printf.h

char is a data type in C. you don't just make types out of the blue... also, argc and argv actually mean something.
>>
File: 1429852208959.jpg (682 KB, 600x3300) Image search: [Google]
1429852208959.jpg
682 KB, 600x3300
>>52050906
why pedo ?
>>
>>52050883
no I was trying to make a joke
>>
>>52050532
>the pi digits ocaml one uses an ocaml gmp library, while the F# one uses native interop to hook into a native code gmp library
the native library should be significantly faster anyways
>>
>>52050937
You're partially true.
The new C standard, called C16, is Go 1.5. It's formal name is ISO/IEC 9899:2016. Look it up.
>>
>>52050755
>what's wrong with vhar anyway? argc is a variable, and I thought since argv is of type char, maybe argc would be vhar?
>>
>>52050726
should be:
>Customerable
>Customerer
>>
>>52051015
kek
>>
>>52050831
I think the graphics library has a modular version that uses this principle, but using first-class modules with functors is not very popular. In most cases, people use classes instead, because they can provide much of the same functionality (one then creates an object using the class, binding the polymorphic parameters to concrete types as-needed). There are several toy examples of the technique, though.
>>
>>52050959
Thank you white knight. You've saved yet another soul.
                                                                                                                                                                        Too bad Hitler didn't gas your whole family.
>>
>>52050906
There literally no rule that dissallows weebing by pedos on /g
>>
>>52050879
>ocaml only does this stuff based off static code files already in the project.
Just because you're butthurt that your precious F# isn't as unique as you thought it was doesn't mean you're allowed to lie this blatantly.
>>
Fuck Java
>>
>>52050959
regarding:
- headers:
http://www.tutorialspoint.com/cprogramming/c_header_files.htm
- data types:
http://www.tutorialspoint.com/cprogramming/c_data_types.htm
(note: "Integer Types" is not really correct... these types are not fixed, they depend on the system in which you are compiling the program)

btw, \n means "newline"
seriously, you should be reading a book. there are a shitload of "free" ebooks for learning C. K&R is good enough IMO.

ignore the Go fag, lel. but, learn Go in the future ;^)

>>52051043
shut up, pedo
Thread replies: 255
Thread images: 22

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.