[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shell commands with output to string

From: Blake Shaw
Subject: Re: Shell commands with output to string
Date: Thu, 24 Feb 2022 00:48:56 +0700

Olivier Dion via General Guile related discussions <>

> On Wed, 23 Feb 2022, Zelphir Kaltstahl <>
> wrote:
>>> There's ton of missing stuffs in the standard library IMO.  On top
>>> of my
>>> head, filesystem paths manipulation (e.g. path-join) is also one
>>> that is
>>> probably getting re-invented a lots.
Nice work Zelphir!
>> I actually made something for that, trying to copy mostly the Python
>> behavior for os.path.join:
>> Also available as a GNU Guix package, but not updated in a while on
>> Guix.  Repository contains more up to date version.
> This is great and should be merged into the standard library of Guile.
> Maybe not at it's (I have not read everything), but this would be trully
> benifical to all Guile users.
I very much disagree. While it's a large implementation of Scheme, Guile
is still Scheme. This is all really simple stuff, and there are many
ways to implement these functions. Do the Guile maintainers really need
to be burdened by adding trivial functionality to the core library?

This is really simple stuff, but it was nevertheless difficult for me to
figure out how to do much of it in Guile. Many things that confused me
to death ended up being a big "oh, its just that??" Which seems to
indicate that the issue is less with the core library lacking
functionality and more with the presentation of Guile itself -- the
docs, which in December we heard a large number of complaints about.

> By keeping this as an external library such as a Guix package, I fear
> we're aiming at the 'nodejs syndrome' where everything -- down to
> the simplest hello world -- is a package dependency.
>>> I believe that the successful story of Python is not just about its
>>> pretty syntax, but also dues to its very large standard library.
>> I think so too. Although I sometimes have the feeling, that Guile does
>> things in a cleaner way, once one figures out how to do them in the
>> first place. One thing I really like are the ports. Stuff like
>> call-with-output-string. Takes some twisting of the brain, but once
>> one gets it, it becomes very useful and elegant.
I agree, there is just a mental leap getting to there. I think with
examples based on the "expressive graduation" strategy I outlined in my
Guix Days presentation can lessen that load quite a bit, and get folks
moving with the goods they need to build their own tools quickly.
> Of course Scheme does things better than Python.  I wouldn't be hacking
> with it if it was not the case ^^.  Not only the syntax, but the
> programming paradigms.  You want FP, you got it.  You want OOP, sure.
> You prefer procedural, no problem.  With Python it's more like just OOP
> although there's been progress on the FP side.
>> But yes, Python is very beginner friendly in terms of batteries
>> included.  Although I think that its syntax feels a bit ad-hoc. As in
>> "Oh we want some syntax for X … lets invent this keyword here. or some
>> new operators or things like that."
> Yeah they were late to the FP paradigm so they had to invent something
> without breaking their OOP echo chamber I guess.  IIRC, there's talks
> about adding patterns matching which Lisp has since the begining.  So
> yeah very late to the game of FP.
>> I like Guile syntax (or Scheme in general) much more. However, it is
>> difficult to motivate others in a quick demo to learn the language,
>> when you cannot take half an hour time to explain, what that for other
>> people weird looking syntax is actually really cool.
> I'm not sure if it's only the syntax.  Yes we often see "but the
> parentheses burn my eyes" but I believe that things are more complex
> than that.  What I think is difficult is to explain to someone why they
> should try to learn new languages in the first place.  On top of my
> head, people ask themself the following question before learning a new
> language:
>       - Profit -> Can I easily find a good paying job by developing in
>         this language?
So why are Haskell and Rust some of the most popular languages today
besides the "big names" (which I don't its reasonable to imagine a scheme
implementation suddenly breaking the mold and acceding to)
>       - Field -> Can I develop in my field (e.g. video game, mathematic)
>         with this language?  Is there a community?
Yes and yes to those fields, with great tools! (Haunt, recent vector libs)
But the community, like many a scheme, is a bit hermetic, and this is
based in practices like mailing lists, which I don't think can/will
change. We could start a guile-hackers discourse server, or something
else more public-facing, but would any of the current users join?

So then we are the Day Zero guile crew, and thats gonna be rough to get
>       - Support -> Can I find solutions to my problems easily online?
>         Are there libraries for common problems that I could encounter?
This! While I think the Guile website is really nice, I think something
like a guile wiki which catalogues everything in one place, with a firm
organizational strategy from the outset, could be massively beneficial.

Finding whats happening in Guile is labyrinth, and I still discover new
stuff every couple weeks. The ecosystem is immensely larger than I
imagined a few months ago. And also, lots (maybe half?) of of it isn't
even in Guix, and I'm talking about recent projects. Meanwhile much of
what is in Guix builds but doesn't work.
>       - Prototyping -> How easy is it for me to scratch an idea with
>         this language?
This too! I think that this is what the Guile-Cookbook discussion is
hoping to solve
> and probably other reasons.  Now, try to explain to someone that does
> web developpement in Javascript or Python that Scheme is far more
> supperior.  That person would just ask: Does Guile has support for
> MongoDB?  And proceed to dismiss it.
> Of course, some hackers like me just like to learn new stuffs.  It took
> me about an one hour into Scheme course of the MIT on youtube to
> understand that I just found the holy grail of programming language.
> And yet, I have not find the answer to the `profit` question.

I agree with much of what you're saying, but I disagree with the idea of
Guile becoming a "batteries included" Scheme loaded with conveniences.
Andy et al have far more important issues to worry about.

On the other hand, I would be down to organize and contribute to an
effort to create a battery pack, based on a study of the utilities
offered by Python. We saw that Guix is picking up in production use
and such a library would be very helpful (and I think Tropin's RDE
might be trying to accomplish something like this)

There is the existing Guile-lib, which seems to have intended something
similar in the past. Let me briefly comment on its TOC:

> (apicheck)
>   Describe and verify library programming interfaces
So it tells you what a library does? Could be cool,
but not what I'm looking for as a newcomer. 
> (config load)
>   Loading configuration files
of what? where am I getting these configuration files from?
> (container async-queue)
>   A thread-safe message queue
Sounds like great, powerful tools... if you have already adjusted to
hacking guile
> (container nodal-tree)
>    A tree consisting of nodes with attributes
> (container delay-tree)
>    A nodal tree with lazily evaluated fields
> (debugging assert)
>    Helpful assert macro
This is something I think newcomers should be exposed to early on,
> (debugging time)
>    A simple macro to time the execution of an expression
>(graph topological-sort)
>    Routines to perform topological sorts
if you came for topological sort, guiles got you covered
>    Neil Van Dyke's permissive ("pragmatic") HTML parser
nice, super useful
>(io string)
>    SLIB's IO routines dealing with strings
>(logging logger)
>    A flexible logging system
every guix dream, yet I doubt most know this is here
>(logging port-log)
>    A logger that outputs to a port
>(logging rotating-log)
>    A logger that rotates its output files
>    Nifty and concise regular expression routines
I wasn looking for such a thing weeks ago... another reason a wiki or
some other quick and simple to edit archive of everything in guile would
be nice
>(math minima)
>    A golden-section minimum finder
sicp vibes over here
>(math primes)
>    Functions related to prime numbers and factorization
>(os process)
>    Spawning processes and capturing their output
where has this been my whole guile experience?!? too late, I made one
myself (:
> (scheme documentation)
>    Macros to define different kinds of variables with documentation
this sounds great! didn't catch it my first few glances through
>(scheme kwargs)
>    Defining functions with flexible keyword arguments
how is that different from existing kwargs?
>(search basic)
>    Classic search functions
useful but also the kind of thing one typically implements to learn a lang 
>(string completion)
>    Building blocks for tab completion
thats cool! but why didnt they just go ahead and... complete it?
>(string soundex)
>    The SOUNDEX string categorization algorithm
no idea what that is
>(string transform)
>    Beyond SRFI-13
would be nice to have subtext say a bit more
>(string wrap)
>    A versatile string formatter
why do I need more than (format ...)?
>(term ansi-color)
>    Generate ANSI color escape sequences
>    A JUnit-style unit testing framework

As you can see, much of this is stuff that won't come in handy until you
already feel compfortable with guile.

In fact, some of it will just seem like weird alien technology until
you've spent some time with scheme.

So while I agree that an organized effort to roll-out a battery pack
would be hugely beneficial, I think efforts to make the existing
knowledge base of guile more accessible/easier to navigate/less messy
would get folks moving with the large ecosystem faster,
speaking/thinking in guile, and thus would be more rewarding than
porting conventional idioms into a box that makes guile more familiar
for python and JS developers.

“In girum imus nocte et consumimur igni”

reply via email to

[Prev in Thread] Current Thread [Next in Thread]