|
hackbunny posted:I just realized that I was confusing Haskell with Ocaml How to tell them apart: OCaml has really bad syntax and non-overloaded operators, so you have to write '+.' to add floating point numbers. This is in contrast to another ML language, Standard ML, where '+' is overloaded and it somehow manages to be even worse.
|
# ¿ Nov 19, 2014 17:17 |
|
|
# ¿ May 4, 2024 02:15 |
|
multigl posted:i have strong opinions about sorting, Any program is just a sort with a sufficiently complicated comparison operator. This is serious stuff.
|
# ¿ Jan 19, 2015 09:15 |
|
Lysidas posted:i got used to making "load up in intellij and reformat code" step 0 of grading anything very quickly Sure, let me just load up this gigantic loving monstrosity to do a thing that has been done by the sub-100k program indent(1) since the 80s[0]. [0]: If indent(1) is insufficient to reformat the code to be readabel, replace the students, not indent(1)[1][2]. [1]: Hey, this makes me think of something my beard isn't yet big enough for me to know: why is it Unix tradition to put manpage section indexes after program names when writing about them? [2]: The [1] is not a manual section, but a footnote, like this one.
|
# ¿ Jan 23, 2015 15:38 |
|
prefect posted:sometimes there are man pages in different sections with the same name, but they're written for different audiences/uses Yeah, but Unix weenies (like me) tend to do this for everything. Are people really going to be confused about what I mean by gcc if I do not write gcc(1)? Also when explicitly discussing a program.
|
# ¿ Jan 23, 2015 18:51 |
|
tef posted:hi from fosdem Hi back. Did you see anything horrible yet?
|
# ¿ Feb 1, 2015 00:22 |
|
rjmccall posted:pre-ANSI C compilers usually didn't support passing or returning aggregates by value; ofc ANSI C is more than twenty-five years old, but... I am implementing a programming language that compiles to C, and I was going to make the resulting functions return structs. Is this a bad idea? The idea is that the C code would be compiled alongside whatever program you want to use it in, so the same compiler. I just never see C APIs return structs by value for some reason.
|
# ¿ Feb 17, 2015 14:55 |
|
rjmccall posted:no, if you're generating c, it's fine. if you ever decide you want to do native compilation, even just partially (e.g. by emitting global assembly in your c output), it might make things a lot more awkward, and you might want to consider breaking abi at that point (if for no other reason than looking at your platform's calling convention and deciding you can do better, which in all odds you can) I don't really care about ABI compatibility (the idea of my language is that it's used for a computational kernel, which you compile to C, and link with the rest of your C program), so I guess I'm good either way.
|
# ¿ Feb 17, 2015 23:17 |
|
sarehu posted:Oh tef what's the name of the parsing algorithm where you maintain a stack of ASTs and it is Sounds like SLR.
|
# ¿ Feb 23, 2015 12:57 |
|
Pollyzoid posted:shows that I haven't used statically typed languages in ages. I am sorry for your loss.
|
# ¿ Feb 25, 2015 20:18 |
|
rrrrrrrrrrrt posted:library authors do all this to great effect What is the periodic part in this so-called "periodic table"?
|
# ¿ Mar 4, 2015 07:46 |
|
tef posted:4. prolog is a programming language 5. Prolog is an imperative programming language. You add a built-in predicate that succeeds while performing a side effect. printButts([butt | Butts ]) :- !, print('found butt'), printList(Butts). printButts([ _ | Butts ]) :- printButts(Butts) "Practical" Prolog can be some really nasty poo poo. No idea why anyone would take something so beautiful and make it so nasty.
|
# ¿ Mar 6, 2015 08:22 |
|
Basically, if you want to learn Prolog, actually learn Datalog.
|
# ¿ Mar 6, 2015 08:26 |
|
Shinku ABOOKEN posted:i havent used prolog but aren't head() and tail() algebraic types in this example? if you want to use a head() you have to have head() in your function (does prolog have functions?) Prolog does not have functions, only predicates. 'head(List, X)' means to see if you can take the head of List and unify it with X, which is done by checking all the rules for 'head'. There is probably only one such rule, and it looks like this: head([X | _], X).
|
# ¿ Mar 6, 2015 10:42 |
|
The really dumb thing is using -Werror in production or distribution, precisely for the reason of code being broken by compiler upgrades.
|
# ¿ Mar 12, 2015 22:55 |
|
DaTroof posted:i had a manager who quoted some statistic that the average web app gets completely rewritten every 18 months or something. It's early, read "manager" as "teenager". Seemed to fit.
|
# ¿ Apr 14, 2015 06:21 |
|
They are switching to F# as the introductionary language at my department. It used to be SML. Not sure whether I should be happy. Does F# work well on Mono?
|
# ¿ Apr 15, 2015 07:54 |
|
At least in Haskell, infix operators are a syntactical category by itself, so you will immediately know what is and is not an operator. And also <*> and <$> are pro names, and you are wrong if you think otherwise. Anything, the thing about the syntactical category is that in SML, you can declare any token to be an operator. infix butts fun x butts y = x + y But it gets even better, because you can have local infix declarations in let-blocks: fun whatever a b c = ... lots of code ... let infix x fun f x g = ... in ... f x y (* So what does this mean now? *) Of course, SML programmers abuse this (there is no "use" for this feature) constantly.
|
# ¿ Apr 18, 2015 08:35 |
|
Arcsech posted:first:rest or similar is much clearer The nice thing is that you can map over some list "xs" (or "params" or whatnot), and then call each specific element "x" (or "param"). Small touches. Haskell is needs suiting, but it can definitely be abused. I like being able to have a "<|>" operator when writing parsers. I maintain a 23k+ SLOC Haskell codebase, and I don't think it defines a single infix operator.
|
# ¿ Apr 19, 2015 11:57 |
|
sarehu posted:
People are not laughing as much at this as they should be. A cursory glance some time ago suggested that Nim might be interesting. Guess not. My language is saner.
|
# ¿ Jun 5, 2015 10:32 |
|
Soricidus posted:it's very important because this way people who like CamelCase and people who like whatever_dumb_name_they_use_for_this_style can all do their preferred thing and it'll just work! Yeah, it kind of makes sense if you get really drunk and/or high first.
|
# ¿ Jun 5, 2015 11:12 |
|
Tiny Bug Child posted:i'll bite; why has the sperg programming hivemind decided this is bad? Same things should look the same everywhere. There is no way this feature can be used for Good and not Evil.
|
# ¿ Jun 5, 2015 19:32 |
|
Gazpacho posted:'I don’t think C gets enough credit. Sure, C doesn’t love you. C isn’t about love–C is about thrills. C hangs around in the bad part of town. C knows all the gang signs. C has a motorcycle, and wears the leathers everywhere, and never wears a helmet, because that would mess up C’s punked-out hair. C likes to give cops the finger and grin and speed away. Mention that you’d like something, and C will pretend to ignore you; the next day, C will bring you one, no questions asked, and toss it to you with a you-know-you-want-me smirk that makes your heart race. Where did C get it? “It fell off a truck,” C says, putting away the boltcutters. You start to feel like C doesn’t know the meaning of “private” or “protected”: what C wants, C takes. This excites you. C knows how to get you anything but safety. C will give you anything but commitment Why do people fetishize C to this degree? It is just a programming language. It is not particularly unsafe - it is even stronly typed! It is not some exotic, dangerous thing, it is one of the most mainstream and widely used languages you can get. Using C does not make you a cool bad-rear end, it just makes you another C programmer out of tens of thousands.
|
# ¿ Jun 12, 2015 10:47 |
|
JewKiller 3000 posted:C is not strongly typed in any meaningful way. in fact, C is the prototype example of a weakly typed language. there are implicit type conversions all over the place, and unsafe casting is the norm. a type in C is really just a way to tell the compiler how much memory it needs to allocate, and that's about it There are not many implicit type conversions in C. It is strongly typed but with many ways to cheat the system. That just makes it unsound, not weak.
|
# ¿ Jun 12, 2015 23:39 |
|
Dynamic typing can be OK. Implicit conversions can be OK. But they are never OK together. PHP is stupidly typed.
|
# ¿ Jun 13, 2015 09:21 |
|
comedyblissoption posted:IEnumerable thunks in order to implement a lazy evaluation strategy. Lazy evaluation is much easier to compose 'good-enough' performant queries. As a simple example: So that means it will never evaluate in parallel? That would be weak. Also that .NET GC sure is something. Look at all those #ifdefs - I count 62 different predicated symbols (including both DEBUG, _DEBUG, DEBUG_DestroyedHandleValue and DEBUG_WRITE_WATCH). I wonder how many permutations actually work.
|
# ¿ Jun 15, 2015 10:32 |
|
MeruFM posted:is fold the same as reduce? Usually nowadays I see fold being used for sequential folds, with reduce being used for folds with an associative binary operator with a neutral element (this is called a monoid in algebra). These can be trivially executed in parallel using tree reduction, which is not the case for any old fold. But this is new terminology. Common Lisp uses just reduce, which is a straight left-to-right sequential fold. Athas fucked around with this message at 16:26 on Jun 17, 2015 |
# ¿ Jun 17, 2015 16:24 |
|
Common Coder posted:with regard to "good syntax" being a bad goal, this feature is not good and it's not useful. i suppose an alternative to this could be: Variable declaration is not the same as variable assigment, and 'a += 0.5' sure as hell better not be a variable declaration, especially not one that involves dubious implicit type conversions. What's the problem with putting 'var' in front when a variable is declared? How do you handle type errors? You mentioned some stuff about picking the highest-precedence type (???), but what if that conflicts with a previous assumption/constraint? How do you deal with variables whose values/types are given by the return type of a function, maybe even by a recursive call? Now, you can make a language without studying type theory, but only if you (0) make it dynamically typed, or (1) require liberal type annotations, and you seem to be going for neither. This is not an easy problem. My own language (purely functional, data-parallel, aggressive optimising compiler and aimed at GPU execution) is fully monomorphic and requires explicit function parameter/return type annotations, because the world really does not need another half-assed way of being clever about static types.
|
# ¿ Jun 27, 2015 14:00 |
|
Soricidus posted:nah, designing languages is fun. who doesn't like messing with syntax? No real language designer likes messing with syntax. It takes way too much effort for something that is totally superficial and ultimately mostly up to individual taste. And writing parsers for new grammars loving suck - either you use a parser generator and it loving sucks, or you use a parser combinator library and you don't get told about ambiguities and other problems, or you hand-write a parser and it still loving sucks.
|
# ¿ Jun 27, 2015 23:00 |
|
Volte posted:
This looks cool. When do you think you can get some performance numbers? (My experience is that compiler work motivation is fragile if you don't have a code generator.)
|
# ¿ Jun 29, 2015 16:44 |
|
pepito sanchez posted:R sucks and can't possibly have become popular if it wasn't easily applicable in data analysis. i gave up on R early on and started on python for DA. please tell me if i'm missing out on something other than a few loving libraries that make some computations a little faster. terrible programmer posting so please just tell me why R means a poo poo, because i see it taught at university and it tops out benchmarks like that still means anything et cetera Some people like R (I used it a little) because it is better than Matlab. As in, it feels slightly more like a real language, and not just glue for getting library functions to stick to each other. But Python is even better for that purpose, so don't look back.
|
# ¿ Oct 4, 2015 08:01 |
|
Internet Janitor posted:would there be actual interest in an APL/J/K thread in CoC, or would it just be pages and pages of "this is unreadable", "what's with the funny symbols", etc Would read and participate! I have a colleague who works on a compiler for a statically typed APL dialect, and I hope to get involved at some point. It is an amazing language that I still do not understand fully. Gazpacho posted:arrays in haskell make me lol Arrays in most languages make me lol, they all get it wrong! For example, Haskell's Data.Array lets you define the index space as all sorts of crazy things. The way you define an N-dimensional array is to define an array where an index is a tuple of N integers. But then you cannot efficiently perform partial indices, e.g. index that N-dimensional array with a single integer to get an (N-1)-dimensional array. Data.Vector isn't better as I remember it. And no, using arrays of arrays is not the same thing, we are not primitive C programmers here. Arrays are surprisingly hard to get right, and I suspect they pretty much have to be a builtin to be both safe, performant, and expressive. (Fortran gets it right but gets so much more wrong.)
|
# ¿ Nov 30, 2015 07:12 |
|
gonadic io posted:Last I checked, Data.Vector makes your index be an int and so disallows N-dimensional arrays completely unless you do the conversation yourself or have arrays of arrays. Yes, so it's like C. It's efficient, but not terribly expressive. gonadic io posted:Have you seen Repa though? It's my understanding that it's based off of fortan's arrays and does allow efficient sectioning Yeah, Repa is better, but it's very notationally and conceptually heavyweight (it really pushes the type system), so still not nearly as nice as arrays in true array languages. For example, if you have a two-dimensional array of integers, you should be able to map a function that takes a single-dimensional array and produces an integer, and end up with a single-dimensional array (just like you can do with a list or array-of-arrays). This is not terribly nice to express in Repa.
|
# ¿ Nov 30, 2015 11:32 |
|
The #1 thing I never understood about XML is why the XML tooling languages tend to have XML syntax. XML has some advantages, but surely as gently caress not that it is nice to write by hand.
|
# ¿ Dec 29, 2015 11:28 |
|
What exactly does a single-pass compiler imply? That you cannot have mutually recursive modules or what? You cannot in Haskell either, but I've never felt that as much of a restriction.
|
# ¿ Mar 12, 2016 13:22 |
|
Okay, that does suck rocks. So it's like Standard ML where mutually recursive types and functions have to be declared in a stupid explicit manner?
|
# ¿ Mar 12, 2016 16:40 |
|
fart simpson posted:what languages are you referring to? It sounds like SML (and other ML languages), whose top-level semantics are inspired/based on REPL-like interaction, even in files. This leads to all sort of amusing shenanigans, like being able to shadow top-level type declarations. And of course, have script-style side-effecting expressions that are evaluated when the file is included. This leads to amusing consequences/restrictions when you want to actually compile the code, none of which I can clearly remember. It is a bad design. For all of its other warts, at least Haskell doesn't do it like that, but instead requires a traditional main function.
|
# ¿ Mar 14, 2016 08:52 |
|
Haskell slow. Still use it.
|
# ¿ Mar 16, 2016 10:51 |
|
Dessert Rose posted:it's a meaningless piece of paper, at best it's good for telling you whether someone with zero experience might be capable of doing the job. in a couple years, after they've gotten all the ivory tower bullshit pounded out of them I'm okay with a preference for experience over education, but what kind of "ivory tower bullshit" is being taught in CS programs? I mean, knowledge that is actually harmful (or maybe just useless, but you make it sound like it has to be removed entirely)?
|
# ¿ Mar 27, 2016 15:50 |
|
Mr Dog posted:Professional educators say Python is hard to teach on account of the indentation poo poo, which is rather disappointing. I've been a TA in a course that was teaching first-year university science students to program in Python, and the indentation poo poo was not a problem. The biggest problem was getting the interpreter and whatever installed on Windows. Side effects were also a little bit of a problem. Not the obvious ones about setting global variables, but the subtle ones where you pass lists by reference and then call mutating methods like append(). Also, stop using tabs in your Haskell.
|
# ¿ Apr 26, 2016 09:14 |
|
|
# ¿ May 4, 2024 02:15 |
|
Bloody posted:someone tell me a little bit about cuda vs opencl CUDA is much nicer to use in hand-written code. If you can use something like PyOpenCL, then there is less difference. CUDA is limited to NVIDIA hardware, OpenCL can use many kinds of GPU (also NVIDIA), multicore CPUs, and even exotic things like FPGAs (although I haven't tried it myself). OpenCL is much nicer as a code generation target.
|
# ¿ Apr 27, 2016 23:17 |