New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add drafts of condp, if-not, when-not and not= #19

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
3 participants
@yurrriq
Member

yurrriq commented Nov 18, 2015

Per #15, #10, #11 and #12

For better or for worse, this definition of condp allows for various invocations:

(condp {{(lambda ...)}} x
  y z
  q {{module:function | function | (lambda ...)}}
  {{optional default}})

I'm very open to alternate strategies/decisions here, but I wanted to get an initial version written.

It would be great if not= weren't a macro, but this way it can be variadic like its Clojure analog.

@oubiwann

This comment has been minimized.

Show comment
Hide comment
@oubiwann

oubiwann Nov 19, 2015

Member

Keep in mind that these tickets aren't for merging code into clj -- we're using the add-clojure-lib branch of the oubiwann/lfe repo. (Didn't want to create a new "lfe" issue tracker in oubiwann/lfe, and this work will essentially deprecate the clj library in favor of using LFE's new built-in Clojure support).

When you submit the PR to that branch, be sure to rename your macros to clj:condp, etc. (to match the function prefixes for the modules).

I'm going to close this PR...

Member

oubiwann commented Nov 19, 2015

Keep in mind that these tickets aren't for merging code into clj -- we're using the add-clojure-lib branch of the oubiwann/lfe repo. (Didn't want to create a new "lfe" issue tracker in oubiwann/lfe, and this work will essentially deprecate the clj library in favor of using LFE's new built-in Clojure support).

When you submit the PR to that branch, be sure to rename your macros to clj:condp, etc. (to match the function prefixes for the modules).

I'm going to close this PR...

@oubiwann oubiwann closed this Nov 19, 2015

@yurrriq

This comment has been minimized.

Show comment
Hide comment
@yurrriq

yurrriq Nov 19, 2015

Member

Oops. Will do!

Member

yurrriq commented Nov 19, 2015

Oops. Will do!

@yurrriq

This comment has been minimized.

Show comment
Hide comment
@yurrriq

yurrriq Nov 19, 2015

Member

What are your thoughts on "raw" f | m:f vs #'f/a | #'m:f/a? The former is more Clojurian but the latter is more Liffy. I'm pretty on the fence.

Member

yurrriq commented Nov 19, 2015

What are your thoughts on "raw" f | m:f vs #'f/a | #'m:f/a? The former is more Clojurian but the latter is more Liffy. I'm pretty on the fence.

@rvirding

This comment has been minimized.

Show comment
Hide comment
@rvirding

rvirding Nov 20, 2015

Some points:

  • LFE is lisp-2 while clojure is lisp-1. So taking the value of a variable is different from getting the function binding from the name of a function. f and m:f take the value which is the function while #'f/1 and #'m:f/a are need to get the function binding (actually the create a function which calls the named function). It is same as the difference between (let ((f (lambda ...))) ...) and (flet ((f (a b) ...)) ...). What ever we may think of this it is something erlang imposes on us which we can not avoid.
  • When referring to a function you have include the arity as you can have functions with the same name but different arities.
  • My reason for going the "flet way" was to make things more consistent. Why should there only be one local function per name while I can have multiple top functions with the same name?

Again this basic handling of functions and references to functions is what erlang gives us which we can't do anything about.

rvirding commented Nov 20, 2015

Some points:

  • LFE is lisp-2 while clojure is lisp-1. So taking the value of a variable is different from getting the function binding from the name of a function. f and m:f take the value which is the function while #'f/1 and #'m:f/a are need to get the function binding (actually the create a function which calls the named function). It is same as the difference between (let ((f (lambda ...))) ...) and (flet ((f (a b) ...)) ...). What ever we may think of this it is something erlang imposes on us which we can not avoid.
  • When referring to a function you have include the arity as you can have functions with the same name but different arities.
  • My reason for going the "flet way" was to make things more consistent. Why should there only be one local function per name while I can have multiple top functions with the same name?

Again this basic handling of functions and references to functions is what erlang gives us which we can't do anything about.

@yurrriq

This comment has been minimized.

Show comment
Hide comment
@yurrriq

yurrriq Nov 20, 2015

Member

Right. The way I've written this (there's a small bug atm but I'll fix it before submitting a PR to oubiwann/lfe) allows users to pass in function names "Clojure style," for better or for worse.

I guess my real question is, should we enable such unidiomatic invocation by way of sugar since this is a Clojure-inspired macro, or stick with LFE conventions when porting?

Member

yurrriq commented Nov 20, 2015

Right. The way I've written this (there's a small bug atm but I'll fix it before submitting a PR to oubiwann/lfe) allows users to pass in function names "Clojure style," for better or for worse.

I guess my real question is, should we enable such unidiomatic invocation by way of sugar since this is a Clojure-inspired macro, or stick with LFE conventions when porting?

@yurrriq

This comment has been minimized.

Show comment
Hide comment
@yurrriq

yurrriq Dec 26, 2015

Member

I'm picking this up again and going to favor Erlang Lisper† idioms over Clojurian.

† What's the best word like Clojurian, Erlanger, Lisper, Schemer, etc for LFE?

Member

yurrriq commented Dec 26, 2015

I'm picking this up again and going to favor Erlang Lisper† idioms over Clojurian.

† What's the best word like Clojurian, Erlanger, Lisper, Schemer, etc for LFE?

@oubiwann

This comment has been minimized.

Show comment
Hide comment
@oubiwann

oubiwann Jan 17, 2016

Member

I would go for "Lffers" (as in "lifer" e.g., "life-long service" ;-)) or "Liffian" :-D

Member

oubiwann commented Jan 17, 2016

I would go for "Lffers" (as in "lifer" e.g., "life-long service" ;-)) or "Liffian" :-D

@yurrriq yurrriq referenced this pull request Apr 26, 2016

Merged

[WIP] Add clojure lib #2

yurrriq added a commit to yurrriq/lfe that referenced this pull request Apr 27, 2016

Update include/clj-conditionals.lfe
Prefer LFE idioms to Clojure, per discussion, i.e. remove the local
fun*/2 and its invocations.

Reindent the fletrec form manually.

Related:
- lfex/clj#19
- rvirding#137

yurrriq added a commit to yurrriq/lfe that referenced this pull request May 16, 2016

Update include/clj-conditionals.lfe
Prefer LFE idioms to Clojure, per discussion, i.e. remove the local
fun*/2 and its invocations.

Reindent the fletrec form manually.

Related:
- lfex/clj#19
- rvirding#137

yurrriq added a commit to yurrriq/lfe that referenced this pull request May 28, 2016

Update include/clj-conditionals.lfe
Prefer LFE idioms to Clojure, per discussion, i.e. remove the local
fun*/2 and its invocations.

Reindent the fletrec form manually.

Related:
- lfex/clj#19
- rvirding#137

yurrriq added a commit to yurrriq/lfe that referenced this pull request Jul 14, 2016

Update include/clj-conditionals.lfe
Prefer LFE idioms to Clojure, per discussion, i.e. remove the local
fun*/2 and its invocations.

Reindent the fletrec form manually.

Related:
- lfex/clj#19
- rvirding#137

yurrriq added a commit to yurrriq/lfe that referenced this pull request Aug 20, 2016

Update include/clj-conditionals.lfe
Prefer LFE idioms to Clojure, per discussion, i.e. remove the local
fun*/2 and its invocations.

Reindent the fletrec form manually.

Related:
- lfex/clj#19
- rvirding#137

yurrriq added a commit to yurrriq/lfe that referenced this pull request Aug 30, 2016

Update include/clj-conditionals.lfe
Prefer LFE idioms to Clojure, per discussion, i.e. remove the local
fun*/2 and its invocations.

Reindent the fletrec form manually.

Related:
- lfex/clj#19
- rvirding#137

yurrriq added a commit to yurrriq/lfe that referenced this pull request Aug 30, 2016

Update include/clj-conditionals.lfe
Prefer LFE idioms to Clojure, per discussion, i.e. remove the local
fun*/2 and its invocations.

Reindent the fletrec form manually.

Related:
- lfex/clj#19
- rvirding#137
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment