>It's archived It seems everyone had fun in the New Year night.
Angel James
I went to sleep and woke up and it was gone
Matthew Foster
>no anime image sage
Nathan Davis
sorry user
Jack Perez
bump
Ayden Myers
Image is wrong. The function is an argument, not a parameter.
Nathan Myers
>The function is an argument, not a parameter. herewego.jpg
Chase Myers
jay pee gee
Hunter Murphy
bump
Ayden Martinez
Hey I have a problem understanding Erlang:
So it's got three main design goals: - fault tolerancy - concurrency - hotswapping code to preserve uptime
Shouldn't the first point be just "make good software"? Why rely on writing code that eventually crashes?
And I don't understand BEAM's implementation of the second point: so they call them processes but they're not OS processes and they're not threads even though they are pretty much threads.
The third thing I get. Gotta keep emergency lines running.
Jose Price
It's not one of the "safe languages", so I imagine you generally consider some kind of fault to be inevitable
Austin Brown
no matter how good your software is, there will be some faults (in hardware, network, underlying software implementation). Erlang wants you to handle these kinds of things with the minimum possible damage, which might mean crashing a thread and starting it over rather than the conventional process of trying to correct what went wrong directly. meanwhile, Erlang processes are pretty much software threads. they're extremely light weight in comparison to OS processes. the threads can be distributed over multiple OS processes IIRC (can definitely be spread across multiple cores)
Dylan Jones
I'm writing a GUI for my program.
I am doing an operation interacting with the internet. I pop up a button after search has been pressed, allowing the user to cancel it. Once the search has finished I emit the signal to close the dialog which is waiting on a response in the main thread.
The issue is here: childThread
Julian Morgan
I'm also learning Elixir and Erlang so I can't really give you an authoritative answer but here's my take on it.
With certain systems, especially telcos, failure cannot be completely eliminated. Even very good reaches failures at some points, and when you factor in millions of users, different hardware and potentially different versions of software, you have a recipe for failure.
So instead of trying to catch all the errors, make layers of code. The outer layer should be as fault tolerant as possible, but you let the inner layers crash while safeguarding state.
"Good software" is a fallacy. Whether you know it or not you're talking about defensive programming, but defensive programming is not good for these kinds of systems.
As a side note, not all Erlang code is supposed to crash. At least some part of your code should be fault tolerant, otherwise it wouldn't be any different than other programming languages. And that's the beauty of it. With OTP, you can have a very lean fault tolerant ring supervising many chunks of code that you let crash. By reducing the complexity, the system becomes more manageable. By safeguarding state on the less critical chunks, the reliable part of the system can restart the crashed chunks as if nothing had happened. And this is how you get 99.999999% uptime.
As for the processes, they aren't OS processes but they do run on all the threads with very little overhead. I don't know how they are implemented by BEAM, but I know they work like that.
Daniel Johnson
Hi I wish to know the best / most useful Functional Programming language, and some resources for it that are competent.
Andrew Edwards
haskell
Charles Johnson
>functional programming language >functional
I've never seen a bigger oxymoron in my life
Brody Mitchell
>retard needs to butt in and show the whole world he is a retard kinda wish this stopped happening, but then again it's an easy way to weed out the fools
Asher Nelson
>doesnt give any reasons
Josiah Ross
Yes, the Erlang virtual machine uses an M:N threading model, where M is an arbitrary amount of userspace threads and N is an arbitrary (you usually specify how many) amount of OS threads. This means it supports parallel computations, where as it used to only support concurrency on a single core unless you ran multiple instances of the virtual machine.
Evan Price
I've never seen a bigger moron in my life
Daniel Barnes
why functional programming is shit? especially f#
Carter Fisher
Just fucking program in whatever you want, all languages are shit. COMPUTING IS SHIT
also lern 2 proofs in code (idris) or use a proof assistant (coq)
Jason Carter
because your feeble brain can't comprehend it sorry not sorry ;)
Aaron Russell
F# is unironically one of the best programming langugaes in existence.
Zachary Turner
F# is garbage but functional programming in general is basically flawless.
Hudson Sanders
Assuming that the web application in question was reasonably efficient, what kind of load would it take to max out the average 4 core VPS (think DO/Vultr) with a web app written with Elixir + Phoenix? What about a dual-core dedicated box?
Juan Butler
Shoo, Pajeet
Wyatt Green
name literally one bad thing about F#
Asher Bailey
Shitty type system, shitty module system, .NET baggage, etc.
F*, on the other hand...
Xavier Thompson
those first two things are just symptoms if the last thing. I agree they are problems, but working well with .NET is a HUGE advantage for all kinds of shit.
Owen Stewart
Like Windows GUI programs?
Logan Lewis
That's one example yes.
Jacob Davis
>[1; 2; 3] : int list >[|1; 2; 3|] : int []
Nicholas Perry
And what's the problem exactly?
Jonathan Adams
that would be like Haskell having [1, 2, 'a'] :: (Int, Int, String) (4, 5, 6) :: Int * Int * Int
the syntax makes literally no sense and works to confuse you even more
Hunter Morales
Why? That Haskell code makes no sense. The F# code does. What exactly are you finding confusing about it?
int [] is a hold over from C#, you would typically write [|1; 2; 3|] : int array
Though you could never write code like that anyways because the compiler already knows the type of [|1; 2; 3|]
John Scott
I just want to say that this book is awesome. A great formal introduction to the typed lambda calculi, the lambda cube, system F, propositions as types, etc. If you don't have the academic background, it is very thorough and holds your hand so even if you're at babby level you should be able to follow along.
Adrian Wilson
it's retarded that they decided to mix C# and ML syntax like that. it's like list vs. int list.
Ian Campbell
It's a minor annoyance at both, and it serves a very reasonable purpose.
it's not like you're going to see int [] and wonder what type that might be. Not that that's what you would write anyways.
Juan Turner
at most*
Asher Nelson
the language is designed poorly though. another example of this is namespaces vs. modules (the distinction is awkward at best in F#). the way the language is designed fails to understand what it's trying to achieve and makes a lot of weird edge cases or feature overlap like this. don't get me wrong, it has a lot of really great stuff, but it also is missing a good goal in its design. it's not clear if we're getting a new syntax for C# or a new language that's supposed to be better
Jeremiah Cox
Just what I need. Link?
Grayson Jones
The goal is very clear. To create a functional first multi paradigm langugae (much like OCaml) for .NET.
I agree modules are a bit weird. But they are like that so that they work well with .NET. The F# team very carefully avoided anything that wasn't genuinely going to gel well with the .NET framework. better to have a small amount of good shit, then try to half bake loads of stuff (Scala).
it just feels out of place to design an ML dialect that doesn't make any decisions that go against the imperative parts of .NET. I guess that doesn't make it bad, but that's what stops it from being a great language. the object system is what makes me really dislike it.
Jaxson Turner
Unfortunately, despite being a Haskell programmer, I do not make $300k :(
Lincoln Edwards
Iota or Jot.
Kevin Barnes
>but that's what stops it from being a great language Sure, but it depends by what metric. You can assess a langugae purely on its technical merits, and then of course OCaml and Haskell will be superior to F# by miles. But programmers tend to forget just how much of programming is googling for some libraries and gluing them together with some code. Ecosystem is HUGE in terms of how much actual real world work you can get done with a langugae. F# gets a very handsome portion of the benefits of those other langugaes, while have a very comfortable way of using the entire .NET ecosystem and targeting all .NET platforms.
By comparison, many on Sup Forums have convinced me that OCaml is a superior langugae technically, but I can't think of a compelling reason to learn because I just don't know what I'd use it for except as a curiosity. The ecosystem is too poor to use for anything that would be interesting for me.
Christian Moore
Fortunately for you, the pirate edition is free.
Cameron Thomas
Yeeeeeaaahhbuddy. λΠ, here we come.
Dominic Johnson
They are too pure so there's barely any use for them. Literally too pure to be used.
Any small FP language but bigger than Iota?
Luis Fisher
LazyK?
Ethan Thompson
I thought you wanted the smallest language, not the smallest practical language.
After Iota and Jot, you get the SKI calculus, then lambda calculus.
>I thought you wanted the smallest language, not the smallest practical language. Well, I wasn't clear enough. Thanks.
Juan Perry
if I kill a thread with killThread, how can I kill its children as well? Do I have do unmasking so I can catch the exception in the function I'm calling and kill the children from there before killing itself?
Dylan Cooper
in haskell, that is
Jeremiah Sanders
maybe. I just feel like I'm needlessly getting caught up fiddling with the language when I write F# code. as an example, I had to write an instance of ICommand in my code to get something working with WPF. not only was it a lot of extra code, but it was also messy because it didn't really fit well with the rest of the code but I couldn't separate it out into its own module either. the whole thing would've been avoided by the OCaml object system which would've made that code probably 30-40 lines shorter simply because I could avoid having to define this whole new type.
Isaiah Adams
Ah, I just needed to use an MVar list to pass the new threads to the parent. Don't even need to bother removing them when they are done as killthread just does nothing on an already completed thread.
Noah Cook
Working in haskell, if i've got a function that takes two values, I can use arg1 `f` arg2[\code]. Is it considered good practice to replace a lambda over arg2 with this sort of function? Which is prefered? (x -> f arg1 x) (`f` arg2)
Brody Torres
shit, reformatted above question
Working in haskell, if i've got a function that takes two values, I can use arg1 `f` arg2.Is it considered good practice to replace a lambda over arg2 with this sort of function? Which is prefered? (x -> f arg1 x) (`f` arg2)
Leo Perez
Did you mean to write
(\x -> f x arg2) (`f` arg2)
?
If so, I would prefer the latter. Btw, another thing you could write is flip f arg2 or even f ?? arg2
Jeremiah Reed
yeah, good catch. I've never seen ?? in haskell, i'll have to investigate. Thanks bud.
Christopher Reyes
(??) is lens-style, it's just an operator version of flip
Jack Allen
What's an easy and useful fuctional language? Something like python but functional
Ian Perry
Erlang >Something like python Haskell and F#
Nolan Turner
Yes, (`f` arg2) is preferred.
Alexander Kelly
>Haskell How do I iterate through lines of a file while accumulating state and on certain lines yielding new objects?
Christian Peterson
Can someone explain what "functional programming" actually is?
Certain lines of the file contain data that I want to use in transforming other lines.
i.e. Lines of Type A contain useful data that I will use later and thus want to keep, and lines of Type B I want to transform, using the data I extracted from lines of Type A.
Is there a nice way of doing this? State monad seemed to be a nice way to do it but I'm not sure if it's a good route.
Andrew Johnson
Generally the use of principles derived from (typed or untyped) lambda calculus -
Higher order functions, type systems, pattern matching
Easton Hughes
Sounds like something you would use a mapM over the state monad for, if your state really needs to be arbitrary
Michael White
[TypeB] -> StateT [TypeA] TypeC ?
Easton Reed
Functional programming is a meme.
Nolan Murphy
a good meme
Joshua Phillips
It's not very well defined: worse so that 'declarative' and 'imperative', but better than 'OOP'.
The language should be at least roughly based on the lambda calculus (i.e., most values are functions) or one of its typed derivatives. An alternative is combinatory logic. Functional languages are organised around expressions (with evaluate to a value) rather than the statements of imperative languages (with are just instructions to the machine). First-class functions (including anonymous) are a must. Higher-order functions are nearly so (consider Joy as a counter-example). Less strictly, most (but not all) functional languages tend to have well-thought-out, strong, static type systems. They might also emphasise the idea of purity (no side effects).
Joshua Hughes
bump
David Wood
I have a problem understanding beta reduction. Why does (lambda v.z)z reduce to z?
Colton Cruz
lambda v.z or \v.z this is like saying "given v, return z"
(assuming v doesn't appear _inside_ of z, i.e. z is LITERALLY 'z')
Samuel Howard
In fact, (\v. z) _ returns z WHATEVER you apply to it, asusming v doesn't occur in z. This is the equivalent of Haskell's const z
Ryder Mitchell
It's 'k z', muthafuckaaaa
Carson Lee
When is someone going to put functional language features into a language that doesn't have syntax like ass?
Michael Morales
Got it. Thanks! I guess my confusion arose from the fact that the return value and the parameter are the same...
Josiah Gray
What would this look like in Haskell?
Cameron Cooper
\v -> z \_ -> z const z pure z
Jaxson Powell
They tried that with Haskell, but they accidentally the whole eager.
Ryder Russell
>pure z >fire up GHCi, it works wat
I assume this has something to do with (->)'s instance of Applicative?
Hunter Young
Yes. pure is K and is S!
Carson Lee
Just looked it up. My face when the definitions for 'pure' and '' for functions are literally 's' and 'k'.
What does it mean?
God fucking damnit, you beat me to it by like 30 seconds.
What does it meeeeeaaaan?
Connor Peterson
>there isn't an OS where files and their extensions are sigma types >there isn't even an OS where files and their extensions are existentials
Cooper Harris
That would be the same thing you dumbass.
Logan Ward
WWWWHHHHYYYYYYY
Lucas Martin
not all sigmas are existentials
Thomas Hughes
Σx:A.B(x)
"There EXISTS x:A such that B(x) is true". Where truth just means there's an inhabitant of that type.