Yuce's Blog

Cognitive dissonance is yoga for the brain.*

Marvin3 is launched

2005-09-27

Marvin3 is a new cross-platform stack-based language developed in Python. Marvin3 features object-oriented-pro­gram­ming, anonymous routines, eager lists, variables, lexical scope, com­bi­na­tors and support for modules.

This is from my Marvin3 project home. Marvin has evolved into Marvin3 and is becoming ready to be tried by the audience. In order to make it better known, and because it is free software, I requested a Source­Forge account yesterday, and to my surprise my request was approved in a couple of hours (while I was led to believe that it would take two days!!!). Well, I am happy for that, and I released Marvin3 0.0.6 which has some continue.

Comment

marvin3, marvin

Ubuntu is Great

2005-09-14

Last week, I received 20 (1 install + 1 live) Ubuntu Linux 5.04 (Hoary Hedgehog) CDs FOR FREE (details will follow). Of course in no time I installed it. I have to say that Hoary rocks! I was using Warthy before, and this new release fixes the few problems Warthy had (e.g., my Kingston USB-disk is now recognized, and my computer turns off when I log out.)

The new version of Ubuntu, Breezy Badger is on its way out but let me write some of the features of Hoary:

Comment

ubuntu, hoary hedgehog, linux, FOSS

The Gods Made Heavy Metal in Istanbul

2005-09-13

The eminent heavy metal band Manowar was in Istanbul, Turkey on August 6th 2005. The concert was at Yedikule (7 Towers) Dungeons, the perfect place for it. It was also raining and thundering when the band was playing Hail and Kill. The show was in one word, PERFECT!, we kept on screaming and singing the songs at the top of our voice during the concert (well, I couldn't speak for two days afterwards :)).

One of the most important events of the concert was, Joey DeMaio's announcement in which he said, "Manowar's hatred against Turks is a LIE!"; he even kissed the Turkish flag, continue.

Comment

Manowar, heavy metal, Istanbul, concert

Generating All Strings of a Given Alphabet

2005-06-10

For a recent research project, I had to write a function that generates all the strings of a given alphabet. It was (as always) very easy to figure it out in Python, only 5 minutes; below is the code (with mod­i­fi­ca­tions, I've polished the idea a bit):

def allstrings(alphabet, length):
    """Find the list of all strings of 'alphabet' of length 'length'"""

    if length == 0: return []

    c = [[a] for a in alphabet[:]]
    if length == 1: return c

    c = [[x,y] for x in alphabet 
continue.
Comment

python, strings, combination

Accumulator Generator

2005-04-26

In his accumulator generator page, Paul Graham compares several languages to solve a particular problem that is quoted below (apparently, he has chosen this example in favor of his new Lisp-like language Arc):

The problem: Write a function foo that takes a number n and returns a function that takes a number i, and returns n incremented by i.

Note: (a) that's number, not integer, (b) that's incremented by, not plus.

My trial with Marvin was a failure, and could not satisfy all the 5 requirements given here. But now with Marvin2 (a rewrite of the language) this can be accomplished with the following line:

@foo 
continue.
Comment

marvin, accumulator generator, Paul Graham

Infix Comparison in Marvin

2005-04-16

Here is a sample Marvin code that converts an infix expression into postfix. I have also posted this one to the In­fix­Com­par­i­son page of Con­cate­na­tive Languages Wiki. Note from the future: Sadly, these links are broken.

# infix.mar | Converts an infix expression into postfix

# This implementation uses the global variable space as a hash-table
# for operator precedence.

"listop forth dequeop" use

@|> globs & pushfrom ;

@string dfront NONE =
    { iftrue dpushf }
    { else
        dpopf 2dup |>
        { iftrue swap dpushf }
  
Comment

marvin, infix

Infix to Postfix Converter Class in Marvin

2005-04-16

Here is an object oriented version of the infix to postfix converter written in Marvin:

# infixoop.mar | Converts an infix expression into postfix

# This implementation uses the object data as a hash-table
#    for operator precedence.

"listop forth dequeop" use

@@Infix
    @new  # define the hash-table for operator precedence
        FALSE ^++ ^+- ^-+ ^-- ^*+ ^*- ^** ^*/ ^/+ ^/- ^/* ://
        TRUE ^+* ^+/ ^-* :-/ me ;

    @|> & pushfrom ;

    @string dfront NONE 
Comment

marvin, infix, postfix

Currying in Marvin

2005-04-12

Yesterday, I figured out a way (which was very obvious) to curry a routine in Marvin. First of all, what's currying?

Currying is named after the logician Haskell Curry. (...) The underlying insight of "currying" is that it is possible to treat (almost) every function as a partial function of just one argument. All that is necessary for currying to work is to allow the return value of functions to themselves be functions, but with the returned functions narrowed or closer to completion. (...) each successive call to a curried return function fills in more of the data involved in a final com­pu­ta­tion (data attached continue.

Comment

marvin, currying

Another Currying Example in Marvin

2005-04-12

Please see my previous post before if you haven't done so.

I've quoted David Mertz's article Charming Python in my previous post. In that article, (besides other things) a Haskell function is curryied as:

computation a b c d = (a + b^2+ c^3 + d^4)

Then it is filled as follows:

fillOne   = computation 1
fillTwo   = fillOne 2
fillThree = fillTwo 3
answer    = fillThree 5

and the answer is 657. The same thing can be done in Marvin:

[ swap 2 ** + swap 3 ** + swap 4 ** + ] :computation
[ 1 \computation ] :fillOne
[ 2 \fillOne ] 
Comment

marvin, currying