News for hackers. Stuff that matters.
Re:Routes don't look flat enough to me by IIAOPSW on Monday February 13, 2023 @09:11PM (#34784254)
I was expecting physical routes, as in a program that takes a geographical configuration and makes it look like the London Tube map. Oh well.
Re:Routes don't look flat enough to me by eru on Tuesday February 14, 2023 @08:51AM (#34789203)
Well, from the title I had expected something about miniziming elevation changes for eg bike routes. Not even a flat design map?
Re:Routes don't look flat enough to me by jbverschoor on Tuesday February 14, 2023 @12:23AM (#34785703)
I dunno. Looks like a big step back in readability.

Fun exercise, but a waste of time

Re:Routes don't look flat enough to me by winrid on Tuesday February 14, 2023 @12:46AM (#34785889)
Here's an iterative JS version I just came up with, don't judge too harshly but I think it works (also there's a missing ] in their example):

https://codepen.io/winrid/pen/JjajYGR

Re:Routes don't look flat enough to me by winrid on Tuesday February 14, 2023 @01:07AM (#34786025)
It had some bugs, but looks correct now.
Re:Routes don't look flat enough to me by larusso on Tuesday February 14, 2023 @01:40AM (#34786214)
Thanks for the hint with the „iteration“ function. I haven’t touched Closure in some years but had a problem a few month ago where I wanted to iterate over items returned from a REST Api which where presented in a pageable API with rust. I managed to cook up a solution with a custom iterator trait impl. Doesn‘t work with async though and I had a hard time to find a solution/search term for this problem. Don‘t know if any of this is applicable to rust but at least another resource.
Re:Routes don't look flat enough to me by dgreensp on Tuesday February 14, 2023 @03:12AM (#34786775)
Simple, readable, type-checked code in TypeScript: https://www.typescriptlang.org/play?target=6#code/C4TwDgpgBA...
Re:Routes don't look flat enough to me by Spivak on Tuesday February 14, 2023 @09:54AM (#34790153)
To have parity with the original article, now do it without recursion / bounded stack depth because you're worried that your data might blow out the stack.
Re:Routes don't look flat enough to me by dgreensp on Tuesday February 14, 2023 @08:51PM (#34799042)
I thought about it, but it's just so unmotivated in this case. URLs would have to be hundreds of path segments long.
Re:Routes don't look flat enough to me by winrid on Wednesday February 15, 2023 @02:18AM (#34800973)
That's not a solution because you manually turned the input into a valid TS array. You also manually turned the method names into strings, and they aren't in the input... that's part of the fun :)
Re:Routes don't look flat enough to me by dmurray on Tuesday February 14, 2023 @05:23AM (#34787553)
If you're not allowed write a nice idiomatic recursive version of this in a few lines, why use Clojure in the first place? Just use Java like Sun Microsystems intended.
Re:Routes don't look flat enough to me by iLoveOncall on Tuesday February 14, 2023 @06:07AM (#34787795)
> Pixelated Noise is a software consultancy and we're always looking for interesting projects to help out with. If you have unmet software development needs, we would be happy to hear from you.

Yeah the code presented on that article doesn't really make me want to hire those guys.

Re:Routes don't look flat enough to me by mdallastella on Tuesday February 14, 2023 @06:31AM (#34787960)
Can I ask you why? (I'm not related with the company)
Re:Routes don't look flat enough to me by melx on Tuesday February 14, 2023 @06:28AM (#34787940)
What code?!

All I see is grey boxes with some small text. Can't bo bothered to work my eyes out.