[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] xc: chicken-based “bc” replacement
From: |
Mario Domenech Goulart |
Subject: |
Re: [Chicken-users] xc: chicken-based “bc” replacement |
Date: |
Tue, 25 Nov 2008 09:07:03 -0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) |
Hi Alejo.
On Fri, 21 Nov 2008 18:12:26 +0100 Alejandro Forero Cuervo <address@hidden>
wrote:
> I decided to write a simple bc replacement using Chicken. I had the
> following goals:
>
> 1. Have a syntax for expressions that requires very little typing. In
> other words, make it fast to evaluate a lot of expressions.
>
> 1.1. Allow me to type inputs in multiple formats. For instance,
> understand “5d3h20s” or “23:12:03” (time) and convert that to 442820.
> Similarly for things like “3Gi” (3*2^50) or “3G” (3*10^9).
>
> 2. Have a syntax for expressions that most people would understand.
> For example, I use infix binary operators and express procedure
> application as “proc(arg0, ..., argn)”. This will allow me to show
> the expressions I use to evaluate certain things to people that I work
> with. Basically, have a syntax as “universal” as possible.
>
> 3. Allow me to specify the format in which I want the output.
>
> 4. Allow me to call functions defined in Scheme. Also allow me to
> set variables and reuse their values.
Pretty cool. Another usage alternative I've thought would be plugging
xc.scm in csi and defining a csi toplevel command[1] (e.g., ,xc ).
So you could use csi like you usually do and you'd have a ,xc command
that passes expressions to xc. Something like:
csi> ,xc 1+1
2
Just a random thought.
[1] http://chicken.wiki.br/Using%20the%20interpreter#toplevel-commands
Best wishes.
Mario