I love scheme, but it can be incredibly verbose. From his code, a simple function to swap items in a vector:
(define (vector-swap vec i j)
(let ([t (vector-ref vec i)])
(vector-set! vec i (vector-ref vec j))
(vector-set! vec j t)))
I think that beats most other languages in terms of characters typed. It feels like a minor issue for an otherwise elegant language, but it has turned me off to writing large programs in scheme.
My limited experience is that Scheme is usually a little more verbose than Python, but not much. And it makes less difference for large programs, where hopefully a lot of your code looks like this:
static int physmap_flash_remove(struct platform_device *dev)
{
struct physmap_flash_info *info;
struct physmap_flash_data *physmap_data;
int i;
info = platform_get_drvdata(dev);
if (info == NULL)
return 0;
platform_set_drvdata(dev, NULL);
physmap_data = dev->dev.platform_data;
if (info->cmtd) {
mtd_device_unregister(info->cmtd);
if (info->cmtd != info->mtd[0])
mtd_concat_destroy(info->cmtd);
}
I mean, Scheme clearly has its drawbacks here, but I don’t think verbosity is much of a problem.
(Confession, though: my first random piece of code from Linux was spi_tegra_fill_tx_fifo, which doesn’t match my preconceptions of what “large program code” looks like, and would probably be a lot more messy in vanilla Scheme without extra macros.)
Uhh, I’m not really seeing how the Scheme code in that example is less verbose than the C code. If anything, the deeper indentation level makes it more difficult to read.
The point is that the verbosity of the core forms and functions is only relevant when writing a code that needs them. Usually, you very quickly bootstrap to much higher realms of business logic and abstraction layers where it shines.
It’s not less verbose, and I agree about the nesting. But it’s not noticeably more verbose either. And that C code has been used to successfully write a large program.
I love scheme, but it can be incredibly verbose. From his code, a simple function to swap items in a vector:
I think that beats most other languages in terms of characters typed. It feels like a minor issue for an otherwise elegant language, but it has turned me off to writing large programs in scheme.
It can be made less verbose with appropriate aliases, which you can write yourself and import into all your programs.
My limited experience is that Scheme is usually a little more verbose than Python, but not much. And it makes less difference for large programs, where hopefully a lot of your code looks like this:
which is to say:
I mean, Scheme clearly has its drawbacks here, but I don’t think verbosity is much of a problem.
(Confession, though: my first random piece of code from Linux was spi_tegra_fill_tx_fifo, which doesn’t match my preconceptions of what “large program code” looks like, and would probably be a lot more messy in vanilla Scheme without extra macros.)
Uhh, I’m not really seeing how the Scheme code in that example is less verbose than the C code. If anything, the deeper indentation level makes it more difficult to read.
The point is that the verbosity of the core forms and functions is only relevant when writing a code that needs them. Usually, you very quickly bootstrap to much higher realms of business logic and abstraction layers where it shines.
It’s not less verbose, and I agree about the nesting. But it’s not noticeably more verbose either. And that C code has been used to successfully write a large program.