let, let* and multiple local variable bindings

15 views
Skip to first unread message

hhk...@gmail.com

unread,
Jun 23, 2014, 11:39:50 AM6/23/14
to jo...@googlegroups.com
Hi,

The doc of Joxa doesn't talk much about these two let(*) keywords.  I try serveral times on Joxa shell. It seems let couldnot be used inside function. Would anyone like to give a summery of the usages of let and let*?

And I don't get it right to do multiple variable bindings using let* in function(using the let(*) syntax in common lisp). Any elaboration on it would be appreciated too.

Regards,
Dylan


Eric Merritt

unread,
Jun 23, 2014, 8:16:41 PM6/23/14
to dylan.wen, jo...@googlegroups.com
Dylan,

Would you show an example of the code you are having a problem with?

Eric


--
You received this message because you are subscribed to the Google Groups "joxa" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joxa+uns...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

dylan.wen

unread,
Jun 23, 2014, 11:10:10 PM6/23/14
to Eric Merritt, jo...@googlegroups.com
Eric,

After taking a close look at the Joxa doc and some projects code in github, I realize let syntax in Joxa is like clojure rather than common lisp. So variable bindings is done by position mapping, no additional '()' for variable-value group partition is needed.

I try this code and it fail to compile through:

(defn f ()
  (let (a 1)
   a))

reporting error as:

:0:0 *error* invalid reference a/1
:0:0 *error* reference does not exist: a
:0:0 *error* invalid reference 'let'/2
error

So only let* could be used inside function definition, right?
On the other side, where and when could let be used? Record would have its let function generated according to the Joxa doc.

Regards,
Dylan

于 14-6-24 8:16, Eric Merritt 写道:

Eric Merritt

unread,
Jun 24, 2014, 10:36:17 AM6/24/14
to dylan.wen, joxa
Dylan,

 In joxa the '*' indicates a non-pattern matching function. Let (which is defined in `joxa-core` btw, is a pattern matching version of let). The '*' are designed as primitives to use in macros and the like.  Let is a good example of this:

Considering the namespace collision with lisp that may have been a bad choice. Joxa is very much not a common lisp, and so that can cause problems.

https://github.com/erlware/joxa/blob/next/src/joxa-core.jxa#L176

Eric
Reply all
Reply to author
Forward
0 new messages