[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: 23
File: DPT.png (389 KB, 934x1000) Image search: [Google]
DPT.png
389 KB, 934x1000
Old thread: >>52066446

What are you working on /g/?
>>
F# > ocaml < Haskell
>>
>>52072049
for(var faggot = 0; faggot <= 20; ++faggot) {
>>
Daily reminder that if your language of choice is not on this list you should probably give up and kill yourself:
- C++
- C#
- Lua
- Python
- Elixir
- Haskell
- Bash
- Clojure
- D
>>
>>52072076
>- Lua
>- Python
>- Elixir
>- Haskell
>- Bash
>- Clojure
fucking garbage, lad
>>
>>52072076
>C++
Oh wow, got hit in the head?
>>
first for Go
>>
File: injection.png (22 KB, 1014x232) Image search: [Google]
injection.png
22 KB, 1014x232
Since using Spring's bean factory means getting 20+ jars on my classpath and Java's native support for it sucks, I made my own singleton dependency injection thing


currently only a prototype though
>>
>>52072076
>good
>god
>meh
>good
>meme
>meme
>autism
>meme
>meme
>>
>>52072091
Lua is an excellent little language even if it's specialized for specific domains.
The others in your greentext are indeed memes
>>
>>52072144
So are Elixir and Haskell.
>>
F# in-IDE Choose Your Own Adventure Game

http://www.pinksquirrellabs.com/post/2013/07/29/Choose-Your-Own-Adventure-Type-Provider.aspx
>>
>>52072076
you forgot go
>>
>>52072076
>Haskell
>no Prolog

Really?
>>
SHORTEST shell fizzbuzz?
>>
>>52072157
C++ templates are bad enough, this is insane.
>>
>>52072144
lua is alright i guess as long as you don't use it as your primary language with some faggy framework like love2d
>>
>>52072155
I don't know about elixer but haskel has no domain outside circlejerking, and maybe Functional Programming theory in academia. Maybe
>>
>>52072176
It's not bad. It uses a type provider.
All the types are loaded from the type provider once the project is loaded.
>>
>>52072190
I don't know if it was intentional but I'd say Haskell's domain of interest is implementing programming languages as well as for academic purposes. Though there are better languages for academics (Agda, Coq, etc.)
>>
Post the most beautiful function you've written
>>
What place does C++ have in the modern world, /dpt/? It seems if you want to do higher level programming than C you'd just use C#
>>
>>52072164
my nigga
>>
>>52072223
Except C++ is higher level than C with no runtime costs.
>>
>>52072223
Muh vidya.
>>
>Dramatically reforms and sets a new standard in regex syntax, which scales up to full grammars – powerful enough to parse Perl 6 itself

WHAT IS THIS MADNESS
>>
>>52072266
Regex was a mistake.
- Stephen Kleene
>>
>>52072266
>The tag for this release is “кoлeдa”[^2], a slavic word for an ancient winter festival that has been incorporated into Christmas. We hope you join us in our celebration of getting our Christmas release shipped!

thank you winter chan
>>
>>52072027
What should one do if they actually want to read SICP, I mean what software should you get?
AFAIK it is about lisp, right? But I've heard LISP has multiple dialects, like common LISP or Emacs LISP. So what interpreter or compiler do you need for that? I'm on linux btw.
>>
>>52072223
C# is just Java for Microsoft shills
>>
File: output.webm (1 MB, 800x639) Image search: [Google]
output.webm
1 MB, 800x639
Open source Swift calculator, give advice r8 etc.
>>
>>52072308
Does it use support arbitrary precision arithmetic?
>>
>>52072308
those tiny buttons just scream "meme design"
>>
>>52072266
Can you really call it 'regex' if it can parse non-regular grammars?
>>
>>52072237
c++ is also the single most unmaintainable, least consistent non-esoteric language in use.
>>
>>52072308
Open source software on a proprietary OS is like horseshit with whipped cream on it
>>
>>52072302
Java is just c# for oracle shills. It's been this way since .net 2
>>
>>52072091
>>52072144
Excuse me gents, but why is bash exactly a meme?
Sure you wouldn't use it for everything, but knowing how to use the command line is useful for things like system automation
>>
>>52072337
I agree, but that only really matters if you're working with retards. Which I suppose is mostly unavoidable.

These guys have the right idea, though:
https://github.com/isocpp/CppCoreGuidelines
Imagine if someone built in support for checking code against the "core guidelines" into GCC or Clang or some other compiler.
>>
>>52072308
Looks cool but pretty basic in terms of features

How do you like Swift?
>>
>>52072361
Because it's Linux
>>
File: 2015-12-26_19-57-53.jpg (42 KB, 460x644) Image search: [Google]
2015-12-26_19-57-53.jpg
42 KB, 460x644
Why the fuck does this shit take so long?

The manual installers don't even take a second to complete.
And it has given me retarded problems like no installing dependencies before the packs that need them.

What the fuck.
>>
>>52072308
Make it evaluate expressions while it's running. In otherwise it calculates the result before equls is pressed. If the equation isn't valid it presents the most recent valid version of the current equation
>>
>>52072381
>MicroSoft
it's sending you're data to the NSA botn3t
>>
>github
only now do i see irony in the name
>>
Anyone here know the first thing about WPF?

I have a button that I'm drawing a rectangle on which I use to slap an icon into

 <Rectangle.Style>
<Style TargetType="{x:Type Rectangle}">
<Setter Property="OpacityMask">
<Setter.Value>
<VisualBrush Stretch="Uniform" Visual="{StaticResource appbar_sound_3}" />
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="OpacityMask">
<Setter.Value>
<VisualBrush Stretch="Uniform" Visual="{StaticResource appbar_sound_mute}" />
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>


I want to have 4 different images based on 4 different conditions.

Is there any way to achieve this? I'm not entirely certain of how I'd go about doing it.
>>
>>52072115
Go has really good features, one of the greatest language
>>
>>52072380
What's wrong with UNIX-like systems? OSX is UNIX based, and uses bash as it's default CLI.
Windows is cool and all, but just because someone has a different OS doesn't make them inferior.
Besides, Linux is making headway as an enterprise system, and runs a lot of the world's servers.
Even Microsoft made a version of Linux, to run their servers.
>>
>>52072361
Because the topic is "language of choice". Fair enough you want automation, but for any arbitrary project given to you is bash the first language you think of when you consider how to build it? If so you've fallen for one of the many hipster memes.
Alternative answer: bash is deprecated by powershell faggot
>>
File: 1451020874138.jpg (17 KB, 250x245) Image search: [Google]
1451020874138.jpg
17 KB, 250x245
>C plus garbage collection
>>
>>52072420
https://www.google.co.uk/search?q=f%23+wpf
>>
>>52072420
Are you the mediaplayer guy?
>>
File: 1450770707376.png (289 KB, 514x424) Image search: [Google]
1450770707376.png
289 KB, 514x424
>>52072446
>powershell
>>
>>52072124
Am I the only Java dev here by any chance?
>>
File: I might be.jpg (298 KB, 1536x2048) Image search: [Google]
I might be.jpg
298 KB, 1536x2048
>>52072471

>>52072451
I tried that, all I found was "multitriggers" which are entirely unhelpful in this particular instance.
>>
>>52072318
nope

>>52072324
thanks m8 I like memes

>>52072353
k

>>52072374
Thanks anon, I will add a bunch of new functions soon, it's not finished yet.

Swift on Xcode is awesome, it's awesome to not have to type ; and the included libraries are great to handle strings. It just werks.

>>52072390
I will try this anon, thanks!
>>
>>52072446
Powershell was made to make a bash equivalent for Windows, it's decent but does things differently, and it certainly doesn't deprecate bash, because it's literally a bash clone.
>>
>>52072490
I'm an Android dev, but I prefer not to speak of Java. Let's say it's not my favorite language to use.
>>
File: lion_kek.png (216 KB, 393x391) Image search: [Google]
lion_kek.png
216 KB, 393x391
>>52072490
> java
>>
>>52072493
If you're also the silverlight guy, that stuff is deprecated. Triggers sound like a good way to get rid of your data binding conundrum, but I wouldn't use it. Unless you're going to use AdaptiveTriggers, which is a new thing for Windows 10 development.
>>
>>52072509
powershell is to bash what c# is to java.
So yes it deprecates bash
>>
>>52072490
Sup Java bro, I'm a dev for a major tech company and also do Android development. What are you up to?
>>
>>52072570
The thing I replied to, I guess

I really can't into @Inject and @Singleton
>>
How well does Android dev work with Clojure or Scala?
>>
>>52072557
Maybe, but Java was slower than C#, while Powershell is slower than bash.
>>
Is it coincidence that the programmospehere was flooded by shitcoders and feminists around the time of HTML5 becoming acknowledged publically.
Is it related to the fact that everywhere I go I'm bombarded with javascript and ruby
>>
File: 2015-12-26_17-19-59.png (7 KB, 505x50) Image search: [Google]
2015-12-26_17-19-59.png
7 KB, 505x50
What is wrong with the people who made Perl 6?

It's a cute joke, and yeah, eval is dangerous.. but still, shaking my head to be honest family.
>>
>>52072592
It's a lot of bloat, but it works.
>>
>>52072609
This is why perl has died
>>
File: 2015-12-26_17-22-19.png (18 KB, 829x394) Image search: [Google]
2015-12-26_17-22-19.png
18 KB, 829x394
lmmao
>>
>>52072598
C# is actually slightly slower than java(java does runtime optimizations when it learns that it can ). It's not really enough to care about when you consider how superior the language is
>>
>lol tfw no type classes
>hahaha nice polymorphism

i f# plz no bully
type Fmap = Fmap with
static member (>^) (Fmap, x : _ list ) = fun f -> x |> List.map f
static member (>^) (Fmap, x : _ array ) = fun f -> x |> Array.map f
static member (>^) (Fmap, x : _ seq ) = fun f -> x |> Seq.map f
//type class

let inline map f x = (Fmap >^ x) f

let s1 = [1..10] |> map ((*) 2)
let s2 = [|1..10|] |> map ((*) 2)
let s3 = seq { 1..10 } |> map ((*) 2)
//polymorphism

type Fmap with
static member (>^) (Fmap, x : _ option ) = fun f -> x |> Option.map f
let s4 = Some 3 |> map ((*) 2)
// extension
>>
>>52072600
> HTML5
> real programming
what are you doing nigga?
>>
>>52072630
Can I use EVAL to execute Python?
>>
>>52072652
My friend you need to pick up a book on prepositional logic so you never make stupid assumptions about what's being said like that again
>>
File: output.webm (1 MB, 800x470) Image search: [Google]
output.webm
1 MB, 800x470
>>52072390
Should I just remove the equals button now? Did I do it right? Are you proud of me?
>>
File: 2015-12-26_17-27-01.png (23 KB, 1174x338) Image search: [Google]
2015-12-26_17-27-01.png
23 KB, 1174x338
>>52072656
Looks like these are the only ones.
>Koalatee
>>
>>52072688
Does equals serve any purpose now?
>>
>>52072640
Nice fucking boilerplate just to remove the namespace from each map function.
>>
>>52072584
When I was interviewed for my position, I was shown some code and had to explain what @Override did and how a try/catch statement worked. They told me I was the first applicant to answer correctly. This was a serious position that paid quite nicely, and somehow people got to athe 2nd interview without knowing at all what these things were.
>>
>>52072696
Do you have to compile the C code manualky?
>>
>>52072688
I'm very proud anon.
Might as well keep the equals if there's any chance of the auto-part going wrong, it could act as a reset of sorts for the evaluator. If there isn't that chance then remove it
>>
File: 2015-12-26_17-30-58.png (6 KB, 538x223) Image search: [Google]
2015-12-26_17-30-58.png
6 KB, 538x223
No idea, the entire project has 28 commits and no documentation except for this.
>>
>>52072718
You just define the function under Fmap.
One definition, done.
>>
>>52072761 was in response to >>52072732.

>>52072724
It's amazing how bad the people applying to programming jobs are.
[spoiler]It can also be amazing how bad the people who get hired are...[/spoiler]
>>
File: c71.jpg (20 KB, 334x393) Image search: [Google]
c71.jpg
20 KB, 334x393
>>52072547
>Silverlight
No I'm definitely not that guy.

I could try binding it, but it seems like a needless waste of time because I'd have to do most of the work in codebehind anyway, I'd be better off just using my existing "valuechanged" event and slapping a conditional statement and directly setting the image.
>>
>>52072770
Meanwhile in Haskell it's just how things are in the first place.
>>
post your dev environments
>>
>>52072810
Nice multi paradigm
>>
>>52072779
Are you implying I'm an inadequate programmer, or...?
>>
>>52072840
nah, I don't know anything about you personally. It's just when you work at a company you can look around and there will probably be at least 1 or 2 serious shit-level programmers.
>>
>>52072839
Having language support for the gimped "C with classes" style OOP isn't really a bonus.
>>
>>52072880
>multi paradigm is bad
nice meme m8
>>
Just started learning this stuff.
Was there a better way to do this? I'm curious.

#lang scheme

(define (sos x y)(+ (sq x)(sq y)))
(define (sq x)(* x x))

(define (sos-thing x y z)
(cond
((> x y z)(sos x y))
((> y x z)(sos x y))
((> z y x)(sos z y))
((> y z x)(sos z y))
((> x z y)(sos z x))
((> z x y)(sos z x))))


(sos-thing 10 8 7)
>>
>>52072944
Prove to me that it's worthwhile.
>>
>>52072810
>he uses a language that has to break it's on fundemental rule because computers are inherently state based machines.
Haskel embarrasses itself. Like a drunk white girl claiming she can summersault
>>
>>52072963
D
>>
>>52072977
It doesn't break its fundamental rule. Purity doesn't mean no side effects if you use a mechanism for linearity, such as monads.
>>
>>52072219
def f():
print "fuck you nigger"
>>
>>52073012
>it's pure
>it has monads
pick one
>>
>>52072528
What is it like to be an Android developer?
>>
>"competitive" programming
AHAHHAHAHAHAHHAHAHHAHAHAHAHHAHAHHAHAHAHAHHAHAHHAHAHAHHAHAHHAHAHHAHAHHAHAHAHAHHAHAHHAHAHAHHAHAHHAHAHAHHAHAHHAHAHAHHAHAHAHH
>>
File: SadHardtofindFlea.webm (222 KB, 350x380) Image search: [Google]
SadHardtofindFlea.webm
222 KB, 350x380
>>52072781
>>52072547
Can't even bind it, it seems.

No way to do anything with a StaticResource in codebehind which is a bit of a shitkicker.

In an unrelated note, any suggestions on making my song position visual look a little less shit?

I tried setting the colours contrasting to the average value of the album art, but that was a massive needless performance sink that didn't even look that good.
>>
>>52073030
Quentin Tarantino?
>>
>>52072570
Is android development hard to learn? Harder than web dev?
>>
>>52073121
Duhhh, frontend development is a piece of cake due to the dumbification that tools like jquery and backbone and angular provides. backend is boring as fuck though, just shuttling data between http requests and some server.
>>
>>52073059
round the seeker and ends of seek bar, put a semi visible black bar across the whole back of the seek bar and timer, make it 1-3px bigger than the seek bar and text, contrast the numbers to the semi visible bar.
>>
>>52073048
>I don't know what I'm talking about but I'll use it to talk shit about Haskell anyways
>>
>>52073173
It's a damn shame there aren't effects like "difference" that'd make life a lot easier.

You'd think if they could do opacity they could do something like that.
>>
>>52073182
if you can write monads that do side effects, it isnt pure
>>
File: Untitled.png (70 KB, 1787x1308) Image search: [Google]
Untitled.png
70 KB, 1787x1308
>>52072219
Not beautiful really, but it's the best written function I could find in my current projects folder.
>>
>python programming
AHAHAHAHAHAHAAHHAHAHAHHAHAHAHHAHAHAHHHAHAHHAHAHHAHAHAHAHAHHAHHAHAHAHAHHAHAHHAHAHAHAHHAHAHHAHAHHAHAHHAHAHAHHAHHHAHAHAHHAHHAHAHAHAHHAHH
>>
>>52073057
It's great! It always makes me laugh to hear material design evangelists talk. "Best user experience", "users were instantly amazed at the graphics". My real world experience with material design is bad. Users don't get it and just want "click x go to page y" and don't bother will all the graphic.
All jokes aside, the Android SDK and ecosystem is in a pretty bad shape. Minor version bumps in Android/Google libraries break applications. Android Studio keeps getting better, but it's far from a professional tool. The activity/fragment lifecycle is a pain to work with. Especially Samsung devices give you very low heap size to work with, so I've seen numerous OutOfMemoryExceptions. My main occupation is video playback. I've yet to see a player implementation fully work on modern devices. ExoPlayer is getting there, but it has some rough edges. For DRM, I usually turn off hardware decoding and run everything on software. Since that gives you performance issues, I remove HD+ bitrates.
There're a lot of Android events I can attend, so that's always cool. I don't really participate in the community, because most of the focus is on design. I don't like writing UI stuff.
So it's OK I guess. It's a hell of a lot better than being a web dev. Also, iOS is just as broken but fanboys cover that shit up.
>>
>>52073273
which engine do you use
>>
>>52073157
I was thinking about getting to android development but im too afraid that it will be too hard and im not even sure if i would find any jobs for app dev in my shitty country
>>
>>52073258
comments should tell you why you are doing what you are doing, not what you are doing, you should be able to tell from the code itself
>>
>>52072948
You could just remove the max from list x y z
(let ((l (list x y z)))
(sos (remove (max l) l)))
>>
>>52073059

- using WPF
+ Two Steps From Hell
>>
>>52073292
what is your shitty country? android dev requires something like software engineering skills, especially if the app is anything but a novelty toy.

web development, front end tech, will probably a worthwhile in shitty countries.
>>
>>52073221
"Impure" functions that use monads like IO in Haskell are pure functions that return computations. These computations are then composed using the monad structure. Haskell can be seen in this way as a DSL for composing programs that do things. The other way to look at it is that linearity (through monads, in Haskell) preserves purity even with the presence of side effects that affect the world serially, since you have to explicitly sequence them so that lazy evaluation (a "perk" of purity) can't mess things up. If the linear world becomes an argument to and result of the function, by definition you can't call the function twice with the same arguments to get a different result, so purity isn't violated.

What is your definition of purity? If it's "no side effects under any circumstances" where "side effect" means modifying memory, doing I/O, etc. at all then you're wrong. Because if you model the computer's memory as an array, and have a function like this, it's pure, but apparently also has a side effect:
write :: a -> Pointer a -> Heap -> Heap
>>
>>52073293
I personally write comments before I write the code, so I can better keep track of what I'm about to write, and in case I jump around in the code to write different pieces of methods.
Also, the method isn't very complex. I believe the reason for why I'm doing it is rather understandable (if you see the rest of the code).
>>
>>52073315
- tripfag
+ acknowledging Two steps
>>
>>52073349

Thanks lad.
>>
>>52073287
???
>>
>>52072219
NUM_MAX = 2^52-1
--[[
--
-- The Croft Spiral Sieve
--
-- Essentially a 2, 3, 5 wheel-factored Sieve of Eratosthenes in generator form.
-- The generator works not by keeping the entire sieve in memory, but only the next
-- multiple of each prime the generator will come across. For example:
-- 7 is prime
-- 49 => 7 is added to the roots map
-- generator spins until the current n is 49
-- 49 is in the roots dictionary so 49 is not prime
-- generate the next multiple of 7 that the generator will check (77) and add
-- that mapped to the prime (7) to the roots map
-- do this for all primes discovered so far
--
-- Doing so keep the memory usage low, as well as keeps the generator from artifical
-- bounds like a traditional sieve.
--
--]]
function Primes()
return coroutine.wrap(function()
coroutine.yield(2)
coroutine.yield(3)
coroutine.yield(5)
local wheel = {1, 7, 11, 13, 17, 19, 23, 29}
local roots = {}
-- yield the primes under 30
for i = 2, #wheel do
coroutine.yield(wheel[i])
roots[i*i] = i
end
-- yield the rest of the primes using croft spiral sieve
for i = 30, NUM_MAX, 30 do
for offset in ipairs(wheel) do
local q = i+offset
if roots[q] then
p = roots[q]
roots[q] = nil
local x = q + 2*p
while roots[x] or wheel[x%30] do
x = x + 2*p
end
roots[x] = p
else
_prime_cache[q] = true
roots[q*q] = q
coroutine.yield(q)
end
end
end
error("Cannot get larger primes")
end)
end
>>
>>52073324
run :: beginning_of_universe -> end_of_universe
side effects don't exist
qed
>>
>>52073367
memes
>>
>>52073374
What's your definition of "side effect"?
>>
>>52073397
anything that has changed the state of computation but isn't included in the return of the computation?
>>
>>52073447
t. someone else
>>
>>52073447
Yes, I agree. So what's the issue, if you can overwrite memory as long as you quantify it somehow, either with a monad or with something like a linear "heap" value that you pass in and out?
>>
>>52073470
bruh, sorry, I wasn't the dude bothering you, but the idea of that collection is data is a heap being passed in and out is really an interpretation of what is being labeled in memory, no?
>>
>>52073364
I should probably get a trip too, so people who immediately recognise me from my stupid questions about my shitty media player being made in WPF can filter me.

Could probably just filter posts with "WPF" in them and achieve a very similar result tbf.
>>
>>52073496
If you're interested in this, take a look at Philip Wadler's paper "Linear Types Can Change the World!". I don't really understand your question so hopefully it will help.
>>
Daily reminder that "values" are just functions
>>
>>52073499

I would, but I don't do filtering. I think it's wrong.
>>
>>52073315
>implying wpf isn't the coziest desktop gui framework
>>
>>52073565
But functions with side effects? They change an underlying state?
>>
>>52073590
>"5" is a side effect
>>
>>52073589

WINFORMS
I
N
F
O
R
M
S
>>
>>52073565
sounds like something some faggy CS queer who has never written assembly or taken a class on computer architecture would say
>>
>>52073292
Try iOS. It's nicer (android has honestly the worst api of all the mobile OS') and you've a much better chance of making money off it. Of course you'll have invest in an apple ecosystem which is non ideal.
But even with android it's not that hard. You won't know til you try anon. Make a simple music player or something. Java has some built in support for audio files if I recall so thsts somewhere to start I think
>>
>>52073590
Not him, but it's unfortunate that in programming "function" has generally been bastardized to mean "an abstraction of a subroutine".

Those should be called procedures, while a function is kept in line with the mathematical sense of the word.

It's like how C++ stole the word "functor" from category theory to mean "a class/object with operator() that emulates a closure".
>>
>>52073287
webkit
>>
anyone here really clever and cool etc?
wanna help me out?
i'm trying to do internet programming as its the only thing left on my list pretty much.
i'm trying to make an app that can read a single character from a python server. this will /eventually/ serve a practical purpose ;) i added a pastebin.
http://pastebin.com/yun6tCqB
it contains the code for the python server, and the function call for the socket and stuff. if anyone is super cool enough to pick out my mistake(s), id be really grateful :)
>>
>>52073624
Winforms is deprecated and nowhere near as cozy.
Not in the meme sense, it's literally deprecated
>>
File: 2015-12-27-0627-08.webm (514 KB, 640x346) Image search: [Google]
2015-12-27-0627-08.webm
514 KB, 640x346
Are we still doing these?
>>
>>52073652
>functor
function object, haha

no, I get the mathematical definition of a function. values are functions in the sense they are like memoization functions that return a single state upon evaluation. right?
>>
>>52073694
tell us what are you trying to do.
>>
>>52073711
Values are not like functions. A function is a value, the application of a function to some arguments is a value, but a value isn't a function.
>>
WPF retard again, any idea how I could stop the window's inactive style being used.

So even if it's not the currently selected window the thing still LOOKS like it's still active.
>>
>>52073701
>deprecated

No, it's not.

>but muh WinRT!

Still no.
>>
>>52073318
Well its glorious central europe. Php, java and c++ are in high demand

>android dev requires something like software engineering skills
Bad news for me
>>
>>52073652
A function is a predictable mapping of input to output. I'd say programming functions meet that criteria. Maybe not void functions though
>>
>>52073727
unit -> T
>>
>>52073728
Don't fucking do that.
>>
>>5207362
Winforms is DEPRECATED
>>
>>52073711
i'm trying to make an app that can read a single character from a python server.
>>
>>52073747
But I hate the horrible greyed out look that comes with the Mahapps package.

I just want it to always retain that lovely colour.
>>
>>52073764

How is working with MahApps, btw? I've heard some pretty good things about it.
>>
>>52073731
Android has a lot of moving parts, and its in embedded environment.

Invest in PHP and learn a framework like laravel if you are interested in backend, or just the standard html, css and js

>>52073732
void functions do, they always return void.

>>52073761
tell us at least why. this feels like a homework assignment.
>>
>>52073730
Even microsoft uses wpf for office and VS now.
>>
>>52073210
If you take my advice, post the result, im curious to see if it comes out like i imagine.
>>
>>52073732
Well, you can certainly implement a function with a procedure or subroutine. But a subroutine doesn't describe a mapping, it describes a sequence of steps for the computer to perform.

>>52073743
What's a value of unit, then?
>>
>>52073782
>void functions do, they always return void.
But they tend to alter state elsewhere. I don't know if the mathematical definition of a function allows that
>>
>>52073781
It's rather nice, if someone as thick as me can make it look decent then I'm sure someone competent could do wonders with it.

Plenty of nice custom controls and all lovely animations, definitely a step up from the default and a whole heap less hassle than doing all your own styling from scratch.
>>
>>52073799
unit is equivalent to void
unit -> T is just
-> T
or T
>>
>>52073803
We just had this conversation. Scroll up a bit.
>>
>>52073799
>But a subroutine doesn't describe a mapping, it describes a sequence of steps for the computer to perform.
With an output of some type. And for the same input(s) it will always produce the same output. I'm no mathematicist or nuthin but that seems to meet the criteria to me
>>
>>52073798
not gonna bite that b8 m8, soz
>>
>>52073782
it's not homework. i dont study CS, im planning on hooking up the python server on a raspberry pi to an outdoor light, because my mum has to walk the muddy path to our door in the dark, so i want an internet connected light she can toggle with her phone.
>>
literally whats wpf good for?
>>
>>52073819
So, in your words:
T = unit -> T = T
and this somehow means that a value of T is a function.

Are you the same guy who constantly shills F# and thinks that purity means no touching memory/filesystem/etc.? You should really get yourself down off of the peak of Mount Stupid.

>>52073839
>And for the same input(s) it will always produce the same output.
What about rand()? No input (input is unit/void) but it always produces a different output.
>>
>>52073844
>http://pastebin.com/yun6tCqB
that's nice and okay, i'll look at it.
>>
>>52073873
ta much <3
>>
>>52073787
>Even microsoft uses wpf for office and VS now.

And that's why VS now has known font rendering issues. Thank you Migrosoft. :^^))

>>52073807

I'll have to look into it. I'm not a fan of WPF, but one day I'll probably be forced to work with it.
>>
>>52073871
https://en.wikipedia.org/wiki/Lambda_calculus
>>
>>52073854
Hardware rendering, defining new controls
>>
>>52073871
Rand doesn't always produce a different output. It produces a predetermined sequence of outputs based on the input seed. Also the ol' rand() is deprecated.
>>
>>52073871
>What about rand()? No input (input is unit/void) but it always produces a different output.
Rand takes a seed from the current timestamp. That timestamp is an input to the function. The same timestamp will always produce the same rand() which, combined with the same input to the function calling it, results in the same output for those inputs
>>
>>52073798
>ask for advice
>respond to post
>request result of advice
>receive trolly bullshit

why
>>
>>52073904
It's output is dependent on the state of external variables. a function, I think, has identity.
>>
File: patting a fish.gif (2 MB, 300x169) Image search: [Google]
patting a fish.gif
2 MB, 300x169
what's the best c++ compiler in terms of optimisations and also running on linux?
>>
>>52073896
Church encoding is just that, an encoding. Not the essence of everything.

>>52073904
That doesn't change anything. Even if it just produced 0,1,0,1,0,1... it wouldn't be a mapping from inputs to outputs, and thus it is not a function.

>>52073922
>Rand takes a seed from the current timestamp.
Wrong.
>That timestamp is an input to the function.
Wrong again. Well, the seed is an implicit input, but mathematical functions don't have implicit inputs.
>>
Anyone else have a problem with codeeval's Reverse Words problem?

my output is correct but it fails me every time, I even checked it against a diff utility and reading it myself line by line.
>>
A pure function is surjective.
Any input is mapped to only one output.
>>
>not using wpf
>not seperating code from chrome through databinding
>not creating your chrome declaratively instead of imperatively
>>
>>52074001
you mean it isn't multivalued
>>
>>52073987
Is it all the letters reversed too?
>>
>>52074001
A surjection is a total function. Any mathematical function is pure.

>>52074025
That, again, has nothing to do with purity.
>>
>>52074025
he means if input x results in output 1, x will always output 1. If input x outputs 1,2,3 it will alwys output 1,2,3. An array/tuple/ist is still a single output.
>>
>>52074073
yes, that's what not multivalued means
>>
>>52074095
You're not what multivalued means.
>>
>>52074111
savageeee
>>
File: 2015-12-26_21-41-02.webm (297 KB, 642x302) Image search: [Google]
2015-12-26_21-41-02.webm
297 KB, 642x302
made a meme
>>
>>52074120
What do 6, 7 and 8 do?
>>
>>52074131
They will OverMeme when i make them someday.
>>
>people saying values aren't functions
I knew /dpt/ was dumb, but did no one here even study propositional logic? lol
>>
>>52074162
I know, right?
>>
>>52073885
>going from deprecated to deprecated
WinRT is the new shit, tripfag
>>
File: wpfmahapps.png (5 KB, 424x313) Image search: [Google]
wpfmahapps.png
5 KB, 424x313
Alright, maybe this gay-ass gay WPF shit isn't so bad.

Maybe.
>>
>>52074171
WinRT is literally wpf in a sandbox
>>
>>52074171
can't spell windows without dows
>>
>>52074065
Yup, i am a fucking idiot, iv done about a dozen of these so far, starting to lose focus.
>>
>>52074144
>1,2,3
new fag here, what is this thing u call meme
>>
The difference between a function and a relation is only meaningful if you're confining yourself to grade-school maths where everything deals with real numbers and functions of real numbers and nothing else. Is the square root a relation where the domain is the set of real numbers or a function where the domain is the set of pairs of complex numbers?

>>52074162
I guess you could argue that under univalence, values are equal to functions because they are equivalent to (can be encoded as) functions. But it's kind of a useless tautology to say that "values are functions" in that case, because that doesn't make them not something else at the same time.
>>
I'm working on a LSB steg encoder/decoder in C#.

You can encode and decode hidden text/files

The only problem I have right now is trimming off the excess bytes from the embedded file when its being decoded. My MIN recognizer finds it even with all the crap at the end.

Tell me what you think, I'm sort of new to C#, so any advice or comments are appreciated :)

https://github.com/nicosogangstar/Steg
>>
>>52074276
>Keeping binaries in the repo
0/10 try again
>>
>>52074339
Is that bad?
Makes it easier for people downloading so they can just run it instead of compiling in Visual Studio. At least that's what my thought process was. That exe isnt updated fyi
>>
>>52074381

People who use github and are interested in your project are going to tinker with the code and compile it themselves.
>>
>>52074381
The repo should contain just the source code, documentation and build project (VS project in your case). Just put a link to the binaries in your readme.
>>
>>52074410
>>52074408
Point taken. Thanks.
>>
>>52072219
int avg(int a, int b)
{
return b != 0 ? a / 2 + b / 2 + (a % b % 2) : a / 2;
}
>>
>>52074421
If you want to be naughty you can just make a second github repo to host the binary.
>>
>>52072219
import sys
#advent22.py bossHP bossDamage part1or2 - 0 for 1, anything else for 2
hisHP,hisDam,part2=list(int(i) for i in sys.argv[1:])
hisRDam=max(hisDam-7,1)

def applyEffects(pT,rT,sT,hisHP,myMana):
if pT>0:
pT-=1
hisHP-=3
if rT>0:
rT-=1
myMana+=101
if sT>0:
sT-=1
return list([pT,rT,sT,hisHP,myMana])

def simulate(*args):
global minMana,hisDam,hisRDam
for i in range(5):
manaCost,myHP,myMana,hisHP,sT,pT,rT,part2=args

pT,rT,sT,hisHP,myMana=applyEffects(pT,rT,sT,hisHP,myMana)

if part2:
myHP-=1
if myHP<=0:
continue

cm=(53,73,113,173,229)[i]
cond=(0,0,sT,pT,rT)[i]

if myMana<cm or cond!=0:
continue

if i==0:
hisHP-=4
elif i==1:
hisHP-=2
myHP+=2
elif i==2:
sT=6
elif i==3:
pT=6
elif i==4:
rT=5

myMana-=cm
manaCost+=cm
if manaCost>=minMana:
continue

pT,rT,sT,hisHP,myMana=applyEffects(pT,rT,sT,hisHP,myMana)

myHP-=(hisDam,hisRDam)[sT>0]

if hisHP<=0:
minMana=min(minMana,manaCost)
continue
elif myHP<=0:
continue

simulate(manaCost,myHP,myMana,hisHP,sT,pT,rT,part2)

#last param is False for part 1 and True for part 2
minMana=9999
simulate(0,50,500,hisHP,0,0,0,part2)
print minMana
>>
File: 1443225682058.jpg (33 KB, 600x360) Image search: [Google]
1443225682058.jpg
33 KB, 600x360
>when he doesn't represent graphs using lambda calculus
>>
>>52074516
int avg(int a, int b) {
return a/2 + (b?b/2+(a%b%2):0);
}

ftfy
>>
>>52074553
>beautiful
the compiler can optimize it
>>
>>52074516
>avg
uhhh.... i guess....if you say so......uhhhh.....just let me get a pencil...

but it is aesthetically pleasing i will admit.
>>
>>52074551
Directed graphs, at least. It's probably unnecessarily complex to represent undirected graphs as directed graphs with a cycle between every adjacent node.
>>
>>52072027
Applying Markov chains to my other projects
 updates.dimensions = target -> acceptEvent( e );       if( !containers.erase( c )
// This will generate a window & top_element dimensions
scoped_lock< mutex > def_dim( getSetting_num( "jb_DefaultWindowW" ),
// No thread safety required, as we
x_display, None, NULL );
bool window::redraw::execute( task_mask* caller_mask )
{


return true;
case PINCH:


platform_window.glx_attr[ 4 ] / scale = getGUIScaleOverride();
updates.dimensions )
}
throw an exception as something's wrong in device association list first
}


}

ff::write( jb_out, "window::manipulate::execute(): Maximize not implemented yet, ignoring\n" );
// No thread safety required, as that code may be happier)
>>
im learning a bit more about reading values from a programs memory and sort of reverse engineer shit, and i want to call an internal function

i've launched the program in a debugger and i do a breakpoint to what would atleast be close to what function i'd want to call and i sort of have some c# code ready to call the function, but navigating through the assembly is pretty hard, and there's probably 20 CALLs and i can't really guess how the structure of the program works by the assignments along with the fact i'm not entirely well versed in assembly

is there an easier way to do this and i'm overlooking something, or should i just spend more time to try and understand this
>>
Daily reminder that programming is gay
>>
>>52072076
>not-ocaml
Fucking turd, lad.
>>
>>52075080

Truth.
>>
>>52072219
#define APPROX 32

// precond: n >= 1
double sqrt_of_int (int n) {
int k;
double x, a;

for (k = 1, a = 1.0; k != n; k++) {
// given a = sqrt(k)
// approximate x = 2a + 1 / x = sqrt(k + 1) + a
for (i = 0; i < APPROX; i++)
x = 2a + 1 / x;

// a' = sqrt(k + 1)
a = x - a;
}
return a;
}
>>
>>52075148
fuck should be "2 * a"
>>
Does anyone have any opinions on Xamarin? Or even better, does anyone use it? I have to learn it for a job.
>>
>>52075245
Best IDE for D
>>
>>52075245
It's just mono/.net for mobiles, shouldn't be much different to regular old c#.
>>
>>52075245
it's kinda shitty imo but it's basically the android APIs but with C# instead of java
>>
how many apps have you made this year, /g/
>>
>>52075280
>it's kinda shitty imo
How so?
>>
>>52075271
>>52075274
>>52075280
Ty lads, guess it's time to learn C# then. Now I need an idea for small app to develop using Xamarin.Android, that's the only way I can learn to use anything.
>>
>>52075341
If you're coming from java you're in for treat(dunno about the setup part I mean purely the language). I'd suggest the same thing I suggested to the android dev earlier, make a simple music player
>>
>>52072027


https://perl6advent.wordpress.com/2015/12/24/an-unexpectedly-long-expected-party/

How autistic do you have to be to write this?
>>
>>52075341

Good choice. If you already know Java, you'll come to regard C# as a good version of Java.
>>
>>52072361
If you are using bash to write programs you have problems. Anything with < 15 lines of bash needs to be done with a real scripting language.
>>
>>52075365
some social media evangelist probably wrote it and gets paid more than you do
>>
>>52075391
><
>
>>
What GUI framework should I learn if I want my applications to be multiplatform?
GTK frameworks on windows look like utter garbage, but I heard Qt has a nasty habit of reimplementing every feature in C++ and forces you to use their version of the standard libary.
>>
>>52075403
fuck it, I meant more than 15 lines
>>
>>52075410
Just use Electron senpai.
>>
>>52075410
>gui

just web app it m8
>>
>>52075448
>>52075433
>write desktop application in javascript
i thought this was satire for a second
what the fuck is wrong with people
>>
File: 65258007.jpg (82 KB, 461x403) Image search: [Google]
65258007.jpg
82 KB, 461x403
>>52075365
>>
>>52075472
You can write the application in C++ then build it as a Node module then expose that module to a frontend written in HTML/JS. The best of two worlds.
>>
>>52075503
That's the anime boards on 4chan in a nutshell baka, not normies
>>
>>52075472

It was satire

>>52075503

Whoever wrote that shit is the opposite of "normie". I'm a fuckin normie compared to whoever wrote that.
>>
>>52075512
Or just write it in C++ and distribute that?
>>
>>52075472
GitHub's text editor Atom is programmed in CoffeeScript and uses WebKit for rendering. It would be a great text editor if it weren't slow as shit.
>>
Made this bit by following some example, but what's the purpose of the "x2"? if i check the hash i get online it matches with results, but if i change the "x2" no longer will it match. is it supposed to be an option or something?

private void buttonX1_Click(object sender, EventArgs e){
string a = textBoxX1.Text;
SHA1 crypt = new SHA1CryptoServiceProvider();
byte[] bth = Encoding.ASCII.GetBytes(a);
bth = crypt.ComputeHash(bth);
string b;
foreach(byte by in bth){
b += by.ToString("x2");
}
b.Trim();
textBoxX2.Text = b;
}
>>
File: 1448506031628.jpg (65 KB, 463x465) Image search: [Google]
1448506031628.jpg
65 KB, 463x465
anyone knows how to read a list of numbers in a text file delimited by ';'? StreamReader doesn't work since the text file is more than 400MB in size and throws OOM exception
>>
>>52075684
consider suicide
>>
>>52075684
strtok
>>
>>52075667
pretty sure it is formatting to lower case hexadecimal
Thread replies: 255
Thread images: 23

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.