hraberg / shen.clj

神.clj | Shen for Clojure. Shen is a portable functional programming language by Mark Tarver.
shenlanguage.org
Other
155 stars 9 forks source link

Error when running `total` from shen in 15 minutes #6

Open sovelten opened 6 years ago

sovelten commented 6 years ago

I'm trying to run the code below without success. The function is an example from Shen in 15 minutes. Am I missing something?

(ns shen-test.core
  (:use [shen.primitives :only (value set shen-kl-to-clj λ 神 define defmacro defprolog prolog?
                                      reset-macros! package parse-shen parse-and-eval-shen)])
  (:refer-clojure :exclude [+ eval defmacro set for filter])
  (:require [shen])
  (:gen-class))

(神
 (define total
   []      -> 0
   [X | Y] -> (+ X (total Y)))

 (shen/print (total [2 1])))
hraberg commented 6 years ago

Hi Eric,

This port of Shen was last changed in 2013, and is stuck on an ancient version of Shen. I'm not actively working on or maintaining this, So either the Shen in 15 minutes tutorial could have moved on, or it's a bug.

This fork is more up to date it seems (changed in 2015), but I haven't looked at it closer: https://github.com/michaelsbradleyjr/shen.clj

The embedded Clojure macros for Shen don't support everything that can be evaluated via the real Shen reader, which is used when loading files or using the Shen REPL.

cheers, Hakan