|
AlsoD posted:you did pick the example in which two nested binary trees are probed, i don't think there's any language where needing to account for 12 or so different cases would be anything other than a whole load of code. i don't find writing it so bad and it's kinda cool to solve small problems with it. imo it's a really extreme case of 'code is twice as hard to read as write' or however it goes.
|
# ? May 1, 2014 16:48 |
|
|
# ? Jun 5, 2024 07:59 |
|
pointsofdata posted:
lmao is this supposed to be human readable code
|
# ? May 1, 2014 16:51 |
|
it looks like a translation of the algorithm as written in a textbook (that was hopefully proved correct)
|
# ? May 1, 2014 16:56 |
|
pointsofdata posted:
that is unbelievably awful
|
# ? May 1, 2014 17:13 |
|
All languages should be designed with syntax highlighting in mind
|
# ? May 1, 2014 18:28 |
|
USSMICHELLEBACHMAN posted:All languages should be designed with syntax highlighting in mind
|
# ? May 1, 2014 18:36 |
|
haskell has unbelievably beautiful syntax when it is properly highlighted and indented
|
# ? May 1, 2014 18:41 |
|
i'm the bin
|
# ? May 1, 2014 19:02 |
stoutfish posted:i'm the bin i'm the lx Tip
|
|
# ? May 1, 2014 19:08 |
|
Shaggar posted:that is unbelievably awful balancing binary trees in any language sucks rear end since it's all pattern matching at least pattern matching is natural in Haskell whereas its totally awful in java/C# code:
|
# ? May 1, 2014 19:20 |
|
USSMICHELLEBACHMAN posted:haskell has unbelievably beautiful syntax when it is properly highlighted and indented I want a screenshot of this
|
# ? May 1, 2014 19:43 |
|
Symbolic Butt posted:I want a screenshot of this just browse through here http://learnyouahaskell.com/zippers
|
# ? May 1, 2014 19:46 |
|
someone mention network stacks on one of these threads why is bsd network stack a thing (as in why care that it originated in bsd or whatev) and why does windows having its own network stack matter? i mean how different can stacks be? it's all just bit shuffling with packets using well defined protocols (tcp/ip etc.) can someone tell me why should i care? sry if my quuestion is not clear i have a flu
|
# ? May 1, 2014 19:48 |
|
USSMICHELLEBACHMAN posted:just browse through here no coloring of constructors this is some code from my game in the Monokai ST3 theme:
|
# ? May 1, 2014 20:01 |
|
Shinku ABOOKEN posted:someone mention network stacks on one of these threads paging hackbunny
|
# ? May 1, 2014 20:10 |
|
Malcolm XML posted:balancing binary trees in any language sucks rear end since it's all pattern matching the content size doesn't seem that different. Java is just bigger bc 1. comments 2. word variables vs character variables Also what's going on here? code:
|
# ? May 1, 2014 20:55 |
|
AlsoD posted:lens cheers! had completely forgotten about o'sullivan and real world haskell, so think ill make a start on that. also lookin through the container lib you linked, hoo boy i got a lot to learn - i remember a lot less from LYAH than i thought i did
|
# ? May 1, 2014 21:18 |
|
USSMICHELLEBACHMAN posted:just browse through here AlsoD posted:no coloring of constructors I was expecting something crazier like this ruby thing: http://chriskempson.github.io/base16/#monokai it's like they hate white or something
|
# ? May 1, 2014 22:28 |
|
Symbolic Butt posted:I was expecting something crazier like this ruby thing: i hate whites too
|
# ? May 1, 2014 22:33 |
|
AlsoD posted:no coloring of constructors this code is much easier to read than the previous examples but i think the main reason for that is that you actually named your variables clearly
|
# ? May 1, 2014 23:15 |
|
maybe
|
# ? May 1, 2014 23:37 |
|
haskell is very readable it's just weird if you're coming from an imperative language because it's different
|
# ? May 1, 2014 23:37 |
|
USSMICHELLEBACHMAN posted:haskell is very readable it's just weird if you're coming from an imperative language because it's different i keep reading and re-reading that img posted a bit ago and it makes my eyes instantly glaze over in a way that not even C can
|
# ? May 1, 2014 23:40 |
|
uncurable mlady posted:i keep reading and re-reading that img posted a bit ago and it makes my eyes instantly glaze over in a way that not even C can yeah it's because it's far removed from any language you've learnt
|
# ? May 1, 2014 23:52 |
|
USSMICHELLEBACHMAN posted:All languages should be designed with syntax highlighting in mind yeah thats so much better. beautiful.
|
# ? May 1, 2014 23:52 |
|
MeruFM posted:Also what's going on here? it's a type declaration, so balanceL is a function that takes a thing and two sets of that thing and returns a set of that thing. or maybe it takes a thing and a set of that thing and returns a function that takes a set of that thing an returns a set of that thing anyway that's just the types, it will all be much clearer when we get to the declaration and see the argument names code:
|
# ? May 1, 2014 23:56 |
|
Erlang (sorry Mono)
|
# ? May 2, 2014 00:00 |
|
suffix posted:it's a type declaration, so balanceL is a function that takes a thing and two sets of that thing and returns a set of that thing. there's a comment in the line above that says that it does. it makes a binary node with x as the element, l as the left subtree and r as the right subtree. it's also specialised to check if it needs to rebalance since the left might be bigger than the right (and balanceR is the same for the other case).
|
# ? May 2, 2014 00:02 |
|
suffix posted:it's a type declaration, so balanceL is a function that takes a thing and two sets of that thing and returns a set of that thing. http://groups.csail.mit.edu/mac/users/adams/BB/ it's a left biased balancing of treesets x is the value of what ur storing, l is the left subtree, r is the right subtree names are lovely though but seem to be consistent in using x as the value. I assume it's something like data Set a = Tip | Bin Int a (Set a) (Set a) where the int is the height of the tree or something similar
|
# ? May 2, 2014 00:02 |
|
Set<TypeOfElement> insertAndPossiblyBalanceLeftSubtree (TypeOfElement element, Set<TypeOfElement> leftSubtree, Set<TypeOfElement> rightSubtree)
|
# ? May 2, 2014 00:04 |
|
lolcode:
|
# ? May 2, 2014 00:05 |
|
Malcolm XML posted:lol even worse is that they can't use any convenience libraries
|
# ? May 2, 2014 00:06 |
|
that reminds me is there a reason you have to import something to get foldl' instead of just foldl (also i thought that the ' is meant to denote side effects or something?)
|
# ? May 2, 2014 00:18 |
|
pointsofdata posted:that reminds me is there a reason you have to import something to get foldl' instead of just foldl (also i thought that the ' is meant to denote side effects or something?) the ' (called "prime") can denote a couple of things, but in this case it's strictness. foldl' evaluates its initial param before recursing
|
# ? May 2, 2014 00:21 |
|
pointsofdata posted:that reminds me is there a reason you have to import something to get foldl' instead of just foldl (also i thought that the ' is meant to denote side effects or something?) backwards compat is why the prelude sucks and is lazy list heavy foldl' won't cause memory leaks with huge finite lists since it is strict in the accumulator
|
# ? May 2, 2014 00:24 |
|
pointsofdata posted:that reminds me is there a reason you have to import something to get foldl' instead of just foldl (also i thought that the ' is meant to denote side effects or something?) historical reasons the ' means that it's strict. it's late for me so I'm just going to link this discussion of the differences than type one up myself but to be brief: there's no reason to ever use foldl instead of foldl' since the way it works is that you need to evaluate stuff to do anything anyway so you might as well be strict which speeds things up and makes it run in constant space foldr on the other hand you DON'T want to be strict (and hence there's no foldr') since the way it's set up is that if you have a function that is productive* then you can lazily evaluate its results *: by "productive" here I mean that it will add an actual data constructor in front of your thing i.e. adding elements on front of a list or whatever tl;dr: if you have things that don't benefit from laziness (ints for example) use foldl' and if you have things that you do want to be lazy (lists for example) use foldr.
|
# ? May 2, 2014 00:26 |
haskell is a useless language deemed as such by its lead designer and exists solely for the purpose of improving more useful languages like c#
|
|
# ? May 2, 2014 00:32 |
|
common haskell naming conventions: a ' after a haskell function means it's a strict version a M afterwards means it's a side-effecting (monadic) version and returns the results too a M_ afterwards means that it does side effects but throws away the results see: map, map', mapM, mapM_, mapM'_
|
# ? May 2, 2014 00:33 |
|
double sulk posted:haskell is a useless language deemed as such by its lead designer and exists solely for the purpose of improving more useful languages like c# sulk have you done anything of note in haskell or c# or did you just watch that four minute video of spj and Form An Opinion
|
# ? May 2, 2014 00:34 |
|
|
# ? Jun 5, 2024 07:59 |
|
double sulk posted:haskell is a useless language deemed as such by its lead designer and exists solely for the purpose of improving more useful languages like c# people (you and shaggar) keep citing this triumphantly, have you watched the rest of the video (from 3-4 years ago) where he gives a little more context on that statement?
|
# ? May 2, 2014 00:35 |