>Should I learn [blank]?
The answer is always, "Yes, you should."
~~-~~
But, let me google that for you:
https://www.google.com/#q=lambda+programming+practicality&safe=off
The second link:
https://stackoverflow.com/questions/114581/how-helpful-is-knowing-lambda-calculus
>The main use of lambda calculus in practice is that it is a great laboratory tool for studying new programming-language ideas. If you have an idea for a new language feature, you can add the new feature to the lambda calculus and you get something that is expressive enough to program while being simple enough to study very thoroughly. This use is really more for language designers and theorists than for programmers.
>Lambda calculus is also just very cool in its own right: just like knowing assembly language, it will deepen your understanding of computation. It's especially fun to program a universal turing machine in the lambda calculus. But this is foundational mathematics, not practical programming.
This is a very good question.
Here is one view:
Consider this situation: The function f calls a function g. The function f needs several values from g. Without multiple value return, g must pack the values in a list (or vector), which is then passed to f. Then function f then immediately unpacks the list.
With multiple value return, the values are just pushed on the stack. Thus no packing and unpacking is done.
Whether this should be called an optimization hack or not, is up to you.
For a very interesting discussion with many different views of the matter, see this discussion in comp.lang.scheme (35 persons participated!).
https://groups.google.com/forum/#!topic/comp.lang.scheme/ruhDvI9utVc%5B1-25%5D
Also if you are interested how the multiple values return feature was designed take a look at the discussion in 1985/1986.
I'm the author of the post you linked to :)
Unfortunately, GNU Guile on Windows is in a sad state. I've not been able to build any versions of Guile after 2.0.11, and since Guile uses gnulib, Windows is more or less treated as a secondary citizen. However, 2.0.11 does work and it's pretty good together with Emacs as the IDE.
Other free alternatives is Chicken Scheme and Racket. Chicken also comes with its own package system which is great in order to get started quickly.
I'm not sure whether Racket can be embedded, but Chicken certainly supports this.
It used to be very hard for me to read Scheme/Lisp in general. The older I get, the less that statement applies. At this point, I can glance at most Scheme and be able to read it instantly (not necessarily understand, that might take a little more effort, but I can tell what everything is doing.) The parenthesis sort of bleed into the background for me.
The writability of Scheme changes so much from implementation to implementation. I prefer to work in Guile scheme -- I know its module system well, and IMO Guile has everything I need to quickly hack together something. I've been trying to capture utilities I reuse on more than one program in a utility file.
Without SRFI's or the use of platform-specific libraries, I personally think it's hard to get anything practical done with Scheme. That being said, the SRFI's are fairly well documented and simple to use.
Finally, there are three notable features that make Scheme great to analyze:
Hygienic Macros
call/cc
The metacircular evaluator
For call/cc, you might be particularly interested in looking at an implementation of McCarthy's Ambiguity Operator. Macros in general are talked about a lot in "The Seasoned Schemer," and the metacircular evaluator is discussed at length in the classic "Structure and Interpretation of Computer Programs." If you haven't read this book yet, I strongly recommend it. It's one of the best CS books ever written!
Hope this helps:)
IU CS student here, and unfortunately there aren't as many resources for Scheme online. You should try doing some of the problems at Project Euler starting from 1 and working on down.
Your assignments in the class should be plenty of prep though.
I had thought about CL and Clojure but didn't bother investigating as I was using scheme for something else at the time.
One thing to note about Chicken, is despite having a comparatively small library compared to Python, it's FFI tools are pretty slick. I got bindings to inotifiy more or less working in a few hours.
Shit, I need a project idea.
Amazon says it's coming out March 9th.
https://www.amazon.com/Software-Design-Flexibility-Programming-Yourself/dp/0262045494
The canonical scheme book: Structure and Interpretation of Computer Programs
But really, Scheme is pretty easy. It's mostly just prefix notation for invoking operators on operands (coupled with lots of parentheses):
(+ 1 2)
yields 3. And you can nest them all you want:
(+ (- 1 2) (* 3 4))
... is the same as "(1 - 2) + (3 * 4)".
Functions are just different operators. For example, if you define this function:
(define (my-add x y) (+ x y))
You can invoke it with:
(my-add 1 2)
You should learn about lists, which is the primary data structure. Everything between a pair of parentheses is a list. Evaluation of an expression just involves taking the first item in the list (the operator, e.g. +) and applying it to the remaining items in the list (1 2).
And you should learn about control and binding constructs like "let", "if", and "while".
Beyond that, you just need a good reference for looking up support routines and whatnot (google for r5rs). And that'll get you 80-90% there.
They partitioned their git repository last winter, and are re-engineering their release process to accommodate the new structure. A new release will appear Real Soon Now.
> Racket also has defmacro
Yes, as most Schemes have, definitely those before R5RS. As it is quite easy to build, no wonder.
I didn't know about syntax-parse
yet, thanks. Apparently the Clojure port does also support syntax-parse
, but no idea how hard it is to port to CL or even how well it works.
"The application is sold for $0.99 as a demonstration that you can distribute on the App Store paid applications written in Scheme and containing an interpreter, something that wasn't clear with previous versions of the App Store developer agreement."
I've been playing around with GNU Guix and so far I like what I see in it. In the future I intend to write about its design and what I feel are its pros and cons after I do some more research and spend some more time using it.
These are well-known CS textbooks that you can use to teach yourself Scheme, and have free full-text online:
> So my question is, do you think there are any future plans to compile the file to a standalone executable?
You can use guix pack, it's not an executable per se but offers a similar experience https://www.gnu.org/software/guix/blog/2018/tarballs-the-ultimate-container-image-format/
You will need to package your program as guix package tho. This might mean that your package is autotools based which is almost trivial for pure guile modules and only a little trickier for bindings. I don't know how to package C based Guile project...
> So would guile be a good fit for webdev?
Mostly, yes. There is really no postgresql bindings, but there some for sqlite (check guix -A guile-sqlite) and for rendering html you can use sxml [1].
CL is nice, might have more users or their more vocal and / or talended but it's a lisp-2 and I don't see a good reason for that. IMHO Scheme is a better foundation for good engineering. Guile is mostly batteries included, only racket competes with Guile AFAIK in terms of packages. Chez Scheme is fast.
[1] That is the entry point for requests and look at 'template' https://framagit.org/a-guile-mind/culturia.next/blob/master/culturia/web.scm#L460
> Why do the people in charge of Gnome care what language a piece of software is written in, if it meets whatever other standards they set?
What standards do you have in mind that are not best served by a programming language?
I initially had the same knee-jerk response as you and as most in this thread. But later thought brought me around.
If you want to write a game or any other tool in Scheme or any other language and distribute it yourself, great. But calling it a Gnome game implies that it's going to work well in the Gnome desktop and be part of their build and QA process. GObject alone is complex enough that using it from C is unwieldy and error-prone. A Schemer's first response to that situation would be writing macros to more clearly and correctly represent what the code needs to do. That's not really very different from creating a pre-compiler using a syntax that's somewhat familiar to the community.
There also doesn't seem to be a great shortage of tools written in Vala.
On this reddit, you're saying your glad you use XFCE ... because C is a more suitable language? Really? :)
This is how it's defined in my Interpretation of Computer Programs class:
(define (apply procedure arguments) (cond ((primitive-procedure? procedure) (apply-primitive-procedure procedure arguments)) ((compound-procedure? procedure) (eval-sequence (procedure-body procedure) (extend-environment (procedure-parameters procedure) arguments (procedure-environment procedure)))) (else (error "Unknown procedure type -- APPLY" procedure))))
It's part of a meta-circular evaluator, and as the class name suggests, based on the one found in Structure and Interpretation of Computer Programs.
I have tried guile-gi recently. I did not yet find a way to make a menu dynamically, without loading ui files, but here is what I have so far: https://notabug.org/ZelphirKaltstahl/guile-examples/src/master/gui
I have not tried g-golf yet, but it looks syntactically very similar. I am not sure what the differences are.
Just like you, I would like to make a GUI for something.
Last things first -- if you're already implementing binding macros, you're a real programmer! See the code at https://github.com/plt/racket/tree/master/collects/racket/match to get started.
match-let
with named let
would a great first place to get started. See the file define-forms.rkt
there.
General recursive pattern matching isn't well studied, although match
provides destructuring of lists recursively.
Disabling third-party scripts does not alleviate the privacy issues with using Discord. It is still necessary to run the (obfuscated) Discord JS app and, of course, the proprietary Discord protocol. Their privacy policy makes it clear that they practice extensive collection of chat data.
Please consider moving this chatroom to a FOSS alternative like Matrix.
It just says introduce a binding in the phase used by the expander. The ~>
isn't necessary, though it is valid syntax-rules
that should work all the way down to r5rs.
Here's an implementation for Chez that I tested at https://tio.run/#scheme-chez since I don't have it installed. I had to write my own sloppy string-split
because they don't seem to have the SRFIs setup.
(define (string-split s c) (let loop ((ls (reverse (string->list s))) (ws '())) (if (null? ls) ws (let* ((total (length ls)) (rest (or (memq c ls) '())) (used (- total (length rest))) (w (list->string (reverse (list-head ls used))))) (loop (if (null? rest) rest (cdr rest)) (cons w ws))))))
(define-syntax .. (lambda (stx) (syntax-case stx () ((_ expr) (let ((wrap (lambda (x) (datum->syntax #'expr x))) (parts (string-split (symbol->string (syntax->datum #'expr)) #.))) (with-syntax ((var (wrap (string->symbol (car parts)))) ((props ...) (map wrap (cdr parts)))) #'(lookup var props ...)))))))
(define foo '(("bar" ("baz" . 7))))
(define (lookup val . keys) (let loop ((val val) (keys keys)) (cond ((null? keys) val) ((not (pair? val)) #f) (else (loop (cdr (assoc (car keys) val)) (cdr keys))))))
(write (expand '(.. foo.bar.baz))) (display " => ") (write (.. foo.bar.baz))
It prints (lookup foo "bar" "baz") => 7
.
>These are called "Threading macros" in Clojure, but is there a clearer name to use in Scheme? It needs to be clear that these have nothing to do with threads of execution.
From Clojure docs:
>Taking an initial value as its first argument, <code>-&gt;</code> threads it through one or more expressions.
>
>>Note: The word "thread" in this context (meaning passing a value through a pipeline of functions) is unrelated to the concept of concurrent threads of execution.
I find this naming to be ambiguous only when you first encounter such macro and never again.
Yeah, it's good for intermediate applications. The namespace system is good for organizing code, and the strong encouragement for immutable data guides your hand in systems design. That's plenty good enough to make it nice to use in truth.
Other "systems" feature of the language like multi methods you use far less (even if they are nifty), and things like protocols and `reify` are as restricted to Java interop as the docs claim.
I think that as a language it's a bit too all over the place with the code-organization features, think of the way multi methods are described in the documentation, you'd get the impression that they are meant for the rarely if ever used feature of hierarchies, exemplified with the rarely if ever used feature of namespaced keywords.
the other nice from clojure are the threading macros. a crude macro in syntax-rules would look something like this:
(define-syntax -> (syntax-rules () [(_ x) x] [(_ x ... (y z ...)) (y (-> x ...) z ...)] [(_ x ... y) (y (-> x ...))]))
(define-syntax ->> (syntax-rules () [(_ x) x] [(_ x ... (y z ...)) (y z ... (->> x ...))] [(_ x ... y) (y (->> x ...))]))
I'm not sure what the incompatible changes in 2.2 were. All I know is what the latest release notes for Guile-Gnome stated.
Thanks for the description of your experience with Guile-Gnome. I think I'll continue looking at other Lisp GUI libraries for now.
I don't want to dissuade you from using Guile. I think it's an excellent Scheme implementation to write shell script-like programs in Scheme, but may I suggest Racket to you for GUI programming with Scheme. It has a well-documented GUI library built-in to the language. I've written a tutorial, and here's another tutorial that honestly is even better than mine.
Hey thank you for asking !
Yep I use mdbook ! The multilingual branch if i recall it correctly with customization 😉
There is an awesome-guile project over here : https://notabug.org/ZelphirKaltstahl/awesome-guile
I had hard time to learn Guile by myself (I am still learning!). The language reference is really broad and dense ! I needed to learn more about Scheme to appreciate it.
But learning Guile via Scheme ressources was not always easy as I wanted because of divergence in implementation api. So I started mine focused on Guile ! Moreover I didn't found much help to practice TDD in Scheme so it's where the test driven learning style comes from.
I thought about the problem and how to solve it in a way, that does not require global state and does not require mutation. Took a while, but I got it done and I think well commented: https://notabug.org/ZelphirKaltstahl/tower-of-hanoi-fp
It also has some outputs when moving a disk. If you need more, I think it should be simple enough to add more display calls.
The code is written in GNU Guile.
Structure and Interpretation of Computer Programs (SICP) isn't really about scheme. It happens to use scheme but it's more about computing than scheme. Having said that, it is by far the best instructional book I have ever read and is a must for anybody who is interested in computation.