Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Can common lisp do THIS?

Name: Anonymous 2018-01-10 13:47

(define-syntax toaster
(lambda (stx)
(syntax-case stx ()
[(_ x) #'"toasted something"]
[(_) #'"toasted nothing"]
[_ #'"this is a toaster"])))

(display toaster)
(newline)
(display (toaster))
(newline)
(display (toaster a))
(newline)


Scheme wins again.

Name: Anonymous 2018-01-14 8:01

Symta can, but (display toaster) requires defining toaster through mexlet, which, just like symbol-macrolet in Common Lisp, defines local syntatic constant:
toaster @Xs = case Xs
[_ X] | 'toasted something'
[_] | 'toasted nothing'

export \toaster
...

mexlet toaster 'this is a toaster'
| say toaster
| say: toaster
| say: toaster a

Name: Anonymous 2018-01-14 8:05

>>15
Here is how mexlet used in real Symta code to define C++ style for-loop:
expand_loop Head Post Body =
| L = @rand l
| Post = if got Post then [Post] else []
| Break = []
| when Body^has_head{pass}:
| Pass = @rand pass
| Body <= [mexlet [pass] [_goto Pass] Body]
| push [_label Pass] Post
| when Body^has_head{done}:
| Done = @rand done
| Body <= [mexlet [done] [_goto Done] Body]
| push [_label Done] Break
| [_progn [_label L]
[_if Head
[_progn Body @Post [_goto L]]
No]
@Break]

for @As = case As
[Item Items Body] | expand_map_for times Item Items Body
[[`;` Entry Cond Post] Body]
| ['|' Entry (expand_loop Cond Post Body)]
Else
| mex_error "`for` has bad syntax [As]"

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List