probcomp / metaprob

An embedded language for probabilistic programming and meta-programming.
GNU General Public License v3.0
168 stars 17 forks source link

Make sure (length '{}) works #74

Closed jar398 closed 5 years ago

jar398 commented 6 years ago

(length '{}) needs to yield 0. I don't think there's a test for this in sequence_test.clj. I don't know whether the test would succeed; if not length should be fixed.

zane commented 6 years ago

Small note: No need to quote the empty map literal. (= '{} {}) ; true

jar398 commented 6 years ago

In clojure. I quote it as a metaprob habit. (maybe we should change metaprob.)

alex-lew commented 6 years ago

(quote ...) is not understood by the Metaprob (definitional) interpreter, is it?

I think we should discuss this issue at some point — like, should quote convert Metaprob source into its trace representation? — and also the question of whether Clojure-written macros can or should be made to work in (interpreted) Metaprob code.

jar398 commented 6 years ago

Absolutely right! Totally forgot.

Maybe this test should be written some other way. (trace) would be right if we (that is, I) weren't preserving the option of reverting to (trace) evaluating to () some time in the future. Maybe there's some expression involving clojure core functions that yields an empty hashmap? Can't think of one off the top of my head, but I expect there is.

Or, quote could be implemented. That's a @vkmvkmvkmvkm question. Fortunately it doesn't affect the interpreter, since it can be elminated in the 'parser' (syntax.clj).