TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Interactive Code Cells

165 点作者 nalgeon超过 1 年前

20 条评论

GaryNumanVevo超过 1 年前
Pluto.jl [1] is an interesting project around creating reproducible notebooks. MIT&#x27;s Intro to Computational Thinking uses it for displaying interactive code cells [2].<p>They&#x27;re reactive cells too, so if you modify an variable or function, subsequent cells will automatically update. Something that Jupyter lacks currently.<p>[1] - <a href="https:&#x2F;&#x2F;plutojl.org&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;plutojl.org&#x2F;</a><p>[2] - <a href="https:&#x2F;&#x2F;computationalthinking.mit.edu&#x2F;Fall23&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;computationalthinking.mit.edu&#x2F;Fall23&#x2F;</a>
评论 #38683156 未加载
评论 #38686073 未加载
评论 #38686488 未加载
samsquire超过 1 年前
I have dreamed about an extremely rich document which actually presents the internal state of the runtime and compiler. So all the abstract syntax tree and control flow graph, SSA and data structures are presented in different sections of the document. Have animations of data flow too.<p>It could double as REPL and you can reach into any part of the compiler pipeline and write your own transformations.<p>Does anybody remember the documentation for Backbone? The &quot;annotated source&quot; documentation was side by side the code, it was really helpful.<p><a href="https:&#x2F;&#x2F;backbonejs.org&#x2F;docs&#x2F;backbone.html" rel="nofollow noreferrer">https:&#x2F;&#x2F;backbonejs.org&#x2F;docs&#x2F;backbone.html</a> (This is the annotated source) Imagine if it was &quot;alive&quot;?<p>I have practically no exposure to Bazel and Buck but these advanced build systems have advanced refresh logic which is feels it is an advanced caching.<p>These systems and Makefiles essentially do refresh logic&#x2F;regeneration from changed sources. Maybe it could be like Greenspun&#x27;s 10th rule, every system eventually builds its own caching system and refresh logic and dirty-rechecking. (See React&#x27;s virtual DOM)<p>[1]: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Greenspun%27s_tenth_rule" rel="nofollow noreferrer">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Greenspun%27s_tenth_rule</a><p>There&#x27;s also crossovers with Knuth&#x27;s literate programming here. And spreadsheets.
评论 #38684901 未加载
评论 #38690115 未加载
enoch2090超过 1 年前
Nice concept and demonstration! Would argue though that it is the states in Jupyter notebooks that make it work so well for prototyping, and that should be its main purpose always. Using dependencies might break that.<p>As for the documentation purposes it should be the programmers&#x2F;authors&#x27; duty to ensure that the code works out by executing all cells in order once.
skybrian超过 1 年前
The main problem I see is relying on a server. Running sandboxes server-side takes up resources even when idle (the user went to lunch, or left it running overnight). Google can do it with Colab, but this is expensive to provide to the general public, so often the sandbox gets killed after a timeout.<p>Observable does a similar thing, but in the browser, so the cells run JavaScript. I suppose a WASM implementation could provide more languages?<p>Or it might be better done using a VS Code plugin or something like that. (Thry already exist.) But that means casual readers won’t be able to play with it.
评论 #38687238 未加载
lbeckman314超过 1 年前
I love these kinds of interactive code&#x2F;sandbox projects! The author&#x27;s example page [1] gives some more background on the design of Codapi as well [2]. Excited to try this out!<p>Another similar project is Runno which runs client-side in the browser [3].<p>[1] <a href="https:&#x2F;&#x2F;antonz.org&#x2F;code-examples&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;antonz.org&#x2F;code-examples&#x2F;</a><p>[2] <a href="https:&#x2F;&#x2F;codapi.org&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;codapi.org&#x2F;</a><p>[3] <a href="https:&#x2F;&#x2F;runno.dev&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;runno.dev&#x2F;</a>
TheIronYuppie超过 1 年前
This gets close to something really important, but I&#x27;d like to forward something that I wrote previously - the SAME project[1]<p>The difference&#x2F;compliment here is that after you finish writing these cells, i think there&#x27;s a translation into a backend service for execution at scale.<p>I&#x27;d love someone to pick this up and run with it in collaboration with tools like this!<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;SAME-Project&#x2F;same-project">https:&#x2F;&#x2F;github.com&#x2F;SAME-Project&#x2F;same-project</a>
cxr超过 1 年前
&gt; Behind the scenes, codapi-snippet calls a codapi server (either a cloud or self-hosted instance) so it can run any programming language, database or software you&#x27;ve configured.<p>I&#x27;d rather have a flavor of notebooks that work by referencing other notebooks comprising human- and machine-readable specifications that describe those other languages&#x27; syntax and semantics and how their execution models work. Look at the way IETF RFCs are crosslinked, for example. With your browser pointed at one of these documents, it traverses all the linked documents and resolves a given cell&#x27;s results based its working knowledge of the language in that cell. (If you really want to, you can point your server to the same corpus and have it cache some of the processing in order to relieve pressure re compute requirements for the browser, but in principle it should work the same way.)
tkiolp4超过 1 年前
Off topic: does any other here have trouble with queries like this?<p><pre><code> Rank the employees according to their salaries in each department </code></pre> My SQL is “good” I think, but to be honest in my day to day I usually don’t deal with aggregation nor windowed queries (my BI colleagues are masters are those, though )
评论 #38683223 未加载
nocsi超过 1 年前
I prefer functional programming with Livebook[1] for this type of thing. Once you run a cell, it can be published right into a web component as well.<p>[1] - <a href="https:&#x2F;&#x2F;livebook.dev" rel="nofollow noreferrer">https:&#x2F;&#x2F;livebook.dev</a>
michelpp超过 1 年前
What piques my interest in this tool is that I haven&#x27;t found a good &quot;notebook&quot; like solution for Postgres yet, I&#x27;ve tried using SQL magic functions in Jupiter to generate some documentation for pgsodium[1] but I&#x27;m not entirely pleased with the results, there&#x27;s too much Python still showing through.<p>Would this tool work as a general purpose documentation generator for a Postgres extension?<p>[1] <a href="https:&#x2F;&#x2F;michelp.github.io&#x2F;pgsodium&#x2F;Public_Key_Cryptography.html" rel="nofollow noreferrer">https:&#x2F;&#x2F;michelp.github.io&#x2F;pgsodium&#x2F;Public_Key_Cryptography.h...</a>
评论 #38688076 未加载
jbverschoor超过 1 年前
Love that it has transactions&#x2F;states between blocks. It&#x27;s super annoying if you override a variable &#x2F; change an object in Jupyter and try to re-run it.
tpoacher超过 1 年前
This is nice. Reminds me of the old Iodide notebooks; I&#x27;m so sad those lost to jupyter, in my mind they were so much nicer...
评论 #38683810 未加载
dcreater超过 1 年前
Wonderful! And it&#x27;s probably not too hard to take this to the next step by having natural language to code (via genai) baked into this? Interactive natural language functional cells. Something an average writer, journalist etc can put in any given article. Thatll be incredibly helpful
jasonjmcghee超过 1 年前
At the risk of being a low quality comment:<p>Losing syntax highlighting on edit is rough. That&#x27;s when I want it most.
评论 #38692379 未加载
revenga99超过 1 年前
This is amazing! Would be cool to add some data visualization examples. Either some python or a js library.
daemonk超过 1 年前
While I get that states is frustrating for share-ability and communicating your work, it is extremely useful for prototyping. Perhaps there just needs to be an explicit toggle for stateful vs non-stateful for notebooks
adamhp超过 1 年前
I ran the insert statement before the create statement and it appeared to work.
评论 #38681885 未加载
评论 #38685509 未加载
mwenge超过 1 年前
In the same vein: <a href="https:&#x2F;&#x2F;mwenge.github.io&#x2F;blog&#x2F;io10.html" rel="nofollow noreferrer">https:&#x2F;&#x2F;mwenge.github.io&#x2F;blog&#x2F;io10.html</a>
Beefin超过 1 年前
are these typically just data queries? how do you get past arbitrary code vulnerabilities?<p>this is something i&#x27;m exploring today with: <a href="https:&#x2F;&#x2F;nux.ai&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;nux.ai&#x2F;</a><p>which has a similar experience (run code within the browser)
评论 #38682522 未加载
zekenie超过 1 年前
this is so interesting! does it memoize dependencies? if i have several cells that all depend on a central one, will the central one only run once? what about state? can you declare a variable in one cell then use it in another?
评论 #38683740 未加载