Hacker Newsnew | past | comments | ask | show | jobs | submit | rogue7's commentslogin

For this I use gron [0]. It's very convenient.

[0]: https://github.com/tomnomnom/gron


This looks neat. However since I read about Koka's dot selection [0], I keep thinking that this is an even neater syntax:

fun showit( s : string )

  s.encode(3).count.println
However, this is of course impossible to implement in most languages as the dot is already meaningful for something else.

[0] https://koka-lang.github.io/koka/doc/book.html#sec-dot


It is called Uniform [Function] Call Syntax.

D has had this for decade(s): https://tour.dlang.org/tour/en/gems/uniform-function-call-sy...

Nim too has it: https://nim-by-example.github.io/oop/


That syntax is very clean when it works. I think however the limitation of not being able to pipe arguments into 2nd, 3rd, ..., positions and keyword arguments, or variadic explosion like the syntax showcased in the article makes it less powerful.

Are there other syntax helpers in that language to overcome this?


It still makes sense to have a clean syntax for the simple case. You can use currying (with or without first class language support) to handle more complex cases or just fall back to good old function composition or even loops.


I think this is called uniform function call syntax.


I built a small static web app [0] (with svelte and tensorflow js) that shows gradient descent. It has two kind of problems: wave (the default) and linear. In the first case, the algorithm learns y = ax + b ; in the second, y = cos(ax + b). The training data is generated from these functions with some noise.

I spent some time making it work with interpolation so that the transitions are smooth.

Then I expanded to another version, including a small neural network (nn) [1].

And finally, for the two functions that have a 2d parameter space, I included a viz of the loss [2]. You can click on the 2d space and get a new initial point for the descent, and see the trajectory.

Never really finished it, though I wrote a blog post about it [3]

[0] https://gradfront.pages.dev/

[1] https://f36dfeb7.gradfront.pages.dev/

[2] https://deploy-preview-1--gradient-descent.netlify.app/

[3] https://blog.horaceg.xyz/posts/need-for-speed/


> It has two kind of problems: wave (the default) and linear. In the first case, the algorithm learns y = ax + b ; in the second, y = cos(ax + b).

Are "first" and "second" switched here?


Vaping is way less harmful than smoking.

See e.g. the study [0] conducted by Public Health England that concludes vaping is at least 95% (!) less harmful than smoking.

See also this video [1] that shows graphically the different impact it has on the lungs.

[0] https://www.gov.uk/government/news/e-cigarettes-around-95-le...

[1] https://youtu.be/0Pwj6BuS8Ds


  > independent study
  > at least one author has relations with Ruyan group (today part of Imperial Tobacco), a then-major vape manufacturer
  
But even this "independent study" seems to acknowledge the difference between recreational vaping, and using vape as a tool to stop smoking.

Do you believe everything that's on TV, or are you just a run of the mill tobacco company shill?

The only reason I want to live until 2050 is to see the lawsuits that will mirror the smoking lawsuits from the early 90s. (But this time they will be lead by Instagram and TikTok influencers - not that it will take any of the value)


> 5. Many of my current projects take the form of "big data pipeline, followed by intermittent job to rebuild a static site and push it live"; astro fits very nicely in this role

You may be interested in Observable Framework [0]

[0] https://observablehq.com/framework/


Yes! I’ve had my eye on it but haven’t had a chance to use it (yet).


In this case `d` is the entire dataframe. It's just a way of "piping" the object without having to rename it.

You are probably thinking about `df.apply(lambda row: ..., axis=1)` which operates on each row at a time and is indeed very slow since it's not vectorized. Here this is different and vectorized.


Appreciate the explanation, this is something I should know by now but don't


That's excellent.


Agreed 100%. I am using this method-chaining style all the time and it works like a charm.


This is possible to do with ipywidgets [0] and all the ipy[stuff] packages.

bqplot [1] for example is great for 2D dataviz, very responsive and updates real-time. Based on D3 I believe. Usually I can do what I want with base widgets and bqplot and the result is pretty.

ipyleaflet is another popular library for maps.

I especially enjoy using them with voila [2] to create an app, or voici [3] for a pure-frontend (wasm) version.

If you want to develop a widget, the new-ish anywidget library can reveal handy [4].

For an example, see this demo [5] I made with bqplot and voici, that visualizes a log-normal distribution.

[0] https://ipywidgets.readthedocs.io/en/stable/

[1] https://github.com/bqplot/bqplot

[2] https://voila.readthedocs.io/en/stable/

[3] https://voici.readthedocs.io/en/latest/

[4] https://anywidget.dev/

[5] https://horaceg.github.io/long-tail/voici/render/long_tail.h...


This is a great list, thanks!

I would add two more:

1. VizHub [1]: for D3 based visualizations. I have not tried it, but I have watched some D3 videos [2] by its creator Curran Kelleher who uses it quite a bit (oh, and a shout out to the great D3 content he has!).

2. This is slightly unusual but I have recently been using svelte's REPL notebooks [3] to try out ideas. Yes this is for svelte scripts, but you can do D3 stuff too. And on that note, svelte (which is normally seen as a UI framework) can be used for pretty interesting visualizations too, because how it can bind variables with SVG elements in HTML (you can get similar results with React as well). For ex., here's a notebook I wrote for trying out k-means using pure svelte [4]. Be warned: fairly unoptimized code, because this was supposed to be an instructive example! On a related note, Mathias Stahl has some content specifically for utilizing svelte with D3 [5].

[1] https://vizhub.com/

[2] https://www.youtube.com/watch?v=_ByiP7KM0So

[3] https://svelte.dev/repl

[4] https://svelte.dev/repl/1689f5c3699640ff86d9bd6a04ac8272?ver... Note that the "Iterate!" button iterates once; keep clicking it to move things along.

[5] https://www.youtube.com/watch?v=eNQQAkjxxdQ


Thanks for share these useful links. bookmarked.

any idea what "BQ" stands for in BQplot? I find that I am able to remember and recall tools and terms that I actually understand the full forms of :)


It originated at Bloomberg in a quant research group, hence the "bq".


I'm using Quarto [0], pretty happy with my blog [1].

Before it was made with Zola [2], which is also nice.

[0] https://quarto.org/

[1] https://blog.horaceg.xyz/

[2] https://www.getzola.org/


I built a gradient descent visualizer in js with Svelte and TensorflowJS [0].

Also wrote about it in my blog [1].

[0] https://gradfront.pages.dev/

[1] https://blog.horaceg.xyz/posts/need-for-speed/


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: