views:

190

answers:

6

Much like lisp is often considered a list based programming language what languages are considered map based?

I remember reading about one a few years back, but can not longer find a reference to it. It looked something like:

[if:test then:<code> else:<more code>]

edit: and more where quoted code blocks which would be conditional evaluated. In this fashion if/cond and others would not be special form as they are in lisp/scheme.

The syntax above is supposed to be map/dictionary like just like lisp's syntax is list like.

if would be a key with the value of test.

then would be a key with the value of .

...

+3  A: 

The obvious answer would be lua -- it uses tables heavily, and a table is pretty much a hash map (an associative array). Its syntax doesn't look much like you've shown above though.

What you have above looks quite a bit like Smalltalk, which certainly includes hash-based containers in its library, and the typical implementation uses hash tables internally to look up how an object should respond to a particular message. Nonetheless, calling it "hash/map based" seems like a bit of a stretch, at least to me.

Jerry Coffin
Thanks I will take a look at lua. The code sample was not from smalltalk it looked like a experimental language and was a personal project of the creator.
Davorak
+2  A: 

It's not quite what you describe, and it's not really hash-based, but your example looks a lot like Smalltalk:

test
  ifTrue: [code]
  ifFalse: [more code]

Update:

Your edit, "and more where quoted code blocks which would be conditional evaluated. In this fashion if/cond and others would not be special form as they are in lisp/scheme", suggests to me Tcl.

In Tcl, {} simply quotes a string. "If" is a command that evaluates the test, and then selectively evaluates another parameter based on that result.

I wouldn't exactly call Tcl a hash-based language, though hashes are kind of special in Tcl.

Ken
Thanks. Yeah Jerry Coffin mentioned that possibility. It was not small talk I edited my question to add some more details that I remember.
Davorak
@Davorak Re your edited question, they are not special forms in Smalltalk either. In fact, Smalltalk doesn't really have special forms, just messages. The language you are asking about looks very close to ST to me.
anon
Yes but the syntax is based on message passing rather then that of a map/dictionary. Though I really should spend some time learning smalltalk.
Davorak
+3  A: 

I'd suggest Lua too. The whole language is based around tables - objects are tables, their definitions are tables, variables are in tables, tables define scope, etc etc - where a table is a hashmap.

DeadMG
Yeah I will check it out as suggested, however I was looking for languages where the syntax was based on a map/dictionary like struct just like lisp has a list like structure.
Davorak
+2  A: 

The snipped you post looks like Objective-C very much, although is isn't map based in implementation, only the syntax looks like that.

One language that to my understanding uses dictionaries heavily is Python. Basically Python ( in my own words ) is a very big dictionary, but the syntax doesn't quite reflect that.

This is my source ( probably of confusion though )

http://code.google.com/edu/languages/index.html#_python_understanding

OscarRyz
Thank you. It is not python or objective-c. Python while has dictionaries, the language is not based on them. The syntax of the language I am referring is dictionary like just like lisp's is list like.
Davorak
+1  A: 

The MUMPS programming language has one base datatype which is essentially a hash/map, but be careful learning about MUMPS. There be dragons...

Daniel DiPaolo
Thanks, though I do not think I will take the time to learn mumps any time soon. I did not see an distinct advantages glancing at the wiki page. The language I was think of was created in the last decade and I do not think it has every been in major use.
Davorak
The database organization of MUMPS is worth to understand. (There be dragons, but they guard big secrets.)
ern0
+2  A: 

That looks very much like MISC, a lazy Lisp with maps instead of lists as the fundamental datatype. (It's also lazy, has deep integration of metadata (similar to Clojure) and a couple of other things, but it is still very much a Lisp: functional, homoiconic, macros, implemented as a metacircular interpreter, all the good stuff.)

Here's some code samples from the blog:

[if [> 5 10] then:[+ 5 10] else:[- 5 10]]

[let '[square:[lambda '[x:1] '[* x x]]]
    '[square 12]
]

[take 20 [numbers from:0]]

Unfortunately, it seems that besides two blog articles from long ago, there's not much going on anymore.

Jörg W Mittag
Yes! Thank you. That was what I was looking for. I did not think there was much going on with it anymore, but it tickled my interest and I wanted to play around with the implementation again but lost my copy some time ago.
Davorak
+1 Jörg nice finding. Does it have a `Fraction` type? :P :P Just kidding, I wonder how would it look like. http://stackoverflow.com/questions/2702450/implement-a-simple-class-in-your-favorite-language
OscarRyz