

The Broccoli Programming Language - fogus
http://www.earthvssoup.com/projects/broccoli

======
blogimus
Why Broccoli?

My curiosity was piqued so I went to your site and found a bit on _how_ to do
broccoli, but no links or text jumped out at me as to _why_ to do broccoli. Is
it just a novelty, or does it scratch some itch that other languages don't
address?

~~~
fogus
The latter. As it stands, it is no better than a 1000 different languages out
there. I will readily admit that.

I personally have a difficult time wrapping my head around ideas like,
functional, and closures, and lambda, in the abstract, so this is my way (not
there yet BTW) of really wrapping my head around these ideas.

------
fogus
Just a couple examples (below) of what the code looks like. Sigils
differentiate between scalars and collections (lists only at the moment).
Functions can be passed by name and called either directly (in parens) or
indirectly (with the call function). Written in C and Broccoli. Nothing
incredibly earth-scattering, but it is my attempt to write the language that I
would like to code in.

~~~
SwellJoe
It's interesting that you've opted to use Perl-style sigils, given the hatred
many programmers experience when seeing them (pg covers it with "no swearing"
in his arc guidelines).

I happen to like them, particularly for interpolation in strings...and strings
are so much of what we do with web applications. "There are $number posts" is
much more pleasant, to me, than "There are " . number . " posts". But I might
be weird, and there does seem to be an aversion to them in most recent
languages that have achieved popularity.

~~~
fogus
I too like sigils for two reasons: 1) Makes str interpolation (as you
mentioned) easier on the eyes.

2) I like to see, at a glance, what a variable "is doing". In Broccoli, there
are only two "doings" hold values, or holding a collection of values.

3) I know I said 2, but the real reason.... it is easier to parse. ;)

-m

------
jbum
I too was looking for a simple "about" page. Correct me if I'm wrong, but
here's my description:

This is a lisp-like language whose principal purpose is to help the creator of
the language thoroughly understand how programming languages (especially lisp-
like programming languages) work.

~~~
fogus
That is about right. However, the only thing that it shares with lisp at the
moment are the parens. ;)

------
carterschonwald
What does this language let me do that I can't do more easily / robustly in
another language?

To elaborate, does it allow for niftiness that I couldn't do with a solid
scheme or haskell environment, or does it beat out python or perl for quick
scripting in some domain?

~~~
fogus
I can't speak for Haskell, as I know very little (read: nothing) about it. As
for Scheme, it does nothing that Scheme couldn't do.

~~~
carterschonwald
ahh, so the project is moreso a bit of self pedagogy, cool!

------
fogus

      (fn map ($func @lst)
          (if (= @lst (list))
              (list)
           else
              (cat 	(call $func (first @lst)) 
                    (map $func (rest @lst))
              )
          )
      )

------
fogus

      (fn filter ($func @lst)
          (:= @ret (list))
    
          (for $e in @lst
               (if (call $func $e)
                   (:= @ret (cat $e @ret))
               ) 
          )
    
          @ret
      )

