shen.clj
shen.clj copied to clipboard
Error when running `total` from shen in 15 minutes
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])))
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