Re: regex-case

2016-02-08 Thread Ludovic Courtès
Matt Wette  skribis:

>  (regex-case str
>(("^([a-z]+)\\(([0-9]+)\\)$" v i)
> (list v i))
>(("^([a-z]+)$" v)
> (list v "1”)))

Sounds useful and convenient!

> (let ((t-292 (make-regexp "^([a-z]+)\\(([0-9]+)\\)$"))
>   (t-293 (make-regexp "^([a-z]+)$")))
>   (cond ((regexp-exec t-292 str)
>  =>
>  (lambda (m)
>(let ((v (match:substring m 1))
>  (i (match:substring m 2)))
>  (list v i
> ((regexp-exec t-293 str)
>  =>
>  (lambda (m)
>(let ((v (match:substring m 1))) (list v "1"))

When the ‘else’ clause is missing, I think it would be best to throw an
error like ‘match’ does—it’s rarely helpful to return #unspecified in
those cases.

Ludo’.




Re: [ANN] An impudent introduction to Guile

2016-02-08 Thread Panicz Maciej Godek
2016-02-07 22:51 GMT+01:00, Lawrence Bottorff :
> I've got this  fork going where I've
> done some editing (grammar, style, spelling, etc.) on the book (up to
> "Reporting bugs." Let me know what you think.

I'm really impressed! Thanks! :)
However, I do have some remarks:

1. if possible, it would be nice if you could keep the lines up to 80
columns each (60 columns is preferable). I do editing in Emacs in
terminal on a very tiny display and I often split the screen in two
halves for comparatory editing.
The only exception are links that are more than 80 columns long.

2. in the line 161, you expanded the sentence "The first chapter
introduces all the elementary notions needed for programming" with the
adverbial "in Scheme". My original intent was that -- although the
syntactic guise of the programs expressed is obviously Scheme -- the
presented notions (of definition, reduction and substitution) are
required to do programming in general.

3. I'm not quite convinced whether \texttt{equivalence-classes} should
be replaced with \textit{equivalence-classes}. If we actually decide
to do so, I think it would be better to replace it as
\textit{equivalence classes}. However, although the italics are
actually used to refer to new notions, and typewriter font to refer to
notions/functions defined in Scheme, that use case is closer to
mentioning, than defining -- and I thought it would fall into memory
easier if the reader could see that "this is actually a Scheme
function indeed". (This won't be obvious during the first reading, so
I think it would be best to put the decision off for now)

4. I don't think that we need to add (line 192) that we mean "the
phenomena in the +real+ world". We could also mean the phenomena in
the world of ideas, or  some fictional world. Either way, this is
unobvious from the philosophical point of view ;]

5. I think you got the "reading programs isn't like reading novels"
(196) opposite to my intention, which was that the programs have a
higher level of generality (which is rather unfamiliar) -- novels are
more concrete and less general.

(I wonder whether we should switch to private correspondence, or
doesn't anyone mind having such updates here?)

> In general, I think Scheme desperately needs an "O'Reilly"-style book.

Sometimes I wonder. On one hand, our community could benefit if Guile
was more fashionable. I think that in practice, our situation is
similar to that of Erlang. Garret Smith (the author of "Erlang The
Movie II: the sequel", the best movie on the whole Internet) said that
"github is the Erlang's package manager" -- which is much more tedious
than, say, pip or ruby gems. And while some implementations of Scheme
provide nice solutions with this regard (most notably Chicken's eggs),
I think that -- similarly to Erlangers -- we mostly need to rely on
the fact that  even if they are complex, well written functional
programs are easy to understand and compose. (This is also why I
thought writing a booklet is better than just publishing those
libraries, because creating them was really effortless. Also, I think
that the kind of software literacy that Scheme promotes is much more
important and far-reaching than even the most complete set of
libraries imaginable)

I think that the problem of Scheme is that it is best characterized
not by what it allows to do, but what it doesn't forbid to do, and
comprehending this "negative" characteristic requires much more
imagination.

> Question: What should we say when someone asks, "Why should I fool with a
> new programming language when there's Matlab/Mathematica/etc.?"

The way I see it, this is a field where there's constant change --
there was Octave, but then R emerged, and now Julia is gaining
popularity.

Certailny, the language itself (Scheme, that is) has been good enough
for at least two decades. What I think is needed is a set of
accessible tools that would provide immediate benefits from the Lisp's
syntax. For instance, Emacs is a really great environment for lispers,
but it is accessible only to those that already know Emacs. The dr
Racket envrionment is way more accessible, but while it's good for
education, I don't think I would want to use it for editing.

I think that LightTable is a very nice tool, but is focused on
Clojure, which is targetted to the JVM platform.

> I think this is a great project. I myself have recently started something
> similar which shamelessly puts coding (in Scheme) together with high school
> math. Two things I want to avoid is 1) having other "blub" languages fill
> this yawning gap (read Python), and 2) helping cushion the computer science
> wall where hot-shot high-school coders go to college, major in comp-sci . .
> . and then hit the comp-sci wall, i.e., discrete math, theory, no more cool
> coding tricks, etc.

Honestly, I think that Python is a very good tool for many practical
applications. I often use it at work, where I wouldn't be able to
conv

An impudent introduction to impudence

2016-02-08 Thread Keith Wright
Panicz Maciej Godek  writes:

> (I wonder whether we should switch to private correspondence, or
> doesn't anyone mind having such updates here?)

I would think so.  Thanks for telling us about
this project, it's interesting to read somebody
who cares about writing on a programming list.

For example:

Here are a couple of program/diatribes I have
been working on:

How can literate programming be done in Scheme?
http://www.free-comp-shop.com/pprint.html

Why does a dodecahedron have twice as many faces as a cube? 
http://www.free-comp-shop.com/poly.html

Please email me off list if you want to discuss
spelling, semantics, metaphysics, or geometry.

  -- Programmer in Chief



Re: An impudent introduction to impudence

2016-02-08 Thread Panicz Maciej Godek
2016-02-08 21:31 GMT+01:00 Keith Wright :

> Panicz Maciej Godek  writes:
>
> > (I wonder whether we should switch to private correspondence, or
> > doesn't anyone mind having such updates here?)
>
> I would think so.  Thanks for telling us about
> this project, it's interesting to read somebody
> who cares about writing on a programming list.
>
> For example:
>
> Here are a couple of program/diatribes I have
> been working on:
>
> How can literate programming be done in Scheme?
> http://www.free-comp-shop.com/pprint.html
>
> Why does a dodecahedron have twice as many faces as a cube?
> http://www.free-comp-shop.com/poly.html
>
>
This is exquisite!
I habe been thinking about something similar -- namely an editor that would
allow to typeset the Scheme code according to one's preferences (for
example, arithmetic expressions could be infixed, division could be written
as fractions, (list-ref l i) as $l_{i}$, and so on. I don't think it would
actually be useful, but it could shut the mouth of parentheses-haters
(which isn't particularly motivating though)

Please email me off list if you want to discuss
> spelling, semantics, metaphysics, or geometry.
>
> Oh, I certainly will (in a few days), but I rather hope to discuss
typography, epistemology and dynamic systems :)
Thank you!