« first day (1805 days earlier)      last day (3147 days later) » 

user1804599
11:00 AM
The JVM has some warts such as overloading.
 
why don't you target terra
 
user1804599
what is terra
 
you're a terra
 
user1804599
does it have an OMG HUGE ecosystem?
 
@elyse you knew, but forgot
@elyse it lives within the C ecosystem
 
user1804599
11:02 AM
terrible
 
JVM calls into C as well
if you're making a native language, you basically have to support wrappers for 1000s of C libraries from day one
otherwise it's terrible.
 
user1804599
I think targeting the JVM is a good idea.
 
user1804599
And also fun.
 
why not CLR?
 
user1804599
because CLR on non-Windows is still a myth and the entire ecosystem assumes you use VS and if you don't then hahaha fuckyou
 
11:05 AM
I don't think it's a "myth" really
now that Mono took the opensourced parts of the implementation
 
user1804599
also I want to write the compiler in Scala and writing the compiler in Scala but targeting the CLR is silly
 
> People Who Need to Pee Are Better at Lying
awesome research src
@elyse bogus. CLR is not a myth at all. Where is it a myth?
@BartekBanachewicz That's unrelated. But yeah, that further improved coverage BCL availability
@elyse woot. way to hide the real motivation
 
@BartekBanachewicz can I like get rid of some of the parens here? appendedString = ((head . show) $ (n mod` 2)):res`
I'm learning about . and $
 
fix infix
 
aah, I can also do mod n 2
yep thanks
 
11:12 AM
I meant fix the backtick quoting lol
 
lol
I don't even know how to escape things in this markdown thing or w/e
 
appendedString = (head . show $ (n `mod` 2)) : res is as far as I'd take it
 
so you don't like ((head . show) $ mod n 2):res
 
@AlexM. (head . show $ mod n 2):res
actually
 
Oh yeah. I forgot infix named operators in haskell are the funnies
 
11:14 AM
ye
 
hm so (head . show) was superfluous
 
that's the magic of ($)
 
it makes sense because head . show creates a new function
and $ does application with the lowest precedence or w/e
 
yeah
infix application of functions should still have greater precedence
main = print f

p = (+1)
f = p . p $ 5 `mod` 3
MCE ^
anyway, parens don't always hurt
also where bindings can help you get rid of them
appendedString = x : res
    where
        x = head . show $ n `mod` 2
 
yea the appended string was in a where
intToBinString :: Int -> String -> String
intToBinString 0 res = res
intToBinString n res = intToBinString (n `div` 2) appendedString
  where appendedString = (head . show $ n `mod` 2):res
 
11:19 AM
you can nest where clauses
or in this case just reuse it
 
is this kind of tail recursion optimization thing necessary in haskell?
I did it a lot in Scheme
 
@AlexM. wait where's the optimization again?
 
you pass the result as parameter to each call and when you're done you return it
 
why would that be an optimization of anything?
 
lemme think
 
11:23 AM
(also I assume you're doing it for learning purposes, otherwise Numeric.showIntAtBase and Data.Char.intToDigit)
 
That standard proposal which overloads operator|| and operator&& to avoid short-circuit evaluation.
 
the idea is that if I don't keep building the result with each call
the result will be built progressively as the functions end and you go back to the beginning of the stack
 
@AlexM. can you elaborate on the difference?
 
e.g. if I did something like appendedString:intToBinString...
at 2.3.3 Tail Recursion
 
> Remarks: This function is assumed to access and modify every memory location in the program, without inducing data races.
 
user1804599
11:25 AM
Never overload && and ||.
 
@BartekBanachewicz yea I don't know much about what exists already, thx
 
@AlexM. pretty much everything, tbh
 
@elyse It made sense in this specific case.
 
user1804599
link
 
11:26 AM
@AlexM. well, in this case the maximum of stack depth would be 64, so not bad anyway
 
user1804599
terrible
 
user1804599
don't do that
 
user1804599
call it and_ and or_.
 
what I found interesting in racket is that there's no concept of stack overflow
I noticed haskell does have it
 
@elyse That's fugly.
 
11:28 AM
> noise produced by voltage regulators of the CPU
crypto is hard
 
1 message moved to bin
 
user1804599
@Morwenn fugly but not full of terrible surprises.
 
yesterday, by Columbo
By clicking "send" you agree to the terms and conditions.
for @user2802539 ^
 
> Kyrostat is not dead.
lol
 
@elyse I guess you already know you're doing sensible things when you start using data-invariant stuff.
 
11:30 AM
@AlexM. Yeah, I guess it makes sense. Except I think in Haskell, if I hit such problem, I might as well fall back to an iterative solution
now that I'm armed with a hammer ST monad, everything looks like an imperative problem, lol
 
I find it easier to reason if I build the result like that, I mean it's the first thing I write
 
in real-world code you won't have to write complex recursive functions anyway (IME)
typically you can use a library like conduit that will help you to stream computations
or a solution can be expressed as map/fold
 
@BartekBanachewicz I don't know how idiomatic this guy's solution (to the same problem) is, but I liked how it looked pastebin.com/T3h7JLrZ
it looks less crowded because it doesn't use parens everywhere (like mine)
 
like, dunno, intToBinString x = map (\b -> if x `setBit` b then '1' else '0') [1..64]
 
Can anyone suggest book for "Large C++ Projects Architecture"... I found the book of 'John Lakos'
 
11:38 AM
@AlexM. very.
a rather good one as well
 
user1804599
@BartekBanachewicz all loops can be expressed with fold
 
heh, the fact that we can craft at least a few dozen solutions to such a simple problem might be a huge counter-haskell argument for some
@elyse I forgot "easily"
 
@BartekBanachewicz yea but I like looking at what others wrote
once you finish a problem you can see all solutions by everyone who submitted theirs
 
the problem is when reading code of course
 
split into two categories, "Best Practices" and "Clever"
 
11:40 AM
nice
 
@elyse Honestly, I can't even remember if I had started implementing it :) Do you remember the last state of confx?
 
user1804599
no
 
@BartekBanachewicz one of the next problems is to interpret a brainfuck program and I thought about defining a type like data BrainfuckInstruction = <some instruction> | <another> and then use pattern matching inside a function like interpretInstruction state instruction
I saw that each instruction that's part of the type can have its own constructor and stuff
does that make sense?
 
@AlexM. Those instructions are constructors.
 
right, they're constructors for BrainfuckInstruction?
ah nvm I get it
what I meant was that each instruction could have its own parameters
 
11:46 AM
yes.
@AlexM. one of them could be a list of instructions :)
 
e.g. data SomeGenericInstruction = AddInstruction Num Num | SqrtInstruction Num
sth like that, not sure I got it right
but that's what I meant
 
data BFInstr = Plus | Minus | Left | Right | Loop [BFInstr]
 
so using data does make sense then, cool
 
@AlexM. Num is a type class, not a type.
 
so it has to be Num a?
a is a type variable IIRC
 
11:48 AM
@AlexM. yeah, in this case you have a closed set of instructions so it's fine
@AlexM. No, don't apply constraints to type variables of data constructors unless the data type forms an existential type.
as in, you can, but there's no point.
 
I always wondered why vim would open up whenever I pressed 'v' — puk Dec 3 '13 at 23:13
lol
 
@AlexM. anyway in Brainfuck instructions don't carry state
 
but you have a global state that they operate on
 
Awesome answer. To the point, complete. I approve of this :) — sehe just now
 
I intended interpretInstruction state instruction to apply instruction to state and return the new state
 
11:52 AM
@AlexM. I suggest representing that using State monad.
@AlexM. oh you don't into monads yet?
 
nope everything I used so far was really just list processing :)
 
TLDR State just passes that parameter so you don't have to
but it's really equivalent to doing it manually
 
I'll take a look
 
mmm
might be a shock
 
I remember the article about monads with lots of pictures being posted here ages ago
but it only made sense yesterday, since it used actual haskell code that I did not know how to read then
 
11:54 AM
@AlexM. Well, you can use monads without understanding how they work in depth
but in the long run I guess the knowledge helps
 
do you do that selective import thing
 
user1804599
@sehe user1
 
user1804599
that's jeff atwood
 
only importing specific functions from modules I mean
 
@AlexM. yeah
 
12:01 PM
@elyse I'm not interested in designing programming languages at the moment. You can adopt the confx project if you want ;)
 
0
Q: C++ specific UML modelling of pointers/references

ManuelSchneid3rIn C++ value types implicitely are of the strongest aggregation, but I can imagine the followoing five relations between classes when pointers/references are used (odered by strength of aggregation): information level +------+------+------+------+ v ownership>| none | weak |share...

 
@Morwenn while on the bike today I had a genius idea
 
we can create another sorting algorithm, complementary to pdqsort
using your timsort 'runs' idea
I have a scheme in which quicksort uses O(n) memory (just like mergesort), however, it becomes stable
 
Well, my algorithm isn't stable though :/
 
12:04 PM
but if we just take the spirit of your idea
and just steal the actual implementation of timsort
(which is stable)
 
Mainly because is uses reverse prior to a merge for reverse-sorted. If we create a function to merge a sorted and a reverse-sorted sequence, it might become stable.
 
we can create an O(n) memory stable sorting algorithm with the speed of quicksort, but the stability of mergesort, and the linearity of timsort on patterns
 
That sounds like the ultimate sorting algorithm xD
 
not really, pdqsort is still better if you need in-place :P
 
I find this whole application and composition to be the hardest parts to grok
 
12:06 PM
@orlp Of course, but still...
 
like I see things and I feel they won't work but can't explain why unless I try really hard to think
 
@fredoverflow I have to lol at Kotlin's solution to operator overloading
 
@AlexM. here's a stateful example w/o AST parsing. Would be harder to add loops to it I suppose
but I think it illustrates State nicely
 
user1804599
@thecoshman why?
 
By the way, do you know which stable sorting algorithm could be better than mergesort for small collections for forward iterators? Insertion sort doesn't work with forward iterators and isn't stable :/
 
12:07 PM
@Morwenn basically the idea of the stable quicksort isn't novel (I did some research), but I did invent it independently myself
you just partition into a second, equally sized buffer
 
I'll take a look thx
 
@elyse oh sure it works, but having to call it fun plusAssign opposed to just fun operator+=
 
@orlp Well, I independently invented cocktail sort and counting sort even though they suck :p
 
@Morwenn :D
 
I'm still cleaning up my code, I got rid of that int -> binstring function and replaced it with the Numeric equivalent
intToFixedBinString :: Int -> Int -> String
intToFixedBinString n bitcount = extraPadding ++ binstr
  where binstr = showIntAtBase 2 intToDigit n ""
        extraPadding = take (bitcount - length binstr) $ repeat ('0')
yay
 
user1804599
12:08 PM
@thecoshman custom assignment operators are an incredibly bad idea the way they're done.
 
> An IDE, or "Integrated Development Environment" will turn you stupid. They are the worst tools if you want to be a good programmer because they hide what's going on from you, and your job is to know what's going on. They are useful if you're trying to get something done and the platform is designed around a particular IDE, but for learning to code C (and many other languages) they are pointless.
Am I doing the C community a disservice with my IDE project?
 
@Morwenn selection sort might be optimal if the collections are really small
 
user1804599
val x = new A
val y = x
y += 2 // does this change x?
 
@fredoverflow No
 
user1804599
can't tell! depends on whether += was overloaded or not!
 
12:10 PM
@Morwenn I think selection might be the best you can do in O(1) memory at least
 
@thecoshman Hmm... what do you think is wrong with it?
 
@fredoverflow god this note is so braindeadly stupid
the tablature analogy i mean
 
@elyse in a language where every object is immutable you could make a += b sugar for a = a + b
 
user1804599
thanks captain
 
no problemo senore
or seniorita
 
12:12 PM
@BartekBanachewicz agreed
 
@orlp Selection sort needs to move the elements to the right in order to be stable. The only remaining simple sort that is stable and works with forward iterators is bubble sort...
 
the design of the site looks cool tho
but not very C-ish
 
@Morwenn No?
 
Ell
Hmm does navy trousers go with black t shirt?
 
I think if you want to learn C you should learn from an as ugly website as possible
9
 
12:13 PM
@fredoverflow this guy's an asshole
 
@orlp I have been benchmarking it, and it seems to be the perfect fit to end my mergesort so that I don't allocate many small buffers...
 
@fredoverflow nothing wrong, just funny that they use plusAssign rather than operator+=
 
@fredoverflow Holy shit where does that come from?!
 
user1804599
@Ell yes
 
for loops in BF you just need a stack of opening parens right?
and that stack will be a sequence of incrementing indices?
 
user1804599
12:15 PM
@BartekBanachewicz brackets, yes.
 
@fredoverflow You're doing the community a disservice by making it about C :)
 
s = begin
while s != end:
    c = s
    while c != end:
        if *c < *s: swap(*c, *s)
        c++
    s++
@Morwenn pseudocode selection sort with forward iterators
 
@BartekBanachewicz haven't read too much into it but it seemed simple enough at first glance
 
user1804599
you can likely use the call stack as that stack, by making your compiler/interpreter recursive
 
12:15 PM
> was supposedly sending you to a closing paren and < was sending you back
 
@AlexM. < and > are one left and one right
@elyse oh hm
 
I do agree that beginners shouldn't be using an IDE though
 
@fredoverflow bollocks
 
@orlp Thanks. It seems stable. I will benchmark that too.
 
@orlp I don't
 
12:16 PM
@sehe brb, let me just implement my own C++ compiler...
 
it's a tool for and by industry experts
 
bullshit, [citation-needed]
 
it's an information overload for beginners
 
user1804599
Funfact: often when you need a stack, the call stack suffices.
 
@orlp so is using manual commands
 
12:17 PM
@fredoverflow He basically wants to teach beginners how programs are compiled and linked using CLI
 
which is how literally no one sane does that
at the very least a more reasonable build tool is used
 
@BartekBanachewicz But you do need to "know" about it
 
Rust tutorial introduces Cargo very early and I think it's a good idea
 
But there is no harm in understanding what goes behind the scenes.
 
@bluefog why?
@ElimGarak there's a harm of wasting time on irrelevant details
you keep thinking learning new information is free
 
12:18 PM
Knowledge is never irrelevant :P
 
why don't you learn the phone book by heart then
 
@Morwenn actually, not sure if that's stable, I forgot about the stability requirement
 
it's all about prioritization
and when learning a language, learning the intricacies of compiler binary is hardly relevant
 
@Morwenn fairly sure it isn't stable actually
nevermind that
 
@BartekBanachewicz Its not about learning commands btw
 
12:20 PM
anyway the "learn C the hard way" guy is an absolute idiot
 
that's true
 
cpx
> They are the worst tools if you want to be a good programmer because they hide what's going on from you.
What do they hide?
 
@BartekBanachewicz yeah
7 mins ago, by Mr. kbok
@fredoverflow this guy's an asshole
 
Write him an email :P
 
@BartekBanachewicz by the way, I haven't read anything from that book
I just saw you guys discussing IDE's for beginners
so I gave my $0.02
 
12:21 PM
I don't want to say idiot, because, well, I didn't read the books. It seems they are very popular.
 
@Mr.kbok So is PHP.
 
user1804599
PHP is very nice.
 
That should be the end of any popularity based merit argument.
@elyse heathen
 
@fredoverflow implement a smiley preprocessor first :)
 
cpx
I find IDE's very useful since they display all the debug windows, call stacks, processes etc. Saying that they are pointless sounds very wrong.
 
12:22 PM
PHP is bad but the author isn't an idiot
 
> I have some bad news for users of Windows: learning C on Windows is painful. You can write C code for Windows, that's not a problem. The problem is all of the libraries, functions, and tools are just a little "off" from everyone else in the C world. C came from Unix and is much easier on a Unix platform. It's just a fact of life that you'll have to accept I'm afraid.
It's called "progress". Look it up.
 
@Morwenn the hardest part of the stable quicksort algorithm is dealing with unitialized memory
@Morwenn since it must work for objects that don't have default constructors every first move into the buffer must be an uninitialized move
 
@BartekBanachewicz is there a way to avoid this kind of stuff? fromIntegral $ toInteger word
 
@cpx Learning C with a visual debugger is like 10x easier.
 
the whole difference between Int and Integer pisses me off
 
cpx
12:23 PM
> Learn C: Idiot guy's guide.
 
I'd have liked toInt and toInteger to exist instead
 
@cpx But yeah, the "hard way"
 
@orlp Fortunately, we have std::raw_storage_iterator for that.
 
Why would you want to learn anything the hard way? That's like, counterproductive. Download an ebook in Japanese.
 
@Morwenn ... partly
only the first iteration is unitialized memory
 
@ElimGarak hahahah :P
 
cpx
Why make it even more hard when it is already confusing? lol
 
user1804599
> Publisher: ASCII
 
Sounds about right
 
@elyse It's a japanese name now
ASCII Tokoshima
 
user1804599
12:28 PM
ASCII can't hiragana.
 
@orlp Currently, my version that uses a bubble sort outperforms the one that doesn't. Now... time to try yhe selection sort.
 
@Morwenn don't bother though
my version at least isn't stable
 
@elyse For the Japanese, it's exotic.
 
@orlp I thought you said it was :p
 
@AlexM. it's p huge though
2
I mean it's shitty that say length :: [a] -> Int instead of length :: Integral n => [a] -> n
there's a generic prelude available somewhere I think
 
12:34 PM
@Morwenn I was wrong, and I had already corrected myself :P
15 mins ago, by orlp
@Morwenn fairly sure it isn't stable actually
 
@orlp Oh, I read it as « fairly sure it is stable », my bad.
 
you and your hipster « » :D
 
Yeah :D
 
It's French
It's like writing Names LIEKTHAT
 
@Mr.kbok MR. KBOK
 
12:37 PM
lol - cleaning up the hotmail box :) 6818 mails deleted
 
user1804599
@BartekBanachewicz length :: (Foldable f, Integral n) => f a -> n
 
@orlp It's actually M. in French
 
@sehe how dare you delete valuable and personalized spam
 
sehe, discover our selection of medication from canada
 
std::sehe
2
 
12:41 PM
@orlp most of it was old user group posts
 
typedef decltype(sehe) sehe_t; sehe_t sehes[100]; // more spirit questions answered
 
Surprisingly little spam.
 
template<class T> using typename std::sehe<T>::typename sehe_t;
boost::spirit::sehe
 
that's the weirdest haiku I've seen
 
Someone should make the C++ fence namespace
l::l::l::l::l::l
 
12:45 PM
lol
 
@elyse What are the benefits of singleton types?
You mean something like 42.type, right?
 
The selection sort wasn't faster than my bubble sort overall. So... in today's news, I optimized an algorithm with bubble sort.
 
@fredoverflow some objects are intrinsically singleton
memory allocators most notably
 
oh, the memories
 
12:47 PM
insertion sort is stable
and works with fwd iterators IIRC
 
@набиячлевэлиь obligatory na::na::na::na::na::na::na::na::batman
 
@набиячлевэлиь n deep 2n me
 
user1804599
@fredoverflow they could make match a method!
 

ISO C++ proposal review

Feedback, suggestions, and criticism for draft language propos...
 
Ell
12:48 PM
ugh jeez I'm so self conscious about clothing
 
@orlp (n)deep(n+1)me
 
user1804599
class Any {
    def match[R](f: PartialFunction[this.type, R]): R = f(this)
}
 
(2^n) deep (2^(n+1)) me
 
@sehe more like cimploler
 
@sehe yes
@Ell wear utilikilt
 
> The result of this is that we now generate a full tree for functions and can use that same data structure to generate code or to perform static analysis. These same trees are used to evaluate constexpr functions as well, which is a feature we just shipped. We also now track full source position information (including column) for all constructs. We aren’t currently using column information but we want to be able to provide better diagnostics in the future.
 
@orlp He doesn't mean singleton as in singleton design pattern. More like "1 is its own type, 2 is its own type etc."
 
> Over time, this resulted in more than 6,000 #if preprocessor blocks.
 
Ell
12:50 PM
@orlp they aren't singletons o.O
 
@Ell the implementation of malloc is a singleton object, or sometimes one singleton per thread
 
I wonder if the compiler AST is available inside of the program
 
> There are comments in the source from 1982.
 
Ell
12:52 PM
^ I see no getInstance() :V
 
@fredoverflow I only know one example from the top of my head
in Python type(type) is type
 
(type(5) is int and type(int) is type)
 
Ell
You can create multiple allocators
it's not like there is only one std::allocator
 
moot if they all point to the same underlying object
 
user1804599
12:53 PM
A singleton is a type with one and only one inhabitant.
 
yeah I prefer this definition as well
 
user1804599
A global value is not a singleton.
 
user1804599
Neither is a thread-local value.
 
A global value in an object oriented model becomes a singleton
MallocImpl
 
I wonder why brainfuck wasn't created with RLE encoding
as in this ++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++‌​.------.--------.>>+.>++.
 
Ell
12:55 PM
@BartekBanachewicz I don't think so really
 
user1804599
@orlp No, it doesn't.
 
user1804599
Its type may.
 
Ell
the underlying object is the singleton, not the allocator
 
@BartekBanachewicz the goal of the language was the smallest possible compiler
@BartekBanachewicz fancy features like RLE would hinder that goal :)
 
@elyse What about type with one static constexpr variable, which names a different object in each TU?
 
12:56 PM
could be 8+[>4+[>2+>3+>3+>+4<-]>+>+>-2>+[<]<-]2>.>3-.7+..3+.2>.<-.<.3+.6-.8-.2>+.>2+.
 
@BartekBanachewicz yes, but that would require a much bigger compiler
 
not really
it's trivial to add
even as a preprocessing stage
 
@BartekBanachewicz Have you looked at Binary Lambda Calculus?
 
@BartekBanachewicz A brainfuck compiler is ~250 bytes of binary
 
@Potatoswatter no
 
user1804599
12:58 PM
@Potatoswatter That's not a type with one and only one inhabitant, so it's not a singleton.
 
@orlp lol size of a binary
 
user1804599
It's a variable hth
 
@BartekBanachewicz that was the design goal of brainfuck
 
@BartekBanachewicz It uses something like RLE and it has the smallest known self-interpreter.
@elyse There's only one value with only one canonical name. What's an "inhabitant"?
 

« first day (1805 days earlier)      last day (3147 days later) »