Skip to content

Commit

Permalink
:= operator
Browse files Browse the repository at this point in the history
  • Loading branch information
damien-mattei committed Apr 2, 2024
1 parent 48c00b2 commit ea0f6a3
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Scheme+.scm
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@
def
$bracket-apply$
$bracket-apply$next
<- ←
<- ← :=
-> →
<+ ⥆
<+ ⥆ :+
+> ⥅
declare
$> $+>
Expand Down
14 changes: 14 additions & 0 deletions assignment.scm
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,20 @@
((_ var ...) (<- var ...))))


;; scheme@(guile-user)> {x :+ 7}
;; scheme@(guile-user)> x
;; $1 = 7
;; scheme@(guile-user)> {x := "hello"}
;; scheme@(guile-user)> x
;; $2 = "hello"

(define-syntax :=

(syntax-rules ()

((_ var ...) (<- var ...))))



;; (declare x y z)
;; {(x y z) <v (values 2 4 5)}
Expand Down
16 changes: 16 additions & 0 deletions def.scm
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,22 @@
((_ var ...) (<+ var ...))))



;; scheme@(guile-user)> {x :+ 7}
;; scheme@(guile-user)> x
;; $1 = 7
;; scheme@(guile-user)> {x := "hello"}
;; scheme@(guile-user)> x
;; $2 = "hello"

(define-syntax :+
(syntax-rules ()

((_ var ...) (<+ var ...))))




;; > {(values 2 4 5) +> (x y z) +> (u v w) +> (a b c)}
;; 2
;; 4
Expand Down
4 changes: 2 additions & 2 deletions operation-redux.scm
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

;;(list 'dummy) ;; can keep the good order in case of non left-right assocciative operators.(odd? reverse them)

(<- -> ← → <v v> ⇜ ⇝)
(<+ +> ⥆ ⥅)
(<- -> ← → := <v v> ⇜ ⇝)
(<+ +> ⥆ ⥅ :+)
)

)
Expand Down

0 comments on commit ea0f6a3

Please sign in to comment.