Feed Aggregator Page 651
Rendered on Sun, 27 Sep 2020 20:33:25 GMT
Rendered on Sun, 27 Sep 2020 20:33:25 GMT
via Planet Lisp by on Sun, 27 Sep 2020 17:48:13 GMT
This library provides a Common Lisp kernel for Jupyter.
Jupyter is a scientific environment for experiments. It is good when you want to play with data, to plot graphics and provides some comments in markdown.
Jupyter saves your programming session along with results in one file allowing to share your results with other programmers or analytics.
Maybe you didn't know, but GitHub is able to render such notebooks. Here I found a large list of interesting notebooks. Take a look at this one, for example:
https://github.com/mqlaql/geospatial-data/blob/master/Geospatial-Data-with-Python.ipynb
Now, let's return to the Common Lisp. Jupyter is using a protocol allowing to write backends in different programming languages. They are called "kernels".
Here is how we can install Common Lisp Jupyter kernel on OSX. I'm using Homebrew and Roswell because they are making everything so easy!
[poftheday] brew install zeromq
[poftheday] brew install jupyterlab
[poftheday] ros install common-lisp-jupyter
Now we can start a notebook in console mode:
[poftheday] jupyter console --kernel=common-lisp
Jupyter console 6.2.0
common-lisp-jupyter: a Common Lisp Jupyter kernel
(C) 2019 Tarn Burton (MIT)
In [1]: (lisp-implementation-type)
Out[1]: "SBCL"
In [2]: (lisp-implementation-version)
Out[2]: "2.0.8"
In [3]: (values 1 2 3)
Out[3]: 1
Out[3]: 2
Out[3]: 3
In [4]: (jupyter:file "/Users/art/Desktop/Screenshot 2020-09-25 at 23.50.02.png")
Out[4]: /Users/art/Desktop/Screenshot 2020-09-25 at 23.50.02.png
And this command will start a webserver with full Jupyter Notebook:
# To start a web UI, run
[poftheday] jupyter notebook
When the browser will open Jupyter, choose this menu to start Common Lisp Jupyter kernel:
Now if you enter the same code as we did before in console, you'll see, that web version is able to render our "screenshot" file below the "code cell":
It is also very easy to render formulas and to request an input from the user:
Also, you can render any HTML along with styles:
Or you might define functions which will return HTML or files:
This way, libraries extending common-lisp-jupyter
may be created. They can do plotting for example, or render graphs, etc.
Here how you can make you own classes renderable by Jupyter:
Though, it would be nice to make it possible to define render
method for object not inherited from the jupyter:result
.
The developer of this library did a very good job documenting it and providing examples. You will find all of them here.
This project is in active development phase. For example, right now support for Jupyter widgets is added.
Please, join this effort and make your pull requests to this repository, if you are interested in building CL environment for data science!
via Elm - Latest posts by @evancz Evan on Sun, 27 Sep 2020 14:25:46 GMT
No problem! I think Svelte was saying “faster than virtual DOM” in a lot of their public communication, so I think many people have this impression.
My understanding is that they knew Elm had similar perf numbers to them, but they assumed Elm must be using the same techniques. I told them that was not the case in June 2019 so hopefully they saw it and changed how they talk about things since then
via Elm - Latest posts by @lydell Simon Lydell on Sun, 27 Sep 2020 09:00:38 GMT
Another thing to think about … do you pipeline the first call in a chain?
Do you use |>
only to avoid parens:
Dict.get "content-length" metadata.headers
|> Maybe.andThen String.toInt
|> Result.fromMaybe (BadHeader "Content-Length header not found or invalid")
Or do you go “all the way”?
metadata.headers
|> Dict.get "content-length"
|> Maybe.andThen String.toInt
|> Result.fromMaybe (BadHeader "Content-Length header not found or invalid")
via Elm - Latest posts by @Laurent Laurent Payot on Sun, 27 Sep 2020 07:56:15 GMT
To a non-technical person:
Less bugs, lower maintenance cost, no fear of changing things. And eventually (at least at NoRedInk) easier recruiting, of better coders who are reluctant to “foot-shooting” programming styles.
via Elm - Latest posts by @DullBananas on Sun, 27 Sep 2020 07:02:11 GMT
For a few weeks I have mostly been writing rust and j****script. I forgot exactly what I was doing with rust and j****script because I only remember the fun parts of my life.
Today I was working on port stuff in elm and damn it was so fun and satisfying. I thought I was starting to loose interest in Elm from spending so much time using other programming languages but I just forgot the joy of elm. I had lots of fun fixing those compile errors. If I said the same thing about j****script then it would be sarcasm.
Does Elm have a religion? Emacs has one
via Elm - Latest posts by @opsb Oliver Searle Barnes on Sat, 26 Sep 2020 11:34:26 GMT
My rule a thumb is
For non view code:
<|
or parens for one liners|>
when more than 1 function is applied to a valueFor view code:
<|
for building html hierarchies (I like the code to fit the html structure as far as possible)|>
when assigning values in let
blocks, never in the body of the let or any other expressions. Put another way, I only use |>
to calculate values which are then used to express the html.via Elm - Latest posts by @system system on Sat, 26 Sep 2020 10:58:51 GMT
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
via Elm - Latest posts by @lydell Simon Lydell on Sat, 26 Sep 2020 09:39:02 GMT
I only pizza if there are two or more values in the chain
I think error messages are better when you do someList |> List.map (\item -> whatever)
rather than List.map (\item -> whatever) someList
. It’s almost always the lambda that is wrong so I like when it is marked as the error rather than someList
.
-- TYPE MISMATCH - src/Example.elm
This function cannot handle the argument sent through the (|>) pipe:
182| someList |> List.map (\( _, x ) -> x + 1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The argument is:
List number
But (|>) is piping it to a function that expects:
List ( a, number )
Hint: Only Int and Float values work as numbers.
-- TYPE MISMATCH - src/Example.elm
The 2nd argument to `map` is not what I expect:
186| List.map (\( _, x ) -> x + 1) someList
^^^^^^^^
This `someList` value is a:
List number
But `map` needs the 2nd argument to be:
List ( a, number )
Hint: I always figure out the argument types from left to right. If an argument
is acceptable, I assume it is “correct” and move on. So the problem may actually
be in one of the previous arguments!
Hint: Only Int and Float values work as numbers.
via Elm - Latest posts by @berend Berend de Boer on Sat, 26 Sep 2020 05:45:26 GMT
Although true, in order to sell Elm it really helps to claim Elm is faster!
via Elm - Latest posts by @Naserdin Naserdin on Sat, 26 Sep 2020 04:52:16 GMT
Hi, Evan, thanks for this detailed explanation, surprised me! I naively thought precise dom manipulation is better than virtual DOM diffing update. seems like svelte has some advantages over other freamwork, and it’s all due to the compile process. so this question just came to my head. I think you are right, performance is not a big deal to most people because the hardware nowadays is to good to let user perceive the difference between freamworks. as a developer, it’s easy for me to just think about something is maybe can bring performance benefit. You maybe thought about is too before. so hey, keep up your good work, I like Elm, hope it will become more widely used.
via Planet Lisp by on Fri, 25 Sep 2020 20:48:31 GMT
This is a tiny library by Fernando Borretti. It implements analogue of the UNIX utility which
:
POFTHEDAY> (which:which "ls")
#P"/bin/ls"
POFTHEDAY> (which:which "sbcl")
#P"/Users/art/.bin/sbcl"
POFTHEDAY> (which:which "python3")
#P"/usr/bin/python3"
POFTHEDAY> (which:which "missing-binary")
NIL
That is it. No more, no less. What do you think, when this library can be useful?
By the way, there are many other trivial (but useful) libraries. All of them are marked with a trivial tag on #pofthedday site.
via Elm - Latest posts by @brian Brian on Fri, 25 Sep 2020 20:23:30 GMT
I follow a few rules since it’s so easy to get overzealous with pipelining. I’m gonna call these pizza rules here for fun.
[1]: I gave a talk at Elm in the Spring where I recommended people do that and now I kinda regret making such a strong recommendation! I think it’s fine but the HTML-like pattern is fine and has well-understood syntax and semantics such that it’s maybe a better pattern. Still depends highly on the team.
via Elm - Latest posts by @stephenreddek Stephen Reddekopp on Fri, 25 Sep 2020 20:04:43 GMT
I tend to follow your first snippet. I share your sentiment about wanting view functions to feel more like the resulting HTML. In general, my opinion is to use |>
for data transformations and use parentheses and the occasional <|
for view logic. It might feel even better if you just pull the items |> ...
part into its own value so that you don’t have to use the parens at all. I’ve found that writing view functions that way helps me and my team understand the HTML hierarchy better and visualize the results.
via Planet Lisp by on Fri, 25 Sep 2020 19:40:00 GMT
New projects:
Updated projects: 3b-hdr, 3bmd, acclimation, alexandria, algae, anypool, april, atomics, babel, bdef, bst, ci-utils, city-hash, cl-all, cl-aristid, cl-autowrap, cl-base64, cl-bnf, cl-cffi-gtk, cl-collider, cl-conllu, cl-covid19, cl-dot, cl-erlang-term, cl-fix, cl-forms, cl-fuse, cl-gamepad, cl-gserver, cl-html-parse, cl-kraken, cl-liballegro, cl-liballegro-nuklear, cl-markless, cl-migratum, cl-mixed, cl-mpg123, cl-naive-store, cl-patterns, cl-png, cl-pslib, cl-rabbit, cl-readline, cl-redis, cl-renderdoc, cl-rrt, cl-rsvg2, cl-sdl2-ttf, cl-steamworks, cl-stomp, cl-store, cl-str, cl-unification, cl-utils, cl-webkit, cl-zyre, clack-pretend, clast, clawk, clcs-code, climacs, clj, closer-mop, clunit2, com-on, com.google.base, common-lisp-jupyter, commonqt, croatoan, deploy, diff-match-patch, djula, easy-audio, easy-routes, eazy-process, eclector, eos, exscribe, f2cl, fare-quasiquote, fast-io, file-select, fiveam, flare, flexi-streams, flexichain, float-features, font-discovery, fset, functional-trees, gendl, generic-cl, glacier, glsl-toolkit, golden-utils, gtirb, gtirb-capstone, harmony, hu.dwim.asdf, hu.dwim.delico, hu.dwim.walker, hunchentoot-multi-acceptor, hyperluminal-mem, hyperobject, inferior-shell, inner-conditional, ironclad, jingoh, jonathan, jpeg-turbo, kmrcl, lazy, linear-programming, lisp-binary, lisp-gflags, lispcord, literate-lisp, local-time, log4cl, maiden, markup, mcclim, method-hooks, mgl-pax, modf, mutility, named-readtables, nibbles, nodgui, null-package, opticl, origin, osicat, overlord, paren6, parse, pathname-utils, perceptual-hashes, petalisp, phoe-toolbox, pngload, portable-condition-system, postmodern, protobuf, psychiq, py4cl, quilc, quux-hunchentoot, random-state, read-as-string, replic, roan, rpcq, s-graphviz, sanity-clause, sc-extensions, scalpl, sel, serapeum, shadow, sheeple, shellpool, simple-actors, slime, sly, snooze, stumpwm, sxql, tooter, trace-db, trivia, trivial-arguments, trivial-clipboard, trivial-custom-debugger, trivial-garbage, trivial-gray-streams, trivial-utf-8, trucler, uax-14, umbra, unix-opts, vernacular.
Removed projects: unicly.
To get this update, use (ql:update-dist "quicklisp").
Enjoy!
via Elm - Latest posts by @wolfadex Wolfgang Schuster on Fri, 25 Sep 2020 19:48:54 GMT
When I speak to my wife or other friends and family who don’t know much if anything about programming I usually talk about how Elm is a programming language for building web sites or web apps. I don’t explain how it works usually as that’s not really important for them. I explain how it provides a way for being more expressive about the information you’re working with. An example I’ve used before is that most web site programming allows "horse" + 5
, but Elm won’t. There’s probably a better way to get across the idea of types, but this is where I’m at in my explanation right now. I also talk about how Elm is relatively simple compared to javascript. How it’s a lot easier to talk about. How it’s friendlier with its error messages, I really like to highlight the friendliness.
From a business perspective I talk about how I find it very quick to work in Elm, quick but also secure. How its expressiveness (its type system makes this easier). I also bring up that it’s easier to refactor large amounts of code which is important for business, being able to change quickly.
As far as community I’d highlight the Slack and the conferences. I’ve referred to the Elm Slack in a few other of my Slack communities because I think it excels at being welcoming. I don’t go too much into specifics about the conferences with people who aren’t programming.
Also, when it comes to business I’ve started to try and use Elm’s stability more as a good thing. I know there was a big todo when Elm went from 0.18 to 0.19 but compared to working in other front end frameworks it’s been quite stable. As I explained to some coworkers the other day, the Elm I was writing 2 years ago is identical to the Elm I write today and will most likely be the same Elm I’m writing 2 years from now. The Ember I write today isn’t the same Ember I was writing 6 months ago, or 6 months before that, etc. The same is also true for React https://twitter.com/kadikraman/status/1308390711809789959?s=19, though slightly closer to Elm.
via Elm - Latest posts by @Lucas_Payr Lucas Payr on Fri, 25 Sep 2020 16:33:42 GMT
Personally, I love to use the |>
pipe as much as possible, even in the view.
Something like
items
|> List.map viewItem
|> Element.column [ Element.spacing 8 ]
Seems very normal to me.
I also use <|
but rather rarely, trying to keep it at a minimum. I try to use it only for math or for type conversion:
Element.spacing <| toInt <| 17 / 4
via Elm - Latest posts by @lydell Simon Lydell on Fri, 25 Sep 2020 15:55:02 GMT
I really like |>
pipelines. My brain now recognizes the a (b |> c)
pattern and is tempted to convert it into b |> c |> a
.
But sometimes I’m not sure if that’s actually better. For example:
Element.column [ Element.spacing 8 ]
(items
|> List.map viewItem
)
Refactoring that to:
items
|> List.map viewItem
|> Element.column [ Element.spacing 8 ]
… while beautiful, it feels a bit like writing HTML like this (invalid HTML, I know):
<div>
{{ loop viewItem items }}
</div class="spacing-8">
I kind of like when going through a view
function is like going through the HTML inspector in the browser. Pipelines stray away from that a bit.
|>
keeps execution order, but reverses structure order.
<|
keeps structure order, but reverses execution order.
Anyone else thought about this?
via Elm - Latest posts by @eimfach Robin G. on Fri, 25 Sep 2020 14:45:34 GMT
Hi Folks !
I was wondering on how to think, write and tell about elm holistically. How would you think, write and tell about Elm to someone completely unaware of technological topics or someone who is not too much experienced with programming or comes from another perspective of programming ?
I think of things like:
via Elm - Latest posts by @system system on Fri, 25 Sep 2020 14:00:02 GMT
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
via Elm - Latest posts by @rupert Rupert Smith on Fri, 25 Sep 2020 08:50:07 GMT
I tried to keep the API idential to Parser.Advanced
, so switching over to it should be relatively easy. All the functions should behave the same way as the corresponding functions in Parser.Advanced
. The behaviour should only change when you apply one of the recovery tactics.
I cannot export (|.)
and (|=)
though, due to kernel code restrictions :-(. So you have to re-write those:
import Parser.Advanced as PA exposing ((|=), (|.))
parser =
PA.succeed identity
|. PA.spaces
|= PA.int
|. PA.spaces
to
import Parser.Recoverable as PR
parser =
PR.succeed identity
|> PR.ignore PR.spaces
|> PR.keep PR.int
|> PR.ignore PR.spaces
Another difference is that where functions like Parser.Advanced.keyword
take a Token
argument, I thought just passing in the String
and problem
without wrapping as a Token
was neater:
PA.keyword (PA.Token "let" ExpectingLet)
PR.keyword "let" ExpectingLet
I’ll likely make a release soon - I’m trying to figure out how to make a recoverable version of sequence
first. The fast-forward recovery at the moment fast forwards to a sentinal Char
, then continues. But sequence
uses String
s as separators not Char
s, so I need to implement a slightly different fast-forward mechanism, then it will be good to go. I’ll just push it out with the recovery tactics I implemented so far, it will be interesting to hear if they work for you, or if you find they need to be modified to cover situations you are encountering.