• Sigils over namespaces

    From Elijah Stone@21:1/5 to All on Mon Apr 26 22:00:21 2021
    This message is in MIME format. The first part should be readable text,
    while the remaining parts are likely unreadable without MIME-aware tools.

    Consider sigils (in a proposed lisp-1) as an alternative to namespaces (in
    a lisp-2).

    They solve the traditional problem:

    (let (($cons 5)) (cons $cons $cons)) ; → (5 . 5)

    They also obviate funcall:

    (defun abs ($x)
    ((if (< $x 0) &- &+) $x))

    As well as making things generally more consistent:

    (let ((&foo (lambda ($x) (+ 2 (* 2 $x)))) ; look, ma; no labels!
    ($foo 5)) ; uniform binding for all sorts
    (foo $foo)) ; → 12

    (An unsigilled symbol in the head position of a list to be evaluated is
    treated as though it had the & sigil; this is just syntactic sugar:

    (let ((&foo (lambda () 5))
    ($foo (lambda () 6)))
    (foo) ; → 5
    (&foo) ; → 5
    ($foo)) ; → 6)

    (They also enable string interpolation which, though not a must-have, is
    still pretty nice.)

    Thoughts?

    -E

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Elijah Stone on Tue Apr 27 15:59:30 2021
    On 2021-04-27, Elijah Stone <elronnd@elronnd.net> wrote:
    (let ((&foo (lambda () 5))
    ($foo (lambda () 6)))
    (foo) ; =E2=86=92 5
    (&foo) ; =E2=86=92 5
    ($foo)) ; =E2=86=92 6)

    (They also enable string interpolation which, though not a must-have, is
    still pretty nice.)

    Thoughts?

    Please repost without MIME quoted printable encoding.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Zyni=20Mo=C3=AB?=@21:1/5 to Elijah Stone on Tue Apr 27 17:21:57 2021
    Elijah Stone <elronnd@elronnd.net> wrote:


    (let ((&foo (lambda ($x) (+ 2 (* 2 $x)))) ; look, ma; no labels!
    ($foo 5)) ; uniform binding for all sorts
    (foo $foo)) ; → 12

    (An unsigilled symbol in the head position of a list to be evaluated is
    treated as though it had the & sigil; this is just syntactic sugar:


    All the disadvantages of a Lisp-1 with all the disadvantages of a Lisp-2 at
    the same time! Wonderful. You could add a special @ sigil for arrays
    perhaps, to make it even better.



    --
    the small snake

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Elijah Stone@21:1/5 to Kaz Kylheku on Tue Apr 27 13:50:11 2021
    On Tue, 27 Apr 2021, Kaz Kylheku wrote:

    Please repost without MIME quoted printable encoding.

    Here:

    Consider sigils (in a proposed lisp-1) as an alternative to namespaces (in a lisp-2).

    They solve the traditional problem:

    (let (($cons 5)) (cons $cons $cons)) ; -> (5 . 5)

    They also obviate funcall:

    (defun abs ($x)
    ((if (< $x 0) &- &+) $x))

    As well as making things generally more consistent:

    (let ((&foo (lambda ($x) (+ 2 (* 2 $x)))) ; look, ma; no labels!
    ($foo 5)) ; uniform binding for all sorts
    (foo $foo)) ; -> 12

    (An unsigilled symbol in the head position of a list to be evaluated is
    treated as though it had the & sigil; this is just syntactic sugar:

    (let ((&foo (lambda () 5))
    ($foo (lambda () 6)))
    (foo) ; -> 5
    (&foo) ; -> 5
    ($foo)) ; -> 6)

    (They also enable string interpolation which, though not a must-have, is
    still pretty nice.)

    Thoughts?

    -E

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Elijah Stone on Tue Apr 27 23:36:02 2021
    On 2021-04-27, Elijah Stone <elronnd@elronnd.net> wrote:
    On Tue, 27 Apr 2021, Kaz Kylheku wrote:

    Please repost without MIME quoted printable encoding.

    Here:

    Consider sigils (in a proposed lisp-1) as an alternative to namespaces (in a lisp-2).

    They solve the traditional problem:

    (let (($cons 5)) (cons $cons $cons)) ; -> (5 . 5)

    They also obviate funcall:

    (defun abs ($x)
    ((if (< $x 0) &- &+) $x))

    The question is, what are exactly & and $? It matters. Not always, but sometimes.

    Though subjectively, I wouldn't "go" for any version of this,
    any halfway sane implementation should have it so that $abc and &abc
    are both notations based on the same symbol abc. So that is to say,
    they are a shorthand notation like:

    $abc -> (var abc)
    &abc -> (fun abc)

    As well as making things generally more consistent:

    (let ((&foo (lambda ($x) (+ 2 (* 2 $x)))) ; look, ma; no labels!
    ($foo 5)) ; uniform binding for all sorts
    (foo $foo)) ; -> 12

    (An unsigilled symbol in the head position of a list to be evaluated is
    treated as though it had the & sigil; this is just syntactic sugar:

    But surely that's not what's happening with (let ...). The real rule has
    to be that an unsigiled symbol in the head position is resolved in the
    function space, where macros and special operators lie (other than
    symbol macros).

    Also, if foo is a macro, you probably don't want &foo to see it:

    (let ((&foo (lambda ())))
    (macrolet ((foo () ...))
    &foo)) ;; expansion leaves this alone, so it refers to the lambda

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From steve gonedes@21:1/5 to Elijah Stone on Tue Apr 27 21:12:17 2021
    Elijah Stone <elronnd@elronnd.net> writes:

    They also obviate funcall:

    (defun abs ($x)
    ((if (< $x 0) &- &+) $x))


    What is it with funcall? You have to call a function eventually. instead
    of using call or syscall; in common lisp they use funcall.

    I mean reducing function calls is usually good.

    (They also enable string interpolation which, though not a must-have, is
    still pretty nice.)



    Thoughts?


    I would love to have something like perl's format feature for lisp. Something simple. Ahh, they'll probably use pcre or something...


    -E

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From antispam@math.uni.wroc.pl@21:1/5 to Elijah Stone on Wed Apr 28 21:46:42 2021
    Elijah Stone <elronnd@elronnd.net> wrote:
    On Tue, 27 Apr 2021, Kaz Kylheku wrote:

    Please repost without MIME quoted printable encoding.

    Here:

    Consider sigils (in a proposed lisp-1) as an alternative to namespaces (in a lisp-2).

    They solve the traditional problem:

    (let (($cons 5)) (cons $cons $cons)) ; -> (5 . 5)

    AFAICS this would be valid in any reasonable Lisp-1

    They also obviate funcall:

    (defun abs ($x)
    ((if (< $x 0) &- &+) $x))

    In Lisp-1 I would write

    (defun abs (x)
    ((if (< x 0) - +) x)

    Of course, if you define '&-' and '&+' your version would be
    valid too.

    As well as making things generally more consistent:

    (let ((&foo (lambda ($x) (+ 2 (* 2 $x)))) ; look, ma; no labels!
    ($foo 5)) ; uniform binding for all sorts
    (foo $foo)) ; -> 12

    Why write this instead of

    (let ((foo (lambda (x) (+ 2 (* 2 x)))) ; look, ma; no labels!
    (bar 5)) ; uniform binding for all sorts
    (foo bar))

    (An unsigilled symbol in the head position of a list to be evaluated is
    treated as though it had the & sigil; this is just syntactic sugar:

    (let ((&foo (lambda () 5))
    ($foo (lambda () 6)))
    (foo) ; -> 5
    (&foo) ; -> 5
    ($foo)) ; -> 6)

    In Lisp-1 'foo' in '(foo)' would be undefined, but why you want
    to make this defined?

    (They also enable string interpolation which, though not a must-have, is
    still pretty nice.)
    Thoughts?

    Solution in search of a problem? Lisp-1 has advantage of consistency
    and generality. Lisp-2 follows tradition and has large codebase.
    Do you want to convert Perl users to Lisp?

    --
    Waldek Hebisch

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Zyni=20Mo=C3=AB?=@21:1/5 to antispam@math.uni.wroc.pl on Thu Apr 29 21:44:21 2021
    <antispam@math.uni.wroc.pl> wrote:

    Do you want to convert Perl users to Lisp?


    Perl is, by far, the most Lisp-like language which is not Lisp. Perl is
    much closer to CL than most Schemes are.

    Yes I know many will disagree. They are wrong. All people who disagree
    with me are wrong.

    --
    the small snake

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Manfred Bergmann@21:1/5 to Elijah Stone on Sat May 1 19:38:46 2021
    Hi.

    This is what Sigils are in Elixir: https://elixir-lang.org/getting-started/sigils.html

    Is this something similar? I think you have something else in mind, no?



    Manfred


    Elijah Stone schrieb am 27.04.21 um 22:50:
    On Tue, 27 Apr 2021, Kaz Kylheku wrote:

    Please repost without MIME quoted printable encoding.

    Here:

    Consider sigils (in a proposed lisp-1) as an alternative to namespaces
    (in a lisp-2).

    They solve the traditional problem:

    (let (($cons 5)) (cons $cons $cons)) ; -> (5 . 5)

    They also obviate funcall:

    (defun abs ($x)
      ((if (< $x 0) &- &+) $x))

    As well as making things generally more consistent:

    (let ((&foo (lambda ($x) (+ 2 (* 2 $x)))) ; look, ma; no labels!
          ($foo 5))                           ; uniform binding for all sorts
      (foo $foo))                             ; -> 12

    (An unsigilled symbol in the head position of a list to be evaluated is
     treated as though it had the & sigil; this is just syntactic sugar:

    (let ((&foo (lambda () 5))
          ($foo (lambda () 6)))
      (foo)   ; -> 5
      (&foo)  ; -> 5
      ($foo)) ; -> 6)

    (They also enable string interpolation which, though not a must-have, is
     still pretty nice.)

    Thoughts?

     -E

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Rubin@21:1/5 to Manfred Bergmann on Sat May 1 10:47:11 2021
    Manfred Bergmann <nospam@npspam.invalid> writes:
    This is what Sigils are in Elixir: https://elixir-lang.org/getting-started/sigils.html
    Is this something similar? I think you have something else in mind, no?

    It is similar. The concept originally came from Perl. You'd use @a to
    signify that a is an array, $a for a scalar variable, etc.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)